@jlcpcb/core 0.1.0 → 0.2.0
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/CHANGELOG.md +33 -0
- package/dist/api/easyeda-community.d.ts +36 -0
- package/dist/api/easyeda-community.d.ts.map +1 -0
- package/dist/api/easyeda.d.ts +23 -0
- package/dist/api/easyeda.d.ts.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/jlc.d.ts +41 -0
- package/dist/api/jlc.d.ts.map +1 -0
- package/dist/assets/search.html +528 -0
- package/dist/browser/index.d.ts +8 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/kicad-renderer.d.ts +13 -0
- package/dist/browser/kicad-renderer.d.ts.map +1 -0
- package/dist/browser/sexpr-parser.d.ts +84 -0
- package/dist/browser/sexpr-parser.d.ts.map +1 -0
- package/dist/constants/design-rules.d.ts +34 -0
- package/dist/constants/design-rules.d.ts.map +1 -0
- package/dist/constants/footprints.d.ts +134 -0
- package/dist/constants/footprints.d.ts.map +1 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/kicad.d.ts +67 -0
- package/dist/constants/kicad.d.ts.map +1 -0
- package/dist/converter/category-router.d.ts +47 -0
- package/dist/converter/category-router.d.ts.map +1 -0
- package/dist/converter/footprint-mapper.d.ts +40 -0
- package/dist/converter/footprint-mapper.d.ts.map +1 -0
- package/dist/converter/footprint-mapper.test.d.ts +2 -0
- package/dist/converter/footprint-mapper.test.d.ts.map +1 -0
- package/dist/converter/footprint.d.ts +116 -0
- package/dist/converter/footprint.d.ts.map +1 -0
- package/dist/converter/global-lib-table.d.ts +29 -0
- package/dist/converter/global-lib-table.d.ts.map +1 -0
- package/dist/converter/index.d.ts +12 -0
- package/dist/converter/index.d.ts.map +1 -0
- package/dist/converter/lib-table.d.ts +61 -0
- package/dist/converter/lib-table.d.ts.map +1 -0
- package/dist/converter/svg-arc.d.ts +45 -0
- package/dist/converter/svg-arc.d.ts.map +1 -0
- package/dist/converter/symbol-templates.d.ts +34 -0
- package/dist/converter/symbol-templates.d.ts.map +1 -0
- package/dist/converter/symbol.d.ts +223 -0
- package/dist/converter/symbol.d.ts.map +1 -0
- package/dist/converter/value-normalizer.d.ts +33 -0
- package/dist/converter/value-normalizer.d.ts.map +1 -0
- package/dist/http/index.d.ts +5 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/routes.d.ts +12 -0
- package/dist/http/routes.d.ts.map +1 -0
- package/dist/http/server.d.ts +18 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9633 -0
- package/dist/parsers/easyeda-shapes.d.ts +115 -0
- package/dist/parsers/easyeda-shapes.d.ts.map +1 -0
- package/dist/parsers/http-client.d.ts +16 -0
- package/dist/parsers/http-client.d.ts.map +1 -0
- package/dist/parsers/index.d.ts +11 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/utils.d.ts +17 -0
- package/dist/parsers/utils.d.ts.map +1 -0
- package/dist/services/component-service.d.ts +31 -0
- package/dist/services/component-service.d.ts.map +1 -0
- package/dist/services/fix-service.d.ts +40 -0
- package/dist/services/fix-service.d.ts.map +1 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/library-service.d.ts +112 -0
- package/dist/services/library-service.d.ts.map +1 -0
- package/dist/types/component.d.ts +56 -0
- package/dist/types/component.d.ts.map +1 -0
- package/dist/types/easyeda-community.d.ts +74 -0
- package/dist/types/easyeda-community.d.ts.map +1 -0
- package/dist/types/easyeda.d.ts +326 -0
- package/dist/types/easyeda.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/jlc.d.ts +78 -0
- package/dist/types/jlc.d.ts.map +1 -0
- package/dist/types/kicad.d.ts +141 -0
- package/dist/types/kicad.d.ts.map +1 -0
- package/dist/types/mcp.d.ts +66 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/project.d.ts +60 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/utils/conversion.d.ts +59 -0
- package/dist/utils/conversion.d.ts.map +1 -0
- package/dist/utils/file-system.d.ts +59 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +26 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +259 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/package.json +5 -3
- package/scripts/build-search-page.ts +68 -0
- package/src/assets/search-built.html +528 -0
- package/src/assets/search.html +458 -0
- package/src/browser/index.ts +389 -0
- package/src/browser/kicad-renderer.ts +813 -0
- package/src/browser/sexpr-parser.ts +333 -0
- package/src/converter/footprint-mapper.test.ts +159 -0
- package/src/converter/footprint-mapper.ts +42 -134
- package/src/converter/footprint.ts +208 -36
- package/src/converter/global-lib-table.ts +71 -0
- package/src/http/index.ts +5 -0
- package/src/http/routes.ts +266 -0
- package/src/http/server.ts +83 -0
- package/src/index.ts +3 -0
- package/src/parsers/easyeda-shapes.ts +2 -1
- package/src/services/library-service.ts +73 -22
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default design rules for common PCB manufacturers
|
|
3
|
+
*/
|
|
4
|
+
export interface DesignRules {
|
|
5
|
+
name: string;
|
|
6
|
+
minTraceWidth: number;
|
|
7
|
+
minTraceClearance: number;
|
|
8
|
+
minViaDrill: number;
|
|
9
|
+
minViaPad: number;
|
|
10
|
+
minHoleDrill: number;
|
|
11
|
+
minAnnularRing: number;
|
|
12
|
+
minSilkscreenWidth: number;
|
|
13
|
+
minSilkscreenClearance: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const JLCPCB_STANDARD: DesignRules;
|
|
16
|
+
export declare const JLCPCB_ADVANCED: DesignRules;
|
|
17
|
+
export declare const PCBWAY_STANDARD: DesignRules;
|
|
18
|
+
export declare const OSHPARK_STANDARD: DesignRules;
|
|
19
|
+
export declare const HOBBY_RULES: DesignRules;
|
|
20
|
+
export declare const TRACE_WIDTH_CURRENT: Record<string, number>;
|
|
21
|
+
export declare const LAYER_STACKUPS: {
|
|
22
|
+
readonly '2-layer': {
|
|
23
|
+
readonly layers: readonly ["F.Cu", "B.Cu"];
|
|
24
|
+
readonly copperThickness: 0.035;
|
|
25
|
+
readonly boardThickness: 1.6;
|
|
26
|
+
};
|
|
27
|
+
readonly '4-layer': {
|
|
28
|
+
readonly layers: readonly ["F.Cu", "In1.Cu", "In2.Cu", "B.Cu"];
|
|
29
|
+
readonly copperThickness: 0.035;
|
|
30
|
+
readonly boardThickness: 1.6;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare function getDesignRulesForManufacturer(manufacturer: string): DesignRules;
|
|
34
|
+
//# sourceMappingURL=design-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-rules.d.ts","sourceRoot":"","sources":["../../src/constants/design-rules.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAGD,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC;AAGF,eAAO,MAAM,gBAAgB,EAAE,WAU9B,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,WAUzB,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOtD,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAa/E"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard footprint patterns and dimensions
|
|
3
|
+
*/
|
|
4
|
+
export declare const SMD_PACKAGE_SIZES: Record<string, {
|
|
5
|
+
length: number;
|
|
6
|
+
width: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const IC_PACKAGE_PATTERNS: {
|
|
9
|
+
readonly SOIC8: {
|
|
10
|
+
readonly pins: 8;
|
|
11
|
+
readonly pitch: 1.27;
|
|
12
|
+
readonly width: 3.9;
|
|
13
|
+
};
|
|
14
|
+
readonly SOIC14: {
|
|
15
|
+
readonly pins: 14;
|
|
16
|
+
readonly pitch: 1.27;
|
|
17
|
+
readonly width: 3.9;
|
|
18
|
+
};
|
|
19
|
+
readonly SOIC16: {
|
|
20
|
+
readonly pins: 16;
|
|
21
|
+
readonly pitch: 1.27;
|
|
22
|
+
readonly width: 3.9;
|
|
23
|
+
};
|
|
24
|
+
readonly TSSOP8: {
|
|
25
|
+
readonly pins: 8;
|
|
26
|
+
readonly pitch: 0.65;
|
|
27
|
+
readonly width: 3;
|
|
28
|
+
};
|
|
29
|
+
readonly TSSOP14: {
|
|
30
|
+
readonly pins: 14;
|
|
31
|
+
readonly pitch: 0.65;
|
|
32
|
+
readonly width: 4.4;
|
|
33
|
+
};
|
|
34
|
+
readonly TSSOP16: {
|
|
35
|
+
readonly pins: 16;
|
|
36
|
+
readonly pitch: 0.65;
|
|
37
|
+
readonly width: 4.4;
|
|
38
|
+
};
|
|
39
|
+
readonly TSSOP20: {
|
|
40
|
+
readonly pins: 20;
|
|
41
|
+
readonly pitch: 0.65;
|
|
42
|
+
readonly width: 4.4;
|
|
43
|
+
};
|
|
44
|
+
readonly LQFP32: {
|
|
45
|
+
readonly pins: 32;
|
|
46
|
+
readonly pitch: 0.8;
|
|
47
|
+
readonly size: 7;
|
|
48
|
+
};
|
|
49
|
+
readonly LQFP48: {
|
|
50
|
+
readonly pins: 48;
|
|
51
|
+
readonly pitch: 0.5;
|
|
52
|
+
readonly size: 7;
|
|
53
|
+
};
|
|
54
|
+
readonly LQFP64: {
|
|
55
|
+
readonly pins: 64;
|
|
56
|
+
readonly pitch: 0.5;
|
|
57
|
+
readonly size: 10;
|
|
58
|
+
};
|
|
59
|
+
readonly LQFP100: {
|
|
60
|
+
readonly pins: 100;
|
|
61
|
+
readonly pitch: 0.5;
|
|
62
|
+
readonly size: 14;
|
|
63
|
+
};
|
|
64
|
+
readonly LQFP144: {
|
|
65
|
+
readonly pins: 144;
|
|
66
|
+
readonly pitch: 0.5;
|
|
67
|
+
readonly size: 20;
|
|
68
|
+
};
|
|
69
|
+
readonly QFN16: {
|
|
70
|
+
readonly pins: 16;
|
|
71
|
+
readonly pitch: 0.5;
|
|
72
|
+
readonly size: 3;
|
|
73
|
+
};
|
|
74
|
+
readonly QFN20: {
|
|
75
|
+
readonly pins: 20;
|
|
76
|
+
readonly pitch: 0.5;
|
|
77
|
+
readonly size: 4;
|
|
78
|
+
};
|
|
79
|
+
readonly QFN24: {
|
|
80
|
+
readonly pins: 24;
|
|
81
|
+
readonly pitch: 0.5;
|
|
82
|
+
readonly size: 4;
|
|
83
|
+
};
|
|
84
|
+
readonly QFN32: {
|
|
85
|
+
readonly pins: 32;
|
|
86
|
+
readonly pitch: 0.5;
|
|
87
|
+
readonly size: 5;
|
|
88
|
+
};
|
|
89
|
+
readonly QFN48: {
|
|
90
|
+
readonly pins: 48;
|
|
91
|
+
readonly pitch: 0.5;
|
|
92
|
+
readonly size: 7;
|
|
93
|
+
};
|
|
94
|
+
readonly BGA100: {
|
|
95
|
+
readonly pins: 100;
|
|
96
|
+
readonly pitch: 0.8;
|
|
97
|
+
};
|
|
98
|
+
readonly BGA144: {
|
|
99
|
+
readonly pins: 144;
|
|
100
|
+
readonly pitch: 0.8;
|
|
101
|
+
};
|
|
102
|
+
readonly BGA256: {
|
|
103
|
+
readonly pins: 256;
|
|
104
|
+
readonly pitch: 0.8;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export declare const CONNECTOR_PITCHES: {
|
|
108
|
+
readonly STANDARD_2_54MM: 2.54;
|
|
109
|
+
readonly STANDARD_2MM: 2;
|
|
110
|
+
readonly FINE_1_27MM: 1.27;
|
|
111
|
+
readonly FINE_1MM: 1;
|
|
112
|
+
readonly USB_C: 0.5;
|
|
113
|
+
readonly FPC_0_5MM: 0.5;
|
|
114
|
+
readonly FPC_1MM: 1;
|
|
115
|
+
};
|
|
116
|
+
export declare const MOUNTING_HOLES: {
|
|
117
|
+
readonly M2: {
|
|
118
|
+
readonly drill: 2.2;
|
|
119
|
+
readonly pad: 4;
|
|
120
|
+
};
|
|
121
|
+
readonly M2_5: {
|
|
122
|
+
readonly drill: 2.7;
|
|
123
|
+
readonly pad: 5;
|
|
124
|
+
};
|
|
125
|
+
readonly M3: {
|
|
126
|
+
readonly drill: 3.2;
|
|
127
|
+
readonly pad: 6;
|
|
128
|
+
};
|
|
129
|
+
readonly M4: {
|
|
130
|
+
readonly drill: 4.3;
|
|
131
|
+
readonly pad: 8;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=footprints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footprints.d.ts","sourceRoot":"","sources":["../../src/constants/footprints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAU/E,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BtB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;;;;CAQpB,CAAC;AAGX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;CAKjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KiCad layer names and constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const KICAD_LAYERS: {
|
|
5
|
+
readonly F_CU: "F.Cu";
|
|
6
|
+
readonly B_CU: "B.Cu";
|
|
7
|
+
readonly IN1_CU: "In1.Cu";
|
|
8
|
+
readonly IN2_CU: "In2.Cu";
|
|
9
|
+
readonly IN3_CU: "In3.Cu";
|
|
10
|
+
readonly IN4_CU: "In4.Cu";
|
|
11
|
+
readonly F_ADHES: "F.Adhes";
|
|
12
|
+
readonly F_PASTE: "F.Paste";
|
|
13
|
+
readonly F_SILKS: "F.SilkS";
|
|
14
|
+
readonly F_MASK: "F.Mask";
|
|
15
|
+
readonly F_CRTYD: "F.CrtYd";
|
|
16
|
+
readonly F_FAB: "F.Fab";
|
|
17
|
+
readonly B_ADHES: "B.Adhes";
|
|
18
|
+
readonly B_PASTE: "B.Paste";
|
|
19
|
+
readonly B_SILKS: "B.SilkS";
|
|
20
|
+
readonly B_MASK: "B.Mask";
|
|
21
|
+
readonly B_CRTYD: "B.CrtYd";
|
|
22
|
+
readonly B_FAB: "B.Fab";
|
|
23
|
+
readonly EDGE_CUTS: "Edge.Cuts";
|
|
24
|
+
readonly MARGIN: "Margin";
|
|
25
|
+
readonly DWGS_USER: "Dwgs.User";
|
|
26
|
+
readonly CMTS_USER: "Cmts.User";
|
|
27
|
+
readonly ECO1_USER: "Eco1.User";
|
|
28
|
+
readonly ECO2_USER: "Eco2.User";
|
|
29
|
+
};
|
|
30
|
+
export declare const KICAD_LAYER_GROUPS: {
|
|
31
|
+
readonly ALL_CU: readonly ["*.Cu"];
|
|
32
|
+
readonly ALL_MASK: readonly ["*.Mask"];
|
|
33
|
+
readonly FRONT_LAYERS: readonly ["F.Cu", "F.Paste", "F.Mask"];
|
|
34
|
+
readonly BACK_LAYERS: readonly ["B.Cu", "B.Paste", "B.Mask"];
|
|
35
|
+
readonly SMD_FRONT: readonly ["F.Cu", "F.Paste", "F.Mask"];
|
|
36
|
+
readonly SMD_BACK: readonly ["B.Cu", "B.Paste", "B.Mask"];
|
|
37
|
+
readonly THT: readonly ["*.Cu", "*.Mask"];
|
|
38
|
+
};
|
|
39
|
+
export declare const KICAD_DEFAULTS: {
|
|
40
|
+
readonly TEXT_SIZE: 1.27;
|
|
41
|
+
readonly TEXT_THICKNESS: 0.15;
|
|
42
|
+
readonly WIRE_WIDTH: 0.25;
|
|
43
|
+
readonly GRID_SCHEMATIC: 2.54;
|
|
44
|
+
readonly GRID_PCB: 0.25;
|
|
45
|
+
readonly PIN_LENGTH: 1.27;
|
|
46
|
+
readonly PIN_NAME_OFFSET: 0;
|
|
47
|
+
};
|
|
48
|
+
export declare const KICAD_SYMBOL_VERSION = "20241209";
|
|
49
|
+
export declare const KICAD_FOOTPRINT_VERSION = "20241209";
|
|
50
|
+
export declare const KICAD_PIN_TYPES: readonly ["input", "output", "bidirectional", "tri_state", "passive", "free", "unspecified", "power_in", "power_out", "open_collector", "open_emitter", "no_connect"];
|
|
51
|
+
export declare const KICAD_PAD_SHAPES: readonly ["circle", "rect", "oval", "trapezoid", "roundrect", "custom"];
|
|
52
|
+
export declare const KICAD_PAD_TYPES: readonly ["thru_hole", "smd", "connect", "np_thru_hole"];
|
|
53
|
+
export declare const KICAD_LIBRARY_NAME = "EDA-MCP";
|
|
54
|
+
export declare const KICAD_LIBRARY_DESCRIPTION = "AI-EDA Component Library (JLC/EasyEDA)";
|
|
55
|
+
export declare const KICAD_VERSIONS: readonly ["9.0", "8.0"];
|
|
56
|
+
/**
|
|
57
|
+
* Get global KiCad library paths for a specific platform
|
|
58
|
+
* Returns paths in the format that kicad-sch-mcp's search pattern expects:
|
|
59
|
+
* ~/Documents/KiCad/{version}/symbols/*.kicad_sym
|
|
60
|
+
*/
|
|
61
|
+
export declare function getGlobalKicadLibraryPaths(homeDir: string, platform: 'darwin' | 'win32' | 'linux', version?: string): {
|
|
62
|
+
base: string;
|
|
63
|
+
symbols: string;
|
|
64
|
+
footprints: string;
|
|
65
|
+
models3d: string;
|
|
66
|
+
} | null;
|
|
67
|
+
//# sourceMappingURL=kicad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kicad.d.ts","sourceRoot":"","sources":["../../src/constants/kicad.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAgCf,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;;;;;CAQrB,CAAC;AAGX,eAAO,MAAM,cAAc;;;;;;;;CAQjB,CAAC;AAGX,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAGlD,eAAO,MAAM,eAAe,uKAalB,CAAC;AAGX,eAAO,MAAM,gBAAgB,yEAOnB,CAAC;AAGX,eAAO,MAAM,eAAe,0DAKlB,CAAC;AAGX,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,yBAAyB,2CAA2C,CAAC;AAGlF,eAAO,MAAM,cAAc,yBAA0B,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,EACtC,OAAO,GAAE,MAAc,GACtB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CA0BP"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Category Router
|
|
3
|
+
* Routes components to category-based symbol libraries with robust keyword matching
|
|
4
|
+
* JLC-MCP-Resistors.kicad_sym, JLC-MCP-MCUs.kicad_sym, etc.
|
|
5
|
+
*/
|
|
6
|
+
export type LibraryCategory = 'Resistors' | 'Capacitors' | 'Inductors' | 'Diodes' | 'Transistors' | 'Crystals' | 'Power' | 'MCUs' | 'Memory' | 'Sensors' | 'Interface' | 'Optocouplers' | 'Connectors' | 'ICs' | 'Misc';
|
|
7
|
+
/**
|
|
8
|
+
* Determine library category from component prefix, LCSC category, and description
|
|
9
|
+
* Uses priority-ordered keyword matching with fuzzy detection
|
|
10
|
+
*/
|
|
11
|
+
export declare function getLibraryCategory(prefix: string, category?: string, description?: string): LibraryCategory;
|
|
12
|
+
/**
|
|
13
|
+
* Get symbol library filename for a category
|
|
14
|
+
* Returns: "JLC-MCP-Resistors.kicad_sym"
|
|
15
|
+
*/
|
|
16
|
+
export declare function getLibraryFilename(category: LibraryCategory): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get footprint library directory name
|
|
19
|
+
* All footprints go in a single directory
|
|
20
|
+
* Returns: "JLC-MCP.pretty"
|
|
21
|
+
*/
|
|
22
|
+
export declare function getFootprintDirName(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get 3D models directory name
|
|
25
|
+
* Returns: "JLC-MCP.3dshapes"
|
|
26
|
+
*/
|
|
27
|
+
export declare function get3DModelsDirName(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get full symbol reference for use in schematics
|
|
30
|
+
* Format: "JLC-MCP-Resistors:SymbolName"
|
|
31
|
+
*/
|
|
32
|
+
export declare function getSymbolReference(category: LibraryCategory, symbolName: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Get full footprint reference for use in schematics/boards
|
|
35
|
+
* Format: "JLC-MCP:FootprintName"
|
|
36
|
+
*/
|
|
37
|
+
export declare function getFootprintReference(footprintName: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Get all possible library categories
|
|
40
|
+
*/
|
|
41
|
+
export declare function getAllCategories(): LibraryCategory[];
|
|
42
|
+
/**
|
|
43
|
+
* Parse library name to extract category
|
|
44
|
+
* "JLC-MCP-Resistors" -> "Resistors"
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseLibraryName(libraryName: string): LibraryCategory | null;
|
|
47
|
+
//# sourceMappingURL=category-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category-router.d.ts","sourceRoot":"","sources":["../../src/converter/category-router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,MAAM,GACN,QAAQ,GACR,SAAS,GACT,WAAW,GACX,cAAc,GACd,YAAY,GACZ,KAAK,GACL,MAAM,CAAC;AAyfX;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,CAuBjB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGxF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAkBpD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAS5E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KiCad Standard Footprint Mapper
|
|
3
|
+
* Maps common package names to KiCad built-in footprints for hybrid approach
|
|
4
|
+
*
|
|
5
|
+
* CONSERVATIVE APPROACH: Only uses KiCad built-ins for 2-pad unpolarized passives (R/C/L).
|
|
6
|
+
* All other components (ICs, transistors, diodes, etc.) generate custom footprints
|
|
7
|
+
* to avoid pin-flip issues from pad numbering mismatches.
|
|
8
|
+
*/
|
|
9
|
+
export interface FootprintMapping {
|
|
10
|
+
library: string;
|
|
11
|
+
footprint: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Map package name to KiCad standard footprint
|
|
15
|
+
*
|
|
16
|
+
* CONSERVATIVE APPROACH: Only returns built-in mappings for 2-pad unpolarized passives.
|
|
17
|
+
* This avoids pin-flip issues that can occur when pad numbering differs between
|
|
18
|
+
* EasyEDA data and KiCad built-in footprints (e.g., SOT-23 transistors have
|
|
19
|
+
* different BCE/CBE/EBC pinouts across manufacturers).
|
|
20
|
+
*
|
|
21
|
+
* Returns null if no standard mapping exists (will fall back to generated footprint)
|
|
22
|
+
*/
|
|
23
|
+
export declare function mapToKicadFootprint(packageName: string, componentPrefix: string, _category?: string, _description?: string): FootprintMapping | null;
|
|
24
|
+
/**
|
|
25
|
+
* Get expected pad count for a KiCad footprint mapping
|
|
26
|
+
* Used to validate that EasyEDA footprint matches before using built-in
|
|
27
|
+
*
|
|
28
|
+
* Returns null if pad count is unknown (caller should allow the mapping)
|
|
29
|
+
*/
|
|
30
|
+
export declare function getExpectedPadCount(mapping: FootprintMapping): number | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get full KiCad footprint reference string
|
|
33
|
+
* Format: "Library:Footprint"
|
|
34
|
+
*/
|
|
35
|
+
export declare function getKicadFootprintRef(mapping: FootprintMapping): string;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a package is likely a standard passive that can use KiCad footprints
|
|
38
|
+
*/
|
|
39
|
+
export declare function isStandardPassive(packageName: string, prefix: string): boolean;
|
|
40
|
+
//# sourceMappingURL=footprint-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footprint-mapper.d.ts","sourceRoot":"","sources":["../../src/converter/footprint-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AA4DD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,gBAAgB,GAAG,IAAI,CAqBzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAW5E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAG9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footprint-mapper.test.d.ts","sourceRoot":"","sources":["../../src/converter/footprint-mapper.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EasyEDA Footprint to KiCad Footprint Converter
|
|
3
|
+
* Complete rewrite to handle all EasyEDA shape types
|
|
4
|
+
*
|
|
5
|
+
* Supported shapes: PAD, TRACK, HOLE, CIRCLE, ARC, RECT, VIA, TEXT, SOLIDREGION
|
|
6
|
+
*/
|
|
7
|
+
import type { EasyEDAComponentData } from '../types/index.js';
|
|
8
|
+
export interface FootprintConversionOptions {
|
|
9
|
+
libraryName?: string;
|
|
10
|
+
include3DModel?: boolean;
|
|
11
|
+
modelPath?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FootprintResult {
|
|
14
|
+
type: 'reference' | 'generated';
|
|
15
|
+
reference?: string;
|
|
16
|
+
content?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class FootprintConverter {
|
|
20
|
+
/**
|
|
21
|
+
* Convert EasyEDA component data to KiCad footprint format string
|
|
22
|
+
*/
|
|
23
|
+
convert(component: EasyEDAComponentData, options?: FootprintConversionOptions): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get footprint using hybrid approach:
|
|
26
|
+
* - Use KiCad standard footprint if available (for common 2-pad passives)
|
|
27
|
+
* - Generate custom footprint for all other components
|
|
28
|
+
*
|
|
29
|
+
* CONSERVATIVE APPROACH: Only uses KiCad built-ins for R/C/L passives.
|
|
30
|
+
* This prevents pin-flip issues from pad numbering mismatches in ICs/transistors.
|
|
31
|
+
*/
|
|
32
|
+
getFootprint(component: EasyEDAComponentData, options?: FootprintConversionOptions): FootprintResult;
|
|
33
|
+
/**
|
|
34
|
+
* Generate PAD element
|
|
35
|
+
* Handles all shapes: RECT, ELLIPSE, OVAL, POLYGON
|
|
36
|
+
*/
|
|
37
|
+
private generatePad;
|
|
38
|
+
/**
|
|
39
|
+
* Generate custom POLYGON pad using gr_poly primitive
|
|
40
|
+
* Supports both SMD and through-hole polygon pads
|
|
41
|
+
*
|
|
42
|
+
* Note: EasyEDA polygon pads may have holeRadius=0 even for through-hole pads.
|
|
43
|
+
* We use isPlated=true as a hint and calculate drill size from polygon geometry.
|
|
44
|
+
*/
|
|
45
|
+
private generatePolygonPad;
|
|
46
|
+
/**
|
|
47
|
+
* Calculate drill radius from polygon points
|
|
48
|
+
* Uses inscribed circle approximation: smallest distance from center to any edge
|
|
49
|
+
* Returns radius in EasyEDA units (10mil)
|
|
50
|
+
*/
|
|
51
|
+
private calculateDrillRadiusFromPolygon;
|
|
52
|
+
/**
|
|
53
|
+
* Generate HOLE as NPTH pad
|
|
54
|
+
*/
|
|
55
|
+
private generateHole;
|
|
56
|
+
/**
|
|
57
|
+
* Generate VIA as through-hole pad (no number)
|
|
58
|
+
*/
|
|
59
|
+
private generateVia;
|
|
60
|
+
/**
|
|
61
|
+
* Generate TRACK as fp_line segments
|
|
62
|
+
*/
|
|
63
|
+
private generateTrack;
|
|
64
|
+
/**
|
|
65
|
+
* Generate CIRCLE as fp_circle
|
|
66
|
+
*/
|
|
67
|
+
private generateCircle;
|
|
68
|
+
/**
|
|
69
|
+
* Generate ARC as fp_arc (from SVG path)
|
|
70
|
+
*/
|
|
71
|
+
private generateArc;
|
|
72
|
+
/**
|
|
73
|
+
* Generate RECT as 4 fp_line elements
|
|
74
|
+
*/
|
|
75
|
+
private generateRect;
|
|
76
|
+
/**
|
|
77
|
+
* Generate TEXT as fp_text (user text, not REF/VAL)
|
|
78
|
+
*/
|
|
79
|
+
private generateText;
|
|
80
|
+
/**
|
|
81
|
+
* Generate SOLIDREGION as fp_poly (filled polygon)
|
|
82
|
+
* Parses SVG path with M/L/Z commands and converts to KiCad polygon
|
|
83
|
+
*/
|
|
84
|
+
private generateSolidRegion;
|
|
85
|
+
/**
|
|
86
|
+
* Parse SVG path string to array of points
|
|
87
|
+
* Handles M, L, H, V, C, Q, A, Z commands
|
|
88
|
+
* Curves are simplified to their endpoints (no interpolation)
|
|
89
|
+
*/
|
|
90
|
+
private parseSvgPathToPoints;
|
|
91
|
+
/**
|
|
92
|
+
* Calculate bounding box from all footprint elements
|
|
93
|
+
*/
|
|
94
|
+
private calculateBounds;
|
|
95
|
+
/**
|
|
96
|
+
* Generate footprint properties
|
|
97
|
+
* Positions Reference above courtyard and Value below courtyard
|
|
98
|
+
*/
|
|
99
|
+
private generateProperties;
|
|
100
|
+
/**
|
|
101
|
+
* Generate fab reference text
|
|
102
|
+
*/
|
|
103
|
+
private generateFabReference;
|
|
104
|
+
/**
|
|
105
|
+
* Generate courtyard outline
|
|
106
|
+
*/
|
|
107
|
+
private generateCourtyard;
|
|
108
|
+
/**
|
|
109
|
+
* Generate 3D model reference
|
|
110
|
+
*/
|
|
111
|
+
private generate3DModel;
|
|
112
|
+
private sanitizeName;
|
|
113
|
+
private escapeString;
|
|
114
|
+
}
|
|
115
|
+
export declare const footprintConverter: FootprintConverter;
|
|
116
|
+
//# sourceMappingURL=footprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footprint.d.ts","sourceRoot":"","sources":["../../src/converter/footprint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAUrB,MAAM,mBAAmB,CAAC;AA0D3B,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAiKD,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,oBAAoB,EAAE,OAAO,GAAE,0BAA+B,GAAG,MAAM;IA2F1F;;;;;;;OAOG;IACH,YAAY,CACV,SAAS,EAAE,oBAAoB,EAC/B,OAAO,GAAE,0BAA+B,GACvC,eAAe;IA2ClB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAiDnB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAkE1B;;;;OAIG;IACH,OAAO,CAAC,+BAA+B;IA2BvC;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACH,OAAO,CAAC,WAAW;IAcnB;;OAEG;IACH,OAAO,CAAC,aAAa;IA4BrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,WAAW;IAqBnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAiCpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAmCpB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiC3B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IA8H5B;;OAEG;IACH,OAAO,CAAC,eAAe;IA2DvB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAkE1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAGrB;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global Library Table Manager
|
|
3
|
+
* Registers JLC libraries in KiCad's global sym-lib-table and fp-lib-table
|
|
4
|
+
* Works cross-platform: macOS, Windows, Linux
|
|
5
|
+
*/
|
|
6
|
+
interface TableUpdateResult {
|
|
7
|
+
path: string;
|
|
8
|
+
created: boolean;
|
|
9
|
+
modified: boolean;
|
|
10
|
+
entriesAdded: number;
|
|
11
|
+
}
|
|
12
|
+
export interface GlobalRegistrationResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
version: string;
|
|
15
|
+
symLibTable: TableUpdateResult;
|
|
16
|
+
fpLibTable: TableUpdateResult;
|
|
17
|
+
libraryStubs: {
|
|
18
|
+
symbolsCreated: string[];
|
|
19
|
+
directoriesCreated: string[];
|
|
20
|
+
};
|
|
21
|
+
errors: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Ensure EasyEDA library is registered in global sym-lib-table and fp-lib-table
|
|
25
|
+
*/
|
|
26
|
+
export declare function ensureGlobalEasyEDALibrary(): Promise<void>;
|
|
27
|
+
export declare function ensureGlobalLibraryTables(): Promise<GlobalRegistrationResult>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=global-lib-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-lib-table.d.ts","sourceRoot":"","sources":["../../src/converter/global-lib-table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2JH,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AA0JD,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,YAAY,EAAE;QACZ,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AA0BD;;GAEG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CA8ChE;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CA2DnF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EasyEDA to KiCad converters
|
|
3
|
+
*/
|
|
4
|
+
export { SymbolConverter, symbolConverter, type SymbolConversionOptions } from './symbol.js';
|
|
5
|
+
export { FootprintConverter, footprintConverter, type FootprintConversionOptions, type FootprintResult } from './footprint.js';
|
|
6
|
+
export { ensureSymLibTable, ensureFpLibTable, getSymbolReference, getFootprintReference, libraryExistsInTable, } from './lib-table.js';
|
|
7
|
+
export { mapToKicadFootprint, getKicadFootprintRef, isStandardPassive, type FootprintMapping, } from './footprint-mapper.js';
|
|
8
|
+
export { normalizeValue, detectComponentType, extractDisplayValue, type ComponentType, type NormalizedValue, } from './value-normalizer.js';
|
|
9
|
+
export { getLibraryCategory, getLibraryFilename, getFootprintDirName, get3DModelsDirName, getSymbolReference as getCategorySymbolReference, getFootprintReference as getCategoryFootprintReference, getAllCategories, parseLibraryName, type LibraryCategory, } from './category-router.js';
|
|
10
|
+
export { getSymbolTemplate, hasFixedTemplate, type SymbolTemplate, } from './symbol-templates.js';
|
|
11
|
+
export { ensureGlobalLibraryTables, type GlobalRegistrationResult, } from './global-lib-table.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/converter/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,0BAA0B,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC/H,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,IAAI,0BAA0B,EAChD,qBAAqB,IAAI,6BAA6B,EACtD,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KiCad Library Table Management
|
|
3
|
+
* Handles sym-lib-table and fp-lib-table generation and updates
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generate sym-lib-table content
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateSymLibTable(symbolLibPath: string, libraryName?: string, description?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate fp-lib-table content
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateFpLibTable(footprintLibPath: string, libraryName?: string, description?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Check if a library entry exists in a lib-table file
|
|
15
|
+
*/
|
|
16
|
+
export declare function libraryExistsInTable(tableContent: string, libraryName: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Add a library entry to an existing lib-table content
|
|
19
|
+
*/
|
|
20
|
+
export declare function addLibraryToTable(tableContent: string, libraryName: string, libraryPath: string, type: 'sym' | 'fp', description?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Ensure sym-lib-table exists and contains specified library
|
|
23
|
+
* @param projectDir - Path to the KiCad project directory
|
|
24
|
+
* @param symbolLibPath - Path to the symbol library file (relative or absolute)
|
|
25
|
+
* @param libraryName - Library name (default: LCSC)
|
|
26
|
+
* @param description - Library description
|
|
27
|
+
* @returns true if table was created or modified, false if already correct
|
|
28
|
+
*/
|
|
29
|
+
export declare function ensureSymLibTable(projectDir: string, symbolLibPath: string, libraryName?: string, description?: string): Promise<{
|
|
30
|
+
created: boolean;
|
|
31
|
+
modified: boolean;
|
|
32
|
+
path: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Ensure fp-lib-table exists and contains specified library
|
|
36
|
+
* @param projectDir - Path to the KiCad project directory
|
|
37
|
+
* @param footprintLibPath - Path to the footprint library directory (relative or absolute)
|
|
38
|
+
* @param libraryName - Library name (default: LCSC)
|
|
39
|
+
* @param description - Library description
|
|
40
|
+
* @returns true if table was created or modified, false if already correct
|
|
41
|
+
*/
|
|
42
|
+
export declare function ensureFpLibTable(projectDir: string, footprintLibPath: string, libraryName?: string, description?: string): Promise<{
|
|
43
|
+
created: boolean;
|
|
44
|
+
modified: boolean;
|
|
45
|
+
path: string;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Get the symbol reference string for use in schematics
|
|
49
|
+
* @param symbolName - The symbol name within the library
|
|
50
|
+
* @param libraryName - Library name (default: LCSC)
|
|
51
|
+
* @returns Full reference like "LCSC:SymbolName"
|
|
52
|
+
*/
|
|
53
|
+
export declare function getSymbolReference(symbolName: string, libraryName?: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get the footprint reference string for use in symbols/schematics
|
|
56
|
+
* @param footprintName - The footprint filename (without .kicad_mod)
|
|
57
|
+
* @param libraryName - Library name (default: LCSC)
|
|
58
|
+
* @returns Full reference like "LCSC:FootprintName"
|
|
59
|
+
*/
|
|
60
|
+
export declare function getFootprintReference(footprintName: string, libraryName?: string): string;
|
|
61
|
+
//# sourceMappingURL=lib-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib-table.d.ts","sourceRoot":"","sources":["../../src/converter/lib-table.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,MAA6B,EAC1C,WAAW,GAAE,MAAoC,GAChD,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,MAAM,EACxB,WAAW,GAAE,MAA6B,EAC1C,WAAW,GAAE,MAAoC,GAChD,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAGvF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,KAAK,GAAG,IAAI,EAClB,WAAW,GAAE,MAAoC,GAChD,MAAM,CAkBR;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,MAA6B,EAC1C,WAAW,GAAE,MAAoC,GAChD,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BhE;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,WAAW,GAAE,MAA6B,EAC1C,WAAW,GAAE,MAAoC,GAChD,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BhE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,GAAE,MAA6B,GAAG,MAAM,CAEzG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,GAAE,MAA6B,GAAG,MAAM,CAE/G"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG Arc to Center Parameterization
|
|
3
|
+
*
|
|
4
|
+
* Converts SVG arc endpoint parameters to center point format used by KiCad.
|
|
5
|
+
* Based on SVG specification: https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
|
|
6
|
+
*/
|
|
7
|
+
export interface ArcEndpointParams {
|
|
8
|
+
x1: number;
|
|
9
|
+
y1: number;
|
|
10
|
+
rx: number;
|
|
11
|
+
ry: number;
|
|
12
|
+
phi: number;
|
|
13
|
+
largeArc: boolean;
|
|
14
|
+
sweep: boolean;
|
|
15
|
+
x2: number;
|
|
16
|
+
y2: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ArcCenterParams {
|
|
19
|
+
cx: number;
|
|
20
|
+
cy: number;
|
|
21
|
+
rx: number;
|
|
22
|
+
ry: number;
|
|
23
|
+
startAngle: number;
|
|
24
|
+
endAngle: number;
|
|
25
|
+
deltaAngle: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Convert SVG arc endpoint parameterization to center parameterization
|
|
29
|
+
* Algorithm from SVG spec Appendix B.2.4
|
|
30
|
+
*/
|
|
31
|
+
export declare function svgArcToCenter(params: ArcEndpointParams): ArcCenterParams | null;
|
|
32
|
+
/**
|
|
33
|
+
* Parse SVG arc path and extract parameters
|
|
34
|
+
* Format: "M x1 y1 A rx ry rotation largeArc sweep x2 y2"
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseSvgArcPath(path: string): ArcEndpointParams | null;
|
|
37
|
+
/**
|
|
38
|
+
* Convert radians to degrees
|
|
39
|
+
*/
|
|
40
|
+
export declare function radToDeg(rad: number): number;
|
|
41
|
+
/**
|
|
42
|
+
* Normalize angle to 0-360 range
|
|
43
|
+
*/
|
|
44
|
+
export declare function normalizeAngle(degrees: number): number;
|
|
45
|
+
//# sourceMappingURL=svg-arc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-arc.d.ts","sourceRoot":"","sources":["../../src/converter/svg-arc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,GAAG,IAAI,CA+FhF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CA4BtE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD"}
|