easyeda 0.0.279 → 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 +16 -18
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +16 -18
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +17 -19
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7959,10 +7959,11 @@ var isSwitchCategoryComponent = (betterEasy) => {
|
|
|
7959
7959
|
|
|
7960
7960
|
// lib/websafe/convert-to-typescript-component/generate-symbol-tsx.ts
|
|
7961
7961
|
var round = (value) => Number(value.toFixed(6));
|
|
7962
|
-
var
|
|
7962
|
+
var EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT = 0.02;
|
|
7963
|
+
var toSchematicUnits = (value) => round(value * EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT);
|
|
7963
7964
|
var getPointTransformer = (origin) => (point2) => ({
|
|
7964
|
-
x:
|
|
7965
|
-
y:
|
|
7965
|
+
x: toSchematicUnits(point2.x - origin.x),
|
|
7966
|
+
y: toSchematicUnits(origin.y - point2.y)
|
|
7966
7967
|
});
|
|
7967
7968
|
var formatNumber = (value) => String(round(value));
|
|
7968
7969
|
var SVG_PATH_COMMAND_PARAMETER_COUNTS = {
|
|
@@ -8067,8 +8068,8 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
8067
8068
|
output.push(
|
|
8068
8069
|
[
|
|
8069
8070
|
"A",
|
|
8070
|
-
formatNumber(
|
|
8071
|
-
formatNumber(
|
|
8071
|
+
formatNumber(toSchematicUnits(Math.abs(values[0]))),
|
|
8072
|
+
formatNumber(toSchematicUnits(Math.abs(values[1]))),
|
|
8072
8073
|
formatNumber(-values[2]),
|
|
8073
8074
|
String(values[3]),
|
|
8074
8075
|
String(values[4] === 0 ? 1 : 0),
|
|
@@ -8092,15 +8093,12 @@ var getPinDirection = (rotation2) => {
|
|
|
8092
8093
|
var getPinStemLength = (path) => {
|
|
8093
8094
|
const segment = path.match(/[hHvV]\s*(-?(?:\d*\.\d+|\d+\.?))/);
|
|
8094
8095
|
if (!segment) return void 0;
|
|
8095
|
-
return
|
|
8096
|
+
return toSchematicUnits(Math.abs(Number(segment[1])));
|
|
8096
8097
|
};
|
|
8097
|
-
var
|
|
8098
|
+
var getTextFontSize = (fontSize) => {
|
|
8098
8099
|
const numericFontSize = Number.parseFloat(fontSize);
|
|
8099
|
-
if (!Number.isFinite(numericFontSize)) return
|
|
8100
|
-
|
|
8101
|
-
return round(numericFontSize * 25.4 / 72);
|
|
8102
|
-
}
|
|
8103
|
-
return toMillimeters(numericFontSize);
|
|
8100
|
+
if (!Number.isFinite(numericFontSize)) return 0.2;
|
|
8101
|
+
return toSchematicUnits(numericFontSize);
|
|
8104
8102
|
};
|
|
8105
8103
|
var getTextAnchor = (alignment) => {
|
|
8106
8104
|
if (alignment === "L") return "left";
|
|
@@ -8178,32 +8176,32 @@ var generateShapeTsx = ({
|
|
|
8178
8176
|
x: shape.position.x + shape.width / 2,
|
|
8179
8177
|
y: shape.position.y + shape.height / 2
|
|
8180
8178
|
});
|
|
8181
|
-
return `<schematicrect schX={${center.x}} schY={${center.y}} width={${
|
|
8179
|
+
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)}` : ""} />`;
|
|
8182
8180
|
}
|
|
8183
8181
|
if (shape.type === "ELLIPSE") {
|
|
8184
8182
|
const center = transformPoint(shape.center);
|
|
8185
|
-
return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${
|
|
8183
|
+
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)}` : ""} />`;
|
|
8186
8184
|
}
|
|
8187
8185
|
if (shape.type === "POLYLINE" || shape.type === "POLYGON") {
|
|
8188
8186
|
const isPolygon = shape.type === "POLYGON";
|
|
8189
8187
|
const points = shape.points.map(transformPoint);
|
|
8190
8188
|
if (isPolygon && points.length > 0) points.push(points[0]);
|
|
8191
|
-
return `<schematicpath points={${JSON.stringify(points)}}
|
|
8189
|
+
return `<schematicpath points={${JSON.stringify(points)}} strokeColor=${JSON.stringify(isPolygon ? shape.lineColor : shape.color)}${isPolygon && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
8192
8190
|
}
|
|
8193
8191
|
if (shape.type === "PATH") {
|
|
8194
8192
|
const transformedPath = transformSvgPath(shape.pathData, origin);
|
|
8195
8193
|
if (!transformedPath) return void 0;
|
|
8196
|
-
return `<schematicpath svgPath=${JSON.stringify(transformedPath)}
|
|
8194
|
+
return `<schematicpath svgPath=${JSON.stringify(transformedPath)} strokeColor=${JSON.stringify(shape.strokeColor)}${shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
8197
8195
|
}
|
|
8198
8196
|
if (shape.type === "ARC") {
|
|
8199
8197
|
const transformedPath = transformSvgPath(shape.pathData, origin);
|
|
8200
8198
|
if (!transformedPath) return void 0;
|
|
8201
|
-
return `<schematicpath svgPath=${JSON.stringify(transformedPath)}
|
|
8199
|
+
return `<schematicpath svgPath=${JSON.stringify(transformedPath)} strokeColor=${JSON.stringify(shape.color)} />`;
|
|
8202
8200
|
}
|
|
8203
8201
|
if (shape.type === "TEXT") {
|
|
8204
8202
|
if (shape.visibility !== "1") return void 0;
|
|
8205
8203
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|
|
8206
|
-
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${
|
|
8204
|
+
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)}} />`;
|
|
8207
8205
|
}
|
|
8208
8206
|
if (shape.type === "PIN" && portMetadata) {
|
|
8209
8207
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|