circuit-to-svg 0.0.156 → 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 +30 -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: [
|
|
@@ -5047,6 +5063,7 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
5047
5063
|
})
|
|
5048
5064
|
);
|
|
5049
5065
|
}
|
|
5066
|
+
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
5050
5067
|
const svgObject = {
|
|
5051
5068
|
name: "svg",
|
|
5052
5069
|
type: "element",
|
|
@@ -5055,7 +5072,10 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
|
|
|
5055
5072
|
width: svgWidth.toString(),
|
|
5056
5073
|
height: svgHeight.toString(),
|
|
5057
5074
|
style: `background-color: ${colorMap2.schematic.background}`,
|
|
5058
|
-
"data-real-to-screen-transform": toSVG(transform)
|
|
5075
|
+
"data-real-to-screen-transform": toSVG(transform),
|
|
5076
|
+
...softwareUsedString && {
|
|
5077
|
+
"data-software-used-string": softwareUsedString
|
|
5078
|
+
}
|
|
5059
5079
|
},
|
|
5060
5080
|
children: [
|
|
5061
5081
|
// Add styles
|
|
@@ -5241,13 +5261,17 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
|
|
|
5241
5261
|
const svgObjects = filteredCircuitJson.sort(
|
|
5242
5262
|
(a, b) => (OBJECT_ORDER3.indexOf(b.type) ?? 9999) - (OBJECT_ORDER3.indexOf(a.type) ?? 9999)
|
|
5243
5263
|
).flatMap((item) => createSvgObjects3({ elm: item, ctx }));
|
|
5264
|
+
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
5244
5265
|
const svgObject = {
|
|
5245
5266
|
name: "svg",
|
|
5246
5267
|
type: "element",
|
|
5247
5268
|
attributes: {
|
|
5248
5269
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5249
5270
|
width: svgWidth.toString(),
|
|
5250
|
-
height: svgHeight.toString()
|
|
5271
|
+
height: svgHeight.toString(),
|
|
5272
|
+
...softwareUsedString && {
|
|
5273
|
+
"data-software-used-string": softwareUsedString
|
|
5274
|
+
}
|
|
5251
5275
|
},
|
|
5252
5276
|
value: "",
|
|
5253
5277
|
children: [
|
|
@@ -5341,6 +5365,7 @@ export {
|
|
|
5341
5365
|
convertCircuitJsonToAssemblySvg,
|
|
5342
5366
|
convertCircuitJsonToPcbSvg,
|
|
5343
5367
|
convertCircuitJsonToSchematicSvg,
|
|
5344
|
-
convertCircuitJsonToSolderPasteMask
|
|
5368
|
+
convertCircuitJsonToSolderPasteMask,
|
|
5369
|
+
getSoftwareUsedString
|
|
5345
5370
|
};
|
|
5346
5371
|
//# sourceMappingURL=index.js.map
|