circuit-to-svg 0.0.256 → 0.0.258
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 +2 -2
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ interface Options$4 {
|
|
|
54
54
|
backgroundColor?: string;
|
|
55
55
|
drawPaddingOutsideBoard?: boolean;
|
|
56
56
|
includeVersion?: boolean;
|
|
57
|
-
|
|
57
|
+
showSolderMask?: boolean;
|
|
58
58
|
grid?: PcbGridOptions;
|
|
59
59
|
}
|
|
60
60
|
interface PcbContext {
|
|
@@ -65,7 +65,7 @@ interface PcbContext {
|
|
|
65
65
|
showPcbGroups?: boolean;
|
|
66
66
|
drawPaddingOutsideBoard?: boolean;
|
|
67
67
|
colorMap: PcbColorMap;
|
|
68
|
-
|
|
68
|
+
showSolderMask?: boolean;
|
|
69
69
|
}
|
|
70
70
|
declare function convertCircuitJsonToPcbSvg(circuitJson: AnyCircuitElement[], options?: Options$4): string;
|
|
71
71
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2282,7 +2282,7 @@ var DEFAULT_PCB_COLOR_MAP = {
|
|
|
2282
2282
|
bottom: "rgb(77, 127, 196)"
|
|
2283
2283
|
},
|
|
2284
2284
|
soldermask: {
|
|
2285
|
-
top: "rgb(
|
|
2285
|
+
top: "rgb(18, 82, 50)",
|
|
2286
2286
|
bottom: "rgb(77, 127, 196)"
|
|
2287
2287
|
},
|
|
2288
2288
|
drill: "#FF26E2",
|
|
@@ -2318,7 +2318,7 @@ function solderPasteLayerNameToColor(layerName) {
|
|
|
2318
2318
|
|
|
2319
2319
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
2320
2320
|
function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
2321
|
-
const { transform, layer: layerFilter, colorMap: colorMap2,
|
|
2321
|
+
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
2322
2322
|
if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2)
|
|
2323
2323
|
return [];
|
|
2324
2324
|
const segments = pairs(trace.route);
|
|
@@ -2333,7 +2333,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
2333
2333
|
const maskColor = colorMap2.soldermask[layer] ?? copperColor;
|
|
2334
2334
|
const traceWidth = "width" in start ? start.width : "width" in end ? end.width : null;
|
|
2335
2335
|
const width = traceWidth ? (traceWidth * Math.abs(transform.a)).toString() : "0.3";
|
|
2336
|
-
if (
|
|
2336
|
+
if (showSolderMask) {
|
|
2337
2337
|
const copperObject = {
|
|
2338
2338
|
name: "path",
|
|
2339
2339
|
type: "element",
|
|
@@ -2379,14 +2379,14 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
2379
2379
|
children: [],
|
|
2380
2380
|
attributes: {
|
|
2381
2381
|
class: "pcb-trace",
|
|
2382
|
-
stroke:
|
|
2382
|
+
stroke: copperColor,
|
|
2383
2383
|
fill: "none",
|
|
2384
2384
|
d: `M ${startPoint[0]} ${startPoint[1]} L ${endPoint[0]} ${endPoint[1]}`,
|
|
2385
2385
|
"stroke-width": width,
|
|
2386
2386
|
"stroke-linecap": "round",
|
|
2387
2387
|
"stroke-linejoin": "round",
|
|
2388
2388
|
"shape-rendering": "crispEdges",
|
|
2389
|
-
"data-type":
|
|
2389
|
+
"data-type": showSolderMask ? "pcb_soldermask" : "pcb_trace",
|
|
2390
2390
|
"data-pcb-layer": layer
|
|
2391
2391
|
}
|
|
2392
2392
|
};
|
|
@@ -2399,10 +2399,10 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
2399
2399
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
2400
2400
|
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
2401
2401
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
2402
|
-
const { transform, layer: layerFilter, colorMap: colorMap2,
|
|
2402
|
+
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
2403
2403
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
2404
2404
|
const isCoveredWithSolderMask = Boolean(pad?.is_covered_with_solder_mask);
|
|
2405
|
-
const
|
|
2405
|
+
const shouldshowSolderMask = showSolderMask && isCoveredWithSolderMask;
|
|
2406
2406
|
const solderMaskColor = colorMap2.soldermask[pad.layer] ?? colorMap2.soldermask.top;
|
|
2407
2407
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
2408
2408
|
const width = pad.width * Math.abs(transform.a);
|
|
@@ -2432,7 +2432,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2432
2432
|
} : {}
|
|
2433
2433
|
}
|
|
2434
2434
|
};
|
|
2435
|
-
if (!
|
|
2435
|
+
if (!shouldshowSolderMask) {
|
|
2436
2436
|
return [padElement2];
|
|
2437
2437
|
}
|
|
2438
2438
|
const maskElement2 = {
|
|
@@ -2469,7 +2469,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2469
2469
|
} : {}
|
|
2470
2470
|
}
|
|
2471
2471
|
};
|
|
2472
|
-
if (!
|
|
2472
|
+
if (!shouldshowSolderMask) {
|
|
2473
2473
|
return [padElement];
|
|
2474
2474
|
}
|
|
2475
2475
|
const maskElement = {
|
|
@@ -2509,7 +2509,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2509
2509
|
"data-pcb-layer": pad.layer
|
|
2510
2510
|
}
|
|
2511
2511
|
};
|
|
2512
|
-
if (!
|
|
2512
|
+
if (!shouldshowSolderMask) {
|
|
2513
2513
|
return [padElement];
|
|
2514
2514
|
}
|
|
2515
2515
|
const maskElement = {
|
|
@@ -2544,7 +2544,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2544
2544
|
"data-pcb-layer": pad.layer
|
|
2545
2545
|
}
|
|
2546
2546
|
};
|
|
2547
|
-
if (!
|
|
2547
|
+
if (!shouldshowSolderMask) {
|
|
2548
2548
|
return [padElement];
|
|
2549
2549
|
}
|
|
2550
2550
|
const maskElement = {
|
|
@@ -2578,7 +2578,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2578
2578
|
"data-pcb-layer": pad.layer
|
|
2579
2579
|
}
|
|
2580
2580
|
};
|
|
2581
|
-
if (!
|
|
2581
|
+
if (!shouldshowSolderMask) {
|
|
2582
2582
|
return [padElement];
|
|
2583
2583
|
}
|
|
2584
2584
|
const maskElement = {
|
|
@@ -2653,7 +2653,7 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
2653
2653
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
2654
2654
|
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
2655
2655
|
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
2656
|
-
const { transform, colorMap: colorMap2,
|
|
2656
|
+
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
2657
2657
|
const width = Number(pcbPanel.width);
|
|
2658
2658
|
const height = Number(pcbPanel.height);
|
|
2659
2659
|
const topLeft = applyToPoint22(transform, [0, 0]);
|
|
@@ -2662,8 +2662,8 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
2662
2662
|
const bottomLeft = applyToPoint22(transform, [0, height]);
|
|
2663
2663
|
const path = `M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]} Z`;
|
|
2664
2664
|
const isCoveredWithSolderMask = pcbPanel.covered_with_solder_mask !== false;
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2665
|
+
const shouldshowSolderMask = Boolean(
|
|
2666
|
+
showSolderMask && isCoveredWithSolderMask
|
|
2667
2667
|
);
|
|
2668
2668
|
return [
|
|
2669
2669
|
{
|
|
@@ -3471,7 +3471,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3471
3471
|
var package_default = {
|
|
3472
3472
|
name: "circuit-to-svg",
|
|
3473
3473
|
type: "module",
|
|
3474
|
-
version: "0.0.
|
|
3474
|
+
version: "0.0.257",
|
|
3475
3475
|
description: "Convert Circuit JSON to SVG",
|
|
3476
3476
|
main: "dist/index.js",
|
|
3477
3477
|
files: [
|
|
@@ -3762,7 +3762,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3762
3762
|
showPcbGroups: options?.showPcbGroups,
|
|
3763
3763
|
drawPaddingOutsideBoard,
|
|
3764
3764
|
colorMap: colorMap2,
|
|
3765
|
-
|
|
3765
|
+
showSolderMask: options?.showSolderMask
|
|
3766
3766
|
};
|
|
3767
3767
|
const unsortedSvgObjects = circuitJson.flatMap(
|
|
3768
3768
|
(elm) => createSvgObjects({ elm, circuitJson, ctx })
|