circuit-to-svg 0.0.218 → 0.0.219
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 +5 -4
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import { AnyCircuitElement, PcbPort, SchematicComponent } from 'circuit-json';
|
|
|
2
2
|
import { Matrix } from 'transformation-matrix';
|
|
3
3
|
import { INode } from 'svgson';
|
|
4
4
|
|
|
5
|
+
type CopperLayerName = "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6
|
+
type CopperColorMap = Record<CopperLayerName, string> & {
|
|
7
|
+
[layer: string]: string;
|
|
8
|
+
};
|
|
5
9
|
interface PcbColorMap {
|
|
6
|
-
copper:
|
|
7
|
-
top: string;
|
|
8
|
-
bottom: string;
|
|
9
|
-
};
|
|
10
|
+
copper: CopperColorMap;
|
|
10
11
|
drill: string;
|
|
11
12
|
silkscreen: {
|
|
12
13
|
top: string;
|
package/dist/index.js
CHANGED
|
@@ -941,6 +941,12 @@ import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
|
941
941
|
var DEFAULT_PCB_COLOR_MAP = {
|
|
942
942
|
copper: {
|
|
943
943
|
top: "rgb(200, 52, 52)",
|
|
944
|
+
inner1: "rgb(255, 140, 0)",
|
|
945
|
+
inner2: "rgb(255, 215, 0)",
|
|
946
|
+
inner3: "rgb(50, 205, 50)",
|
|
947
|
+
inner4: "rgb(64, 224, 208)",
|
|
948
|
+
inner5: "rgb(138, 43, 226)",
|
|
949
|
+
inner6: "rgb(255, 105, 180)",
|
|
944
950
|
bottom: "rgb(77, 127, 196)"
|
|
945
951
|
},
|
|
946
952
|
soldermask: {
|
|
@@ -964,8 +970,7 @@ var SILKSCREEN_BOTTOM_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.bottom;
|
|
|
964
970
|
|
|
965
971
|
// lib/pcb/layer-name-to-color.ts
|
|
966
972
|
var LAYER_NAME_TO_COLOR = {
|
|
967
|
-
|
|
968
|
-
bottom: DEFAULT_PCB_COLOR_MAP.copper.bottom
|
|
973
|
+
...DEFAULT_PCB_COLOR_MAP.copper
|
|
969
974
|
};
|
|
970
975
|
function layerNameToColor(layerName, colorMap2 = DEFAULT_PCB_COLOR_MAP) {
|
|
971
976
|
return colorMap2.copper[layerName] ?? "white";
|
|
@@ -1783,7 +1788,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
1783
1788
|
var package_default = {
|
|
1784
1789
|
name: "circuit-to-svg",
|
|
1785
1790
|
type: "module",
|
|
1786
|
-
version: "0.0.
|
|
1791
|
+
version: "0.0.218",
|
|
1787
1792
|
description: "Convert Circuit JSON to SVG",
|
|
1788
1793
|
main: "dist/index.js",
|
|
1789
1794
|
files: [
|
|
@@ -1853,11 +1858,18 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1853
1858
|
const drawPaddingOutsideBoard = options?.drawPaddingOutsideBoard ?? true;
|
|
1854
1859
|
const layer = options?.layer;
|
|
1855
1860
|
const colorOverrides = options?.colorOverrides;
|
|
1861
|
+
const copperColors = {
|
|
1862
|
+
...DEFAULT_PCB_COLOR_MAP.copper
|
|
1863
|
+
};
|
|
1864
|
+
if (colorOverrides?.copper) {
|
|
1865
|
+
for (const [layerName, color] of Object.entries(colorOverrides.copper)) {
|
|
1866
|
+
if (color !== void 0) {
|
|
1867
|
+
copperColors[layerName] = color;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1856
1871
|
const colorMap2 = {
|
|
1857
|
-
copper:
|
|
1858
|
-
top: colorOverrides?.copper?.top ?? DEFAULT_PCB_COLOR_MAP.copper.top,
|
|
1859
|
-
bottom: colorOverrides?.copper?.bottom ?? DEFAULT_PCB_COLOR_MAP.copper.bottom
|
|
1860
|
-
},
|
|
1872
|
+
copper: copperColors,
|
|
1861
1873
|
drill: colorOverrides?.drill ?? DEFAULT_PCB_COLOR_MAP.drill,
|
|
1862
1874
|
silkscreen: {
|
|
1863
1875
|
top: colorOverrides?.silkscreen?.top ?? DEFAULT_PCB_COLOR_MAP.silkscreen.top,
|