circuit-to-svg 0.0.259 → 0.0.261
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/index.d.ts +10 -2
- package/dist/index.js +210 -94
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ interface Options$4 {
|
|
|
46
46
|
width?: number;
|
|
47
47
|
height?: number;
|
|
48
48
|
shouldDrawErrors?: boolean;
|
|
49
|
+
showErrorsInTextOverlay?: boolean;
|
|
49
50
|
shouldDrawRatsNest?: boolean;
|
|
50
51
|
showCourtyards?: boolean;
|
|
51
52
|
showPcbGroups?: boolean;
|
|
@@ -77,6 +78,7 @@ interface Options$3 {
|
|
|
77
78
|
width?: number;
|
|
78
79
|
height?: number;
|
|
79
80
|
includeVersion?: boolean;
|
|
81
|
+
showErrorsInTextOverlay?: boolean;
|
|
80
82
|
}
|
|
81
83
|
interface AssemblySvgContext {
|
|
82
84
|
transform: Matrix;
|
|
@@ -101,6 +103,7 @@ interface Options$2 {
|
|
|
101
103
|
width?: number;
|
|
102
104
|
height?: number;
|
|
103
105
|
includeVersion?: boolean;
|
|
106
|
+
showErrorsInTextOverlay?: boolean;
|
|
104
107
|
}
|
|
105
108
|
interface PinoutLabel {
|
|
106
109
|
pcb_port: PcbPort;
|
|
@@ -301,6 +304,7 @@ interface Options$1 {
|
|
|
301
304
|
label: string;
|
|
302
305
|
}>;
|
|
303
306
|
includeVersion?: boolean;
|
|
307
|
+
showErrorsInTextOverlay?: boolean;
|
|
304
308
|
}
|
|
305
309
|
declare function convertCircuitJsonToSchematicSvg(circuitJson: AnyCircuitElement[], options?: Options$1): string;
|
|
306
310
|
/**
|
|
@@ -322,14 +326,16 @@ interface ConvertSchematicSimulationParams {
|
|
|
322
326
|
schematicHeightRatio?: number;
|
|
323
327
|
schematicOptions?: Omit<Parameters<typeof convertCircuitJsonToSchematicSvg>[1], "width" | "height" | "includeVersion">;
|
|
324
328
|
includeVersion?: boolean;
|
|
329
|
+
showErrorsInTextOverlay?: boolean;
|
|
325
330
|
}
|
|
326
|
-
declare function convertCircuitJsonToSchematicSimulationSvg({ circuitJson, simulation_experiment_id, simulation_transient_voltage_graph_ids, width, height, schematicHeightRatio, schematicOptions, includeVersion, }: ConvertSchematicSimulationParams): string;
|
|
331
|
+
declare function convertCircuitJsonToSchematicSimulationSvg({ circuitJson, simulation_experiment_id, simulation_transient_voltage_graph_ids, width, height, schematicHeightRatio, schematicOptions, includeVersion, showErrorsInTextOverlay, }: ConvertSchematicSimulationParams): string;
|
|
327
332
|
|
|
328
333
|
interface Options {
|
|
329
334
|
layer: "top" | "bottom";
|
|
330
335
|
width?: number;
|
|
331
336
|
height?: number;
|
|
332
337
|
includeVersion?: boolean;
|
|
338
|
+
showErrorsInTextOverlay?: boolean;
|
|
333
339
|
}
|
|
334
340
|
declare function convertCircuitJsonToSolderPasteMask(circuitJson: AnyCircuitElement[], options: Options): string;
|
|
335
341
|
|
|
@@ -353,4 +359,6 @@ declare const createSvgObjectsForSchComponentPortHovers: ({ component, transform
|
|
|
353
359
|
circuitJson: AnyCircuitElement[];
|
|
354
360
|
}) => INode[];
|
|
355
361
|
|
|
356
|
-
|
|
362
|
+
declare function createErrorTextOverlay(circuitJson: AnyCircuitElement[], dataType?: string): INode | null;
|
|
363
|
+
|
|
364
|
+
export { type AssemblySvgContext, CIRCUIT_TO_SVG_VERSION, type CircuitJsonWithSimulation, type ColorMap, type ColorOverrides, type PcbColorMap, type PcbColorOverrides, type PcbContext, type PinoutLabel, type PinoutSvgContext, circuitJsonToPcbSvg, circuitJsonToSchematicSvg, convertCircuitJsonToAssemblySvg, convertCircuitJsonToPcbSvg, convertCircuitJsonToPinoutSvg, convertCircuitJsonToSchematicSimulationSvg, convertCircuitJsonToSchematicSvg, convertCircuitJsonToSimulationGraphSvg, convertCircuitJsonToSolderPasteMask, createErrorTextOverlay, createSvgObjectsForSchComponentPortHovers, getSoftwareUsedString, isSimulationExperiment, isSimulationTransientVoltageGraph, isSimulationVoltageProbe };
|
package/dist/index.js
CHANGED
|
@@ -538,7 +538,8 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
538
538
|
color,
|
|
539
539
|
layer = "top",
|
|
540
540
|
pcb_component_id,
|
|
541
|
-
pcb_fabrication_note_rect_id
|
|
541
|
+
pcb_fabrication_note_rect_id,
|
|
542
|
+
corner_radius
|
|
542
543
|
} = fabricationNoteRect;
|
|
543
544
|
if (layerFilter && layer !== layerFilter) return [];
|
|
544
545
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
@@ -566,6 +567,9 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
566
567
|
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
567
568
|
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
568
569
|
const overlayStrokeColor = color ?? DEFAULT_OVERLAY_STROKE_COLOR;
|
|
570
|
+
const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
|
|
571
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
572
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
569
573
|
const attributes = {
|
|
570
574
|
x: rectX.toString(),
|
|
571
575
|
y: rectY.toString(),
|
|
@@ -579,6 +583,12 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
579
583
|
if (pcb_component_id !== void 0) {
|
|
580
584
|
attributes["data-pcb-component-id"] = pcb_component_id;
|
|
581
585
|
}
|
|
586
|
+
if (transformedCornerRadiusX > 0) {
|
|
587
|
+
attributes.rx = transformedCornerRadiusX.toString();
|
|
588
|
+
}
|
|
589
|
+
if (transformedCornerRadiusY > 0) {
|
|
590
|
+
attributes.ry = transformedCornerRadiusY.toString();
|
|
591
|
+
}
|
|
582
592
|
if (is_filled) {
|
|
583
593
|
attributes.fill = color ?? DEFAULT_OVERLAY_FILL_COLOR;
|
|
584
594
|
} else {
|
|
@@ -1411,7 +1421,8 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
1411
1421
|
is_filled,
|
|
1412
1422
|
has_stroke,
|
|
1413
1423
|
is_stroke_dashed,
|
|
1414
|
-
color
|
|
1424
|
+
color,
|
|
1425
|
+
corner_radius
|
|
1415
1426
|
} = noteRect;
|
|
1416
1427
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
1417
1428
|
console.error("Invalid pcb_note_rect data", { center, width, height });
|
|
@@ -1433,6 +1444,9 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
1433
1444
|
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
1434
1445
|
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
1435
1446
|
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
1447
|
+
const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
|
|
1448
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
1449
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
1436
1450
|
const overlayColor = color ?? DEFAULT_OVERLAY_COLOR2;
|
|
1437
1451
|
const attributes = {
|
|
1438
1452
|
x: rectX.toString(),
|
|
@@ -1444,6 +1458,12 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
1444
1458
|
"data-pcb-note-rect-id": noteRect.pcb_note_rect_id,
|
|
1445
1459
|
"data-pcb-layer": "overlay"
|
|
1446
1460
|
};
|
|
1461
|
+
if (transformedCornerRadiusX > 0) {
|
|
1462
|
+
attributes.rx = transformedCornerRadiusX.toString();
|
|
1463
|
+
}
|
|
1464
|
+
if (transformedCornerRadiusY > 0) {
|
|
1465
|
+
attributes.ry = transformedCornerRadiusY.toString();
|
|
1466
|
+
}
|
|
1447
1467
|
if (is_filled) {
|
|
1448
1468
|
attributes.fill = color ?? DEFAULT_FILL_COLOR;
|
|
1449
1469
|
} else {
|
|
@@ -2067,7 +2087,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2067
2087
|
stroke_width,
|
|
2068
2088
|
is_filled,
|
|
2069
2089
|
has_stroke,
|
|
2070
|
-
is_stroke_dashed
|
|
2090
|
+
is_stroke_dashed,
|
|
2091
|
+
corner_radius
|
|
2071
2092
|
} = pcbSilkscreenRect;
|
|
2072
2093
|
if (layerFilter && layer !== layerFilter) return [];
|
|
2073
2094
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
@@ -2078,6 +2099,9 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2078
2099
|
center.x,
|
|
2079
2100
|
center.y
|
|
2080
2101
|
]);
|
|
2102
|
+
const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
|
|
2103
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
2104
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
2081
2105
|
const transformedWidth = width * Math.abs(transform.a);
|
|
2082
2106
|
const transformedHeight = height * Math.abs(transform.d);
|
|
2083
2107
|
const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
|
|
@@ -2092,6 +2116,12 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2092
2116
|
"data-type": "pcb_silkscreen_rect",
|
|
2093
2117
|
"data-pcb-layer": layer
|
|
2094
2118
|
};
|
|
2119
|
+
if (transformedCornerRadiusX > 0) {
|
|
2120
|
+
attributes.rx = transformedCornerRadiusX.toString();
|
|
2121
|
+
}
|
|
2122
|
+
if (transformedCornerRadiusY > 0) {
|
|
2123
|
+
attributes.ry = transformedCornerRadiusY.toString();
|
|
2124
|
+
}
|
|
2095
2125
|
attributes.fill = is_filled ? color : "none";
|
|
2096
2126
|
let actualHasStroke;
|
|
2097
2127
|
if (has_stroke === void 0) {
|
|
@@ -3472,7 +3502,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3472
3502
|
var package_default = {
|
|
3473
3503
|
name: "circuit-to-svg",
|
|
3474
3504
|
type: "module",
|
|
3475
|
-
version: "0.0.
|
|
3505
|
+
version: "0.0.260",
|
|
3476
3506
|
description: "Convert Circuit JSON to SVG",
|
|
3477
3507
|
main: "dist/index.js",
|
|
3478
3508
|
files: [
|
|
@@ -3496,7 +3526,7 @@ var package_default = {
|
|
|
3496
3526
|
"bun-match-svg": "^0.0.12",
|
|
3497
3527
|
esbuild: "^0.20.2",
|
|
3498
3528
|
"performance-now": "^2.1.0",
|
|
3499
|
-
"circuit-json": "^0.0.
|
|
3529
|
+
"circuit-json": "^0.0.297",
|
|
3500
3530
|
react: "19.1.0",
|
|
3501
3531
|
"react-cosmos": "7.0.0",
|
|
3502
3532
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -3595,6 +3625,53 @@ function getTypePriority(type) {
|
|
|
3595
3625
|
return TYPE_PRIORITY[type] ?? DEFAULT_TYPE_PRIORITY;
|
|
3596
3626
|
}
|
|
3597
3627
|
|
|
3628
|
+
// lib/utils/create-error-text-overlay.ts
|
|
3629
|
+
function createErrorTextOverlay(circuitJson, dataType = "error_text_overlay") {
|
|
3630
|
+
const errorElms = circuitJson.filter(
|
|
3631
|
+
(elm) => elm.type.endsWith("_error")
|
|
3632
|
+
);
|
|
3633
|
+
if (errorElms.length === 0) {
|
|
3634
|
+
return null;
|
|
3635
|
+
}
|
|
3636
|
+
const errorMessages = errorElms.map((e) => e.message).filter((m) => !!m);
|
|
3637
|
+
if (errorMessages.length === 0) {
|
|
3638
|
+
return null;
|
|
3639
|
+
}
|
|
3640
|
+
const textBlock = {
|
|
3641
|
+
name: "text",
|
|
3642
|
+
type: "element",
|
|
3643
|
+
value: "",
|
|
3644
|
+
attributes: {
|
|
3645
|
+
x: "10",
|
|
3646
|
+
y: "20",
|
|
3647
|
+
fill: "red",
|
|
3648
|
+
"font-family": "monospace",
|
|
3649
|
+
"font-size": "12px",
|
|
3650
|
+
"data-type": dataType,
|
|
3651
|
+
"data-layer": "global"
|
|
3652
|
+
},
|
|
3653
|
+
children: errorMessages.map((msg, i) => ({
|
|
3654
|
+
name: "tspan",
|
|
3655
|
+
type: "element",
|
|
3656
|
+
value: "",
|
|
3657
|
+
attributes: {
|
|
3658
|
+
x: "10",
|
|
3659
|
+
dy: i === 0 ? "0" : "1.2em"
|
|
3660
|
+
},
|
|
3661
|
+
children: [
|
|
3662
|
+
{
|
|
3663
|
+
type: "text",
|
|
3664
|
+
value: msg,
|
|
3665
|
+
name: "",
|
|
3666
|
+
attributes: {},
|
|
3667
|
+
children: []
|
|
3668
|
+
}
|
|
3669
|
+
]
|
|
3670
|
+
}))
|
|
3671
|
+
};
|
|
3672
|
+
return textBlock;
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3598
3675
|
// lib/pcb/convert-circuit-json-to-pcb-svg.ts
|
|
3599
3676
|
function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
3600
3677
|
const drawPaddingOutsideBoard = options?.drawPaddingOutsideBoard ?? true;
|
|
@@ -3829,6 +3906,15 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3829
3906
|
if (gridObjects.rect) {
|
|
3830
3907
|
children.push(gridObjects.rect);
|
|
3831
3908
|
}
|
|
3909
|
+
if (options?.showErrorsInTextOverlay) {
|
|
3910
|
+
const errorOverlay = createErrorTextOverlay(
|
|
3911
|
+
circuitJson,
|
|
3912
|
+
"pcb_error_text_overlay"
|
|
3913
|
+
);
|
|
3914
|
+
if (errorOverlay) {
|
|
3915
|
+
children.push(errorOverlay);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3832
3918
|
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
3833
3919
|
const version = CIRCUIT_TO_SVG_VERSION;
|
|
3834
3920
|
const svgObject = {
|
|
@@ -4835,29 +4921,14 @@ function convertCircuitJsonToAssemblySvg(soup, options) {
|
|
|
4835
4921
|
).flatMap((item) => createSvgObjects2(item, ctx, soup));
|
|
4836
4922
|
const softwareUsedString = getSoftwareUsedString(soup);
|
|
4837
4923
|
const version = CIRCUIT_TO_SVG_VERSION;
|
|
4838
|
-
const
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
"data-software-used-string": softwareUsedString
|
|
4847
|
-
},
|
|
4848
|
-
...options?.includeVersion && {
|
|
4849
|
-
"data-circuit-to-svg-version": version
|
|
4850
|
-
}
|
|
4851
|
-
},
|
|
4852
|
-
value: "",
|
|
4853
|
-
children: [
|
|
4854
|
-
{
|
|
4855
|
-
name: "style",
|
|
4856
|
-
type: "element",
|
|
4857
|
-
children: [
|
|
4858
|
-
{
|
|
4859
|
-
type: "text",
|
|
4860
|
-
value: `
|
|
4924
|
+
const children = [
|
|
4925
|
+
{
|
|
4926
|
+
name: "style",
|
|
4927
|
+
type: "element",
|
|
4928
|
+
children: [
|
|
4929
|
+
{
|
|
4930
|
+
type: "text",
|
|
4931
|
+
value: `
|
|
4861
4932
|
.assembly-component {
|
|
4862
4933
|
fill: none;
|
|
4863
4934
|
stroke: #000;
|
|
@@ -4880,30 +4951,52 @@ function convertCircuitJsonToAssemblySvg(soup, options) {
|
|
|
4880
4951
|
stroke-width: 0.2;
|
|
4881
4952
|
}
|
|
4882
4953
|
`,
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4954
|
+
name: "",
|
|
4955
|
+
attributes: {},
|
|
4956
|
+
children: []
|
|
4957
|
+
}
|
|
4958
|
+
],
|
|
4959
|
+
value: "",
|
|
4960
|
+
attributes: {}
|
|
4961
|
+
},
|
|
4962
|
+
{
|
|
4963
|
+
name: "rect",
|
|
4964
|
+
type: "element",
|
|
4965
|
+
attributes: {
|
|
4966
|
+
fill: "#fff",
|
|
4967
|
+
x: "0",
|
|
4968
|
+
y: "0",
|
|
4969
|
+
width: svgWidth.toString(),
|
|
4970
|
+
height: svgHeight.toString()
|
|
4890
4971
|
},
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4972
|
+
value: "",
|
|
4973
|
+
children: []
|
|
4974
|
+
},
|
|
4975
|
+
createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY),
|
|
4976
|
+
...svgObjects
|
|
4977
|
+
].filter((child) => child !== null);
|
|
4978
|
+
if (options?.showErrorsInTextOverlay) {
|
|
4979
|
+
const errorOverlay = createErrorTextOverlay(soup);
|
|
4980
|
+
if (errorOverlay) {
|
|
4981
|
+
children.push(errorOverlay);
|
|
4982
|
+
}
|
|
4983
|
+
}
|
|
4984
|
+
const svgObject = {
|
|
4985
|
+
name: "svg",
|
|
4986
|
+
type: "element",
|
|
4987
|
+
attributes: {
|
|
4988
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4989
|
+
width: svgWidth.toString(),
|
|
4990
|
+
height: svgHeight.toString(),
|
|
4991
|
+
...softwareUsedString && {
|
|
4992
|
+
"data-software-used-string": softwareUsedString
|
|
4903
4993
|
},
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4994
|
+
...options?.includeVersion && {
|
|
4995
|
+
"data-circuit-to-svg-version": version
|
|
4996
|
+
}
|
|
4997
|
+
},
|
|
4998
|
+
value: "",
|
|
4999
|
+
children
|
|
4907
5000
|
};
|
|
4908
5001
|
return stringify2(svgObject);
|
|
4909
5002
|
}
|
|
@@ -6200,6 +6293,28 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
|
|
|
6200
6293
|
).flatMap((item) => createSvgObjects3(item, ctx, soup));
|
|
6201
6294
|
const softwareUsedString = getSoftwareUsedString(soup);
|
|
6202
6295
|
const version = CIRCUIT_TO_SVG_VERSION;
|
|
6296
|
+
const children = [
|
|
6297
|
+
{
|
|
6298
|
+
name: "rect",
|
|
6299
|
+
type: "element",
|
|
6300
|
+
attributes: {
|
|
6301
|
+
fill: "rgb(255, 255, 255)",
|
|
6302
|
+
x: "0",
|
|
6303
|
+
y: "0",
|
|
6304
|
+
width: svgWidth.toString(),
|
|
6305
|
+
height: svgHeight.toString()
|
|
6306
|
+
},
|
|
6307
|
+
value: "",
|
|
6308
|
+
children: []
|
|
6309
|
+
},
|
|
6310
|
+
...svgObjects
|
|
6311
|
+
].filter((child) => child !== null);
|
|
6312
|
+
if (options?.showErrorsInTextOverlay) {
|
|
6313
|
+
const errorOverlay = createErrorTextOverlay(soup);
|
|
6314
|
+
if (errorOverlay) {
|
|
6315
|
+
children.push(errorOverlay);
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6203
6318
|
const svgObject = {
|
|
6204
6319
|
name: "svg",
|
|
6205
6320
|
type: "element",
|
|
@@ -6215,22 +6330,7 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
|
|
|
6215
6330
|
}
|
|
6216
6331
|
},
|
|
6217
6332
|
value: "",
|
|
6218
|
-
children
|
|
6219
|
-
{
|
|
6220
|
-
name: "rect",
|
|
6221
|
-
type: "element",
|
|
6222
|
-
attributes: {
|
|
6223
|
-
fill: "rgb(255, 255, 255)",
|
|
6224
|
-
x: "0",
|
|
6225
|
-
y: "0",
|
|
6226
|
-
width: svgWidth.toString(),
|
|
6227
|
-
height: svgHeight.toString()
|
|
6228
|
-
},
|
|
6229
|
-
value: "",
|
|
6230
|
-
children: []
|
|
6231
|
-
},
|
|
6232
|
-
...svgObjects
|
|
6233
|
-
].filter((child) => child !== null)
|
|
6333
|
+
children
|
|
6234
6334
|
};
|
|
6235
6335
|
return stringify3(svgObject);
|
|
6236
6336
|
}
|
|
@@ -9751,6 +9851,12 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
9751
9851
|
}
|
|
9752
9852
|
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
9753
9853
|
const version = CIRCUIT_TO_SVG_VERSION;
|
|
9854
|
+
if (options?.showErrorsInTextOverlay) {
|
|
9855
|
+
const errorOverlay = createErrorTextOverlay(circuitJson);
|
|
9856
|
+
if (errorOverlay) {
|
|
9857
|
+
svgChildren.push(errorOverlay);
|
|
9858
|
+
}
|
|
9859
|
+
}
|
|
9754
9860
|
const svgObject = {
|
|
9755
9861
|
name: "svg",
|
|
9756
9862
|
type: "element",
|
|
@@ -10446,7 +10552,8 @@ function convertCircuitJsonToSchematicSimulationSvg({
|
|
|
10446
10552
|
height = DEFAULT_HEIGHT2,
|
|
10447
10553
|
schematicHeightRatio = DEFAULT_SCHEMATIC_RATIO,
|
|
10448
10554
|
schematicOptions,
|
|
10449
|
-
includeVersion
|
|
10555
|
+
includeVersion,
|
|
10556
|
+
showErrorsInTextOverlay
|
|
10450
10557
|
}) {
|
|
10451
10558
|
const schematicElements = circuitJson.filter(
|
|
10452
10559
|
(element) => !isSimulationExperiment(element) && !isSimulationTransientVoltageGraph(element)
|
|
@@ -10462,7 +10569,8 @@ function convertCircuitJsonToSchematicSimulationSvg({
|
|
|
10462
10569
|
...schematicOptions,
|
|
10463
10570
|
width,
|
|
10464
10571
|
height: schematicHeight,
|
|
10465
|
-
includeVersion: false
|
|
10572
|
+
includeVersion: false,
|
|
10573
|
+
showErrorsInTextOverlay
|
|
10466
10574
|
});
|
|
10467
10575
|
const simulationSvg = convertCircuitJsonToSimulationGraphSvg({
|
|
10468
10576
|
circuitJson,
|
|
@@ -10703,6 +10811,38 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
|
|
|
10703
10811
|
).flatMap((item) => createSvgObjects4({ elm: item, ctx }));
|
|
10704
10812
|
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
10705
10813
|
const version = CIRCUIT_TO_SVG_VERSION;
|
|
10814
|
+
const children = [
|
|
10815
|
+
{
|
|
10816
|
+
name: "style",
|
|
10817
|
+
type: "element",
|
|
10818
|
+
children: [
|
|
10819
|
+
{
|
|
10820
|
+
type: "text",
|
|
10821
|
+
value: ""
|
|
10822
|
+
}
|
|
10823
|
+
]
|
|
10824
|
+
},
|
|
10825
|
+
{
|
|
10826
|
+
name: "rect",
|
|
10827
|
+
type: "element",
|
|
10828
|
+
attributes: {
|
|
10829
|
+
class: "boundary",
|
|
10830
|
+
x: "0",
|
|
10831
|
+
y: "0",
|
|
10832
|
+
fill: "#000",
|
|
10833
|
+
width: svgWidth.toString(),
|
|
10834
|
+
height: svgHeight.toString()
|
|
10835
|
+
}
|
|
10836
|
+
},
|
|
10837
|
+
createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY),
|
|
10838
|
+
...svgObjects
|
|
10839
|
+
].filter((child) => child !== null);
|
|
10840
|
+
if (options?.showErrorsInTextOverlay) {
|
|
10841
|
+
const errorOverlay = createErrorTextOverlay(circuitJson);
|
|
10842
|
+
if (errorOverlay) {
|
|
10843
|
+
children.push(errorOverlay);
|
|
10844
|
+
}
|
|
10845
|
+
}
|
|
10706
10846
|
const svgObject = {
|
|
10707
10847
|
name: "svg",
|
|
10708
10848
|
type: "element",
|
|
@@ -10718,32 +10858,7 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
|
|
|
10718
10858
|
}
|
|
10719
10859
|
},
|
|
10720
10860
|
value: "",
|
|
10721
|
-
children
|
|
10722
|
-
{
|
|
10723
|
-
name: "style",
|
|
10724
|
-
type: "element",
|
|
10725
|
-
children: [
|
|
10726
|
-
{
|
|
10727
|
-
type: "text",
|
|
10728
|
-
value: ""
|
|
10729
|
-
}
|
|
10730
|
-
]
|
|
10731
|
-
},
|
|
10732
|
-
{
|
|
10733
|
-
name: "rect",
|
|
10734
|
-
type: "element",
|
|
10735
|
-
attributes: {
|
|
10736
|
-
class: "boundary",
|
|
10737
|
-
x: "0",
|
|
10738
|
-
y: "0",
|
|
10739
|
-
fill: "#000",
|
|
10740
|
-
width: svgWidth.toString(),
|
|
10741
|
-
height: svgHeight.toString()
|
|
10742
|
-
}
|
|
10743
|
-
},
|
|
10744
|
-
createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY),
|
|
10745
|
-
...svgObjects
|
|
10746
|
-
].filter((child) => child !== null)
|
|
10861
|
+
children
|
|
10747
10862
|
};
|
|
10748
10863
|
try {
|
|
10749
10864
|
return stringify7(svgObject);
|
|
@@ -10814,6 +10929,7 @@ export {
|
|
|
10814
10929
|
convertCircuitJsonToSchematicSvg,
|
|
10815
10930
|
convertCircuitJsonToSimulationGraphSvg,
|
|
10816
10931
|
convertCircuitJsonToSolderPasteMask,
|
|
10932
|
+
createErrorTextOverlay,
|
|
10817
10933
|
createSvgObjectsForSchComponentPortHovers,
|
|
10818
10934
|
getSoftwareUsedString,
|
|
10819
10935
|
isSimulationExperiment,
|