circuit-to-svg 0.0.155 → 0.0.157
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 +3 -1
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -250,4 +250,6 @@ interface Options {
|
|
|
250
250
|
}
|
|
251
251
|
declare function convertCircuitJsonToSolderPasteMask(circuitJson: AnyCircuitElement[], options: Options): string;
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
declare function getSoftwareUsedString(circuitJson: AnyCircuitElement[]): string | undefined;
|
|
254
|
+
|
|
255
|
+
export { type ColorMap, type ColorOverrides, type PcbColorMap, type PcbColorOverrides, type PcbContext, circuitJsonToPcbSvg, circuitJsonToSchematicSvg, convertCircuitJsonToAssemblySvg, convertCircuitJsonToPcbSvg, convertCircuitJsonToSchematicSvg, convertCircuitJsonToSolderPasteMask, getSoftwareUsedString };
|
package/dist/index.js
CHANGED
|
@@ -1410,6 +1410,14 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
|
1410
1410
|
];
|
|
1411
1411
|
}
|
|
1412
1412
|
|
|
1413
|
+
// lib/utils/get-software-used-string.ts
|
|
1414
|
+
function getSoftwareUsedString(circuitJson) {
|
|
1415
|
+
const metadata = circuitJson.find(
|
|
1416
|
+
(e) => e.type === "project_software_metadata" || e.type === "source_project_metadata"
|
|
1417
|
+
);
|
|
1418
|
+
return metadata?.software_used_string;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1413
1421
|
// lib/pcb/convert-circuit-json-to-pcb-svg.ts
|
|
1414
1422
|
var OBJECT_ORDER = [
|
|
1415
1423
|
"pcb_trace_error",
|
|
@@ -1582,13 +1590,17 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1582
1590
|
);
|
|
1583
1591
|
}
|
|
1584
1592
|
children.push(...svgObjects);
|
|
1593
|
+
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
1585
1594
|
const svgObject = {
|
|
1586
1595
|
name: "svg",
|
|
1587
1596
|
type: "element",
|
|
1588
1597
|
attributes: {
|
|
1589
1598
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1590
1599
|
width: svgWidth.toString(),
|
|
1591
|
-
height: svgHeight.toString()
|
|
1600
|
+
height: svgHeight.toString(),
|
|
1601
|
+
...softwareUsedString && {
|
|
1602
|
+
"data-software-used-string": softwareUsedString
|
|
1603
|
+
}
|
|
1592
1604
|
},
|
|
1593
1605
|
value: "",
|
|
1594
1606
|
children: children.filter((child) => child !== null)
|
|
@@ -2019,13 +2031,17 @@ function convertCircuitJsonToAssemblySvg(soup, options) {
|
|
|
2019
2031
|
const svgObjects = soup.sort(
|
|
2020
2032
|
(a, b) => (OBJECT_ORDER2.indexOf(b.type) ?? 9999) - (OBJECT_ORDER2.indexOf(a.type) ?? 9999)
|
|
2021
2033
|
).flatMap((item) => createSvgObjects2(item, transform, soup));
|
|
2034
|
+
const softwareUsedString = getSoftwareUsedString(soup);
|
|
2022
2035
|
const svgObject = {
|
|
2023
2036
|
name: "svg",
|
|
2024
2037
|
type: "element",
|
|
2025
2038
|
attributes: {
|
|
2026
2039
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2027
2040
|
width: svgWidth.toString(),
|
|
2028
|
-
height: svgHeight.toString()
|
|
2041
|
+
height: svgHeight.toString(),
|
|
2042
|
+
...softwareUsedString && {
|
|
2043
|
+
"data-software-used-string": softwareUsedString
|
|
2044
|
+
}
|
|
2029
2045
|
},
|
|
2030
2046
|
value: "",
|
|
2031
2047
|
children: [
|
|
@@ -4883,6 +4899,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
4883
4899
|
width: (xRight - xLeft).toString(),
|
|
4884
4900
|
height: (yBottom - yTop).toString(),
|
|
4885
4901
|
"stroke-width": `${getSchStrokeSize(transform)}px`,
|
|
4902
|
+
"vector-effect": "non-scaling-stroke",
|
|
4886
4903
|
stroke: colorMap2.schematic.component_outline || "black",
|
|
4887
4904
|
fill: "transparent"
|
|
4888
4905
|
};
|
|
@@ -5046,6 +5063,7 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
5046
5063
|
})
|
|
5047
5064
|
);
|
|
5048
5065
|
}
|
|
5066
|
+
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
5049
5067
|
const svgObject = {
|
|
5050
5068
|
name: "svg",
|
|
5051
5069
|
type: "element",
|
|
@@ -5054,7 +5072,10 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
5054
5072
|
width: svgWidth.toString(),
|
|
5055
5073
|
height: svgHeight.toString(),
|
|
5056
5074
|
style: `background-color: ${colorMap2.schematic.background}`,
|
|
5057
|
-
"data-real-to-screen-transform": toSVG(transform)
|
|
5075
|
+
"data-real-to-screen-transform": toSVG(transform),
|
|
5076
|
+
...softwareUsedString && {
|
|
5077
|
+
"data-software-used-string": softwareUsedString
|
|
5078
|
+
}
|
|
5058
5079
|
},
|
|
5059
5080
|
children: [
|
|
5060
5081
|
// Add styles
|
|
@@ -5240,13 +5261,17 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
|
|
|
5240
5261
|
const svgObjects = filteredCircuitJson.sort(
|
|
5241
5262
|
(a, b) => (OBJECT_ORDER3.indexOf(b.type) ?? 9999) - (OBJECT_ORDER3.indexOf(a.type) ?? 9999)
|
|
5242
5263
|
).flatMap((item) => createSvgObjects3({ elm: item, ctx }));
|
|
5264
|
+
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
5243
5265
|
const svgObject = {
|
|
5244
5266
|
name: "svg",
|
|
5245
5267
|
type: "element",
|
|
5246
5268
|
attributes: {
|
|
5247
5269
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5248
5270
|
width: svgWidth.toString(),
|
|
5249
|
-
height: svgHeight.toString()
|
|
5271
|
+
height: svgHeight.toString(),
|
|
5272
|
+
...softwareUsedString && {
|
|
5273
|
+
"data-software-used-string": softwareUsedString
|
|
5274
|
+
}
|
|
5250
5275
|
},
|
|
5251
5276
|
value: "",
|
|
5252
5277
|
children: [
|
|
@@ -5340,6 +5365,7 @@ export {
|
|
|
5340
5365
|
convertCircuitJsonToAssemblySvg,
|
|
5341
5366
|
convertCircuitJsonToPcbSvg,
|
|
5342
5367
|
convertCircuitJsonToSchematicSvg,
|
|
5343
|
-
convertCircuitJsonToSolderPasteMask
|
|
5368
|
+
convertCircuitJsonToSolderPasteMask,
|
|
5369
|
+
getSoftwareUsedString
|
|
5344
5370
|
};
|
|
5345
5371
|
//# sourceMappingURL=index.js.map
|