@jlcpcb/core 0.1.0 → 0.1.1

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/api/easyeda-community.d.ts +36 -0
  3. package/dist/api/easyeda-community.d.ts.map +1 -0
  4. package/dist/api/easyeda.d.ts +23 -0
  5. package/dist/api/easyeda.d.ts.map +1 -0
  6. package/dist/api/index.d.ts +7 -0
  7. package/dist/api/index.d.ts.map +1 -0
  8. package/dist/api/jlc.d.ts +41 -0
  9. package/dist/api/jlc.d.ts.map +1 -0
  10. package/dist/constants/design-rules.d.ts +34 -0
  11. package/dist/constants/design-rules.d.ts.map +1 -0
  12. package/dist/constants/footprints.d.ts +134 -0
  13. package/dist/constants/footprints.d.ts.map +1 -0
  14. package/dist/constants/index.d.ts +7 -0
  15. package/dist/constants/index.d.ts.map +1 -0
  16. package/dist/constants/kicad.d.ts +67 -0
  17. package/dist/constants/kicad.d.ts.map +1 -0
  18. package/dist/converter/category-router.d.ts +47 -0
  19. package/dist/converter/category-router.d.ts.map +1 -0
  20. package/dist/converter/footprint-mapper.d.ts +40 -0
  21. package/dist/converter/footprint-mapper.d.ts.map +1 -0
  22. package/dist/converter/footprint-mapper.test.d.ts +2 -0
  23. package/dist/converter/footprint-mapper.test.d.ts.map +1 -0
  24. package/dist/converter/footprint.d.ts +106 -0
  25. package/dist/converter/footprint.d.ts.map +1 -0
  26. package/dist/converter/global-lib-table.d.ts +29 -0
  27. package/dist/converter/global-lib-table.d.ts.map +1 -0
  28. package/dist/converter/index.d.ts +12 -0
  29. package/dist/converter/index.d.ts.map +1 -0
  30. package/dist/converter/lib-table.d.ts +61 -0
  31. package/dist/converter/lib-table.d.ts.map +1 -0
  32. package/dist/converter/svg-arc.d.ts +45 -0
  33. package/dist/converter/svg-arc.d.ts.map +1 -0
  34. package/dist/converter/symbol-templates.d.ts +34 -0
  35. package/dist/converter/symbol-templates.d.ts.map +1 -0
  36. package/dist/converter/symbol.d.ts +223 -0
  37. package/dist/converter/symbol.d.ts.map +1 -0
  38. package/dist/converter/value-normalizer.d.ts +33 -0
  39. package/dist/converter/value-normalizer.d.ts.map +1 -0
  40. package/dist/index.d.ts +12 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +9198 -0
  43. package/dist/parsers/easyeda-shapes.d.ts +115 -0
  44. package/dist/parsers/easyeda-shapes.d.ts.map +1 -0
  45. package/dist/parsers/http-client.d.ts +16 -0
  46. package/dist/parsers/http-client.d.ts.map +1 -0
  47. package/dist/parsers/index.d.ts +11 -0
  48. package/dist/parsers/index.d.ts.map +1 -0
  49. package/dist/parsers/utils.d.ts +17 -0
  50. package/dist/parsers/utils.d.ts.map +1 -0
  51. package/dist/services/component-service.d.ts +31 -0
  52. package/dist/services/component-service.d.ts.map +1 -0
  53. package/dist/services/fix-service.d.ts +40 -0
  54. package/dist/services/fix-service.d.ts.map +1 -0
  55. package/dist/services/index.d.ts +8 -0
  56. package/dist/services/index.d.ts.map +1 -0
  57. package/dist/services/library-service.d.ts +111 -0
  58. package/dist/services/library-service.d.ts.map +1 -0
  59. package/dist/types/component.d.ts +56 -0
  60. package/dist/types/component.d.ts.map +1 -0
  61. package/dist/types/easyeda-community.d.ts +74 -0
  62. package/dist/types/easyeda-community.d.ts.map +1 -0
  63. package/dist/types/easyeda.d.ts +326 -0
  64. package/dist/types/easyeda.d.ts.map +1 -0
  65. package/dist/types/index.d.ts +12 -0
  66. package/dist/types/index.d.ts.map +1 -0
  67. package/dist/types/jlc.d.ts +78 -0
  68. package/dist/types/jlc.d.ts.map +1 -0
  69. package/dist/types/kicad.d.ts +141 -0
  70. package/dist/types/kicad.d.ts.map +1 -0
  71. package/dist/types/mcp.d.ts +66 -0
  72. package/dist/types/mcp.d.ts.map +1 -0
  73. package/dist/types/project.d.ts +60 -0
  74. package/dist/types/project.d.ts.map +1 -0
  75. package/dist/utils/conversion.d.ts +59 -0
  76. package/dist/utils/conversion.d.ts.map +1 -0
  77. package/dist/utils/file-system.d.ts +59 -0
  78. package/dist/utils/file-system.d.ts.map +1 -0
  79. package/dist/utils/index.d.ts +8 -0
  80. package/dist/utils/index.d.ts.map +1 -0
  81. package/dist/utils/logger.d.ts +26 -0
  82. package/dist/utils/logger.d.ts.map +1 -0
  83. package/dist/utils/validation.d.ts +259 -0
  84. package/dist/utils/validation.d.ts.map +1 -0
  85. package/package.json +1 -1
  86. package/src/converter/footprint-mapper.test.ts +159 -0
  87. package/src/converter/footprint-mapper.ts +42 -134
  88. package/src/converter/footprint.ts +24 -9
@@ -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,MA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terization
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"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Symbol Templates for Passive Components
3
+ * Fixed layouts that produce clean, consistent symbols like CDFER's JLCPCB-Kicad-Library
4
+ */
5
+ export interface SymbolTemplate {
6
+ /** Pin length in mm */
7
+ pinLength: number;
8
+ /** Y-distance between pins for 2-pin components (total, not from center) */
9
+ pinSpacing: number;
10
+ /** KiCad S-expression for body graphics */
11
+ bodyGraphics: string;
12
+ /** Reference designator position */
13
+ refPosition: {
14
+ x: number;
15
+ y: number;
16
+ angle: number;
17
+ };
18
+ /** Value property position */
19
+ valuePosition: {
20
+ x: number;
21
+ y: number;
22
+ angle: number;
23
+ };
24
+ }
25
+ /**
26
+ * Get symbol template for a component prefix
27
+ * Returns null for components that should use EasyEDA-derived layout
28
+ */
29
+ export declare function getSymbolTemplate(prefix: string): SymbolTemplate | null;
30
+ /**
31
+ * Check if a component should use a fixed template
32
+ */
33
+ export declare function hasFixedTemplate(prefix: string): boolean;
34
+ //# sourceMappingURL=symbol-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-templates.d.ts","sourceRoot":"","sources":["../../src/converter/symbol-templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,WAAW,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,8BAA8B;IAC9B,aAAa,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD;AAwKD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAkBvE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * EasyEDA Symbol to KiCad Symbol Converter
3
+ * Converts EasyEDA symbol format to KiCad .kicad_sym format (KiCad 9 compatible)
4
+ */
5
+ import type { EasyEDAComponentData } from '../types/index.js';
6
+ export interface SymbolConversionOptions {
7
+ libraryName?: string;
8
+ symbolName?: string;
9
+ includeDatasheet?: boolean;
10
+ includeManufacturer?: boolean;
11
+ }
12
+ export declare class SymbolConverter {
13
+ /**
14
+ * Convert EasyEDA component data to KiCad symbol format string (standalone library)
15
+ */
16
+ convert(component: EasyEDAComponentData, options?: SymbolConversionOptions): string;
17
+ /**
18
+ * Convert component to a symbol entry (without library wrapper)
19
+ * Used for appending to existing libraries
20
+ */
21
+ convertToSymbolEntry(component: EasyEDAComponentData, options?: SymbolConversionOptions): string;
22
+ /**
23
+ * Generate symbol from fixed template (for passives)
24
+ */
25
+ private generateFromTemplate;
26
+ /**
27
+ * Generate symbol from EasyEDA data (for ICs and complex components)
28
+ * Uses parsed shapes if available, otherwise falls back to DIP-style layout
29
+ */
30
+ private generateFromEasyEDA;
31
+ /**
32
+ * Check if symbol has shapes worth rendering (not just pins)
33
+ */
34
+ private hasRenderableShapes;
35
+ /**
36
+ * Generate symbol using parsed EasyEDA shapes
37
+ */
38
+ private generateFromShapes;
39
+ /**
40
+ * Convert EasyEDA X coordinate to KiCad (with origin offset)
41
+ */
42
+ private convertX;
43
+ /**
44
+ * Convert EasyEDA Y coordinate to KiCad (Y-flipped with origin offset)
45
+ */
46
+ private convertY;
47
+ /**
48
+ * Convert stroke width from EasyEDA to KiCad
49
+ */
50
+ private convertStrokeWidth;
51
+ /**
52
+ * Convert EasyEDA rectangle to KiCad format
53
+ */
54
+ private convertRectangle;
55
+ /**
56
+ * Convert EasyEDA circle to KiCad format
57
+ */
58
+ private convertCircle;
59
+ /**
60
+ * Convert EasyEDA ellipse to KiCad format (approximated as circle if rx≈ry)
61
+ * KiCad symbols don't support true ellipses, so we use a circle with average radius
62
+ */
63
+ private convertEllipse;
64
+ /**
65
+ * Convert EasyEDA polyline to KiCad format
66
+ */
67
+ private convertPolyline;
68
+ /**
69
+ * Convert EasyEDA polygon to KiCad format (closed, filled polyline)
70
+ */
71
+ private convertPolygon;
72
+ /**
73
+ * Convert EasyEDA arc to KiCad format
74
+ * Uses SVG arc to center parameterization conversion
75
+ */
76
+ private convertArc;
77
+ /**
78
+ * Convert EasyEDA SVG path to KiCad polyline
79
+ * Supports M (move), L (line), Z (close) commands
80
+ */
81
+ private convertPath;
82
+ /**
83
+ * Parse SVG path string (M/L/Z commands) to array of points
84
+ * Format: "M x1,y1 L x2,y2 L x3,y3 Z" or "M x1 y1 L x2 y2 ..."
85
+ */
86
+ private parseSvgPath;
87
+ /**
88
+ * Parse space-separated point string to array of {x, y}
89
+ */
90
+ private parsePoints;
91
+ /**
92
+ * Generate a pin using EasyEDA coordinates and rotation
93
+ *
94
+ * EasyEDA: pin.x/y is the WIRE connection point (junction)
95
+ * rotation points FROM wire TO body
96
+ * KiCad: pin position is the WIRE connection point
97
+ * rotation points FROM wire TO body
98
+ *
99
+ * So we just need coordinate conversion with Y-flip!
100
+ */
101
+ private generateShapePin;
102
+ /**
103
+ * Map EasyEDA pin rotation to KiCad rotation
104
+ *
105
+ * EasyEDA: rotation indicates direction pin EXTENDS from wire (away from body)
106
+ * KiCad: rotation indicates direction pin POINTS (from wire toward body)
107
+ *
108
+ * So we need to flip by 180°, then account for Y-axis flip:
109
+ * - EasyEDA 0 (extends right, body on left) -> KiCad 180 (points left toward body)
110
+ * - EasyEDA 180 (extends left, body on right) -> KiCad 0 (points right toward body)
111
+ * - EasyEDA 90 (extends down, body on top) -> KiCad 90 (points up toward body, Y-flipped)
112
+ * - EasyEDA 270 (extends up, body on bottom) -> KiCad 270 (points down toward body, Y-flipped)
113
+ */
114
+ private mapPinRotation;
115
+ /**
116
+ * Get KiCad pin style from EasyEDA pin indicators
117
+ */
118
+ private getPinStyle;
119
+ /**
120
+ * Calculate DIP-style IC layout from EasyEDA pins
121
+ * Matches CDFER layout: wide body, pins extending from edges
122
+ */
123
+ private calculateICLayout;
124
+ /**
125
+ * Generate IC body rectangle and pins in single _0_1 unit (CDFER style)
126
+ */
127
+ private generateICGraphics;
128
+ /**
129
+ * Generate empty IC pins unit (pins are in _0_1 for CDFER compatibility)
130
+ */
131
+ private generateICPins;
132
+ /**
133
+ * Create a new library file with multiple symbols
134
+ */
135
+ createLibrary(components: EasyEDAComponentData[]): string;
136
+ /**
137
+ * Append a symbol to an existing library file content
138
+ * Returns the updated library content
139
+ */
140
+ appendToLibrary(existingLibraryContent: string, component: EasyEDAComponentData, options?: SymbolConversionOptions): string;
141
+ /**
142
+ * Check if a symbol already exists in a library
143
+ */
144
+ symbolExistsInLibrary(libraryContent: string, componentName: string): boolean;
145
+ /**
146
+ * Replace an existing symbol in a library with a new version
147
+ * If the symbol doesn't exist, it will be appended
148
+ */
149
+ replaceInLibrary(existingLibraryContent: string, component: EasyEDAComponentData, options?: SymbolConversionOptions): string;
150
+ /**
151
+ * Get the sanitized symbol name for a component
152
+ */
153
+ getSymbolName(component: EasyEDAComponentData): string;
154
+ /**
155
+ * Generate file header
156
+ */
157
+ private generateHeader;
158
+ /**
159
+ * Generate symbol start - NO library prefix in symbol name
160
+ */
161
+ private generateSymbolStart;
162
+ /**
163
+ * Generate KiCad property entries in KiCad 9 format
164
+ */
165
+ private generateProperties;
166
+ /**
167
+ * Calculate bounding box from pins (for IC/complex components)
168
+ * Uses improved padding for better visual appearance
169
+ */
170
+ private calculateBoundingBox;
171
+ /**
172
+ * Generate _0_1 unit with graphical elements (rectangle body)
173
+ * Uses IC_MIN_BODY_SIZE for minimum dimensions
174
+ */
175
+ private generateGraphicsUnit;
176
+ /**
177
+ * Generate _1_1 unit with pins
178
+ */
179
+ private generatePinsUnit;
180
+ /**
181
+ * Generate a single pin entry in KiCad 9 format
182
+ * Uses IC_PIN_LENGTH for better readability with complex components
183
+ */
184
+ private generatePin;
185
+ /**
186
+ * Generate symbol end (closes the symbol, NOT the library)
187
+ */
188
+ private generateSymbolEnd;
189
+ /**
190
+ * Generate properties for template-based symbols
191
+ */
192
+ private generateTemplateProperties;
193
+ /**
194
+ * Generate graphics unit for template-based symbols
195
+ */
196
+ private generateTemplateGraphics;
197
+ /**
198
+ * Generate pins for template-based symbols (2-pin vertical layout)
199
+ */
200
+ private generateTemplatePins;
201
+ /**
202
+ * Map EasyEDA pin type to KiCad pin type
203
+ */
204
+ private mapPinType;
205
+ /**
206
+ * Calculate pin rotation based on position (points inward toward center)
207
+ */
208
+ private calculatePinRotation;
209
+ /**
210
+ * Sanitize component name for KiCad (no special chars except underscore/hyphen)
211
+ */
212
+ private sanitizeName;
213
+ /**
214
+ * Sanitize pin name (escape quotes)
215
+ */
216
+ private sanitizePinName;
217
+ /**
218
+ * Sanitize general text for properties
219
+ */
220
+ private sanitizeText;
221
+ }
222
+ export declare const symbolConverter: SymbolConverter;
223
+ //# sourceMappingURL=symbol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol.d.ts","sourceRoot":"","sources":["../../src/converter/symbol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAUrB,MAAM,mBAAmB,CAAC;AA2B3B,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAmBD,qBAAa,eAAe;IAC1B;;OAEG;IACH,OAAO,CACL,SAAS,EAAE,oBAAoB,EAC/B,OAAO,GAAE,uBAA4B,GACpC,MAAM;IAKT;;;OAGG;IACH,oBAAoB,CAClB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,GAAE,uBAA4B,GACpC,MAAM;IAyBT;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkB5B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoD1B;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;OAEG;IACH,OAAO,CAAC,aAAa;IAoBrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAsBvB;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB;;;OAGG;IACH,OAAO,CAAC,UAAU;IA0ClB;;;OAGG;IACH,OAAO,CAAC,WAAW;IA2BnB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAsCpB;;OAEG;IACH,OAAO,CAAC,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oBAAoB;IAQ5B;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB;;OAEG;IACH,OAAO,CAAC,YAAY;CAGrB;AAED,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Component Value Normalizer
3
+ * Extracts and normalizes component values from descriptions
4
+ * "16k Ohm ±1% 0.1W" → "16k"
5
+ * "100nF 50V X7R" → "100n/50V"
6
+ */
7
+ export type ComponentType = 'resistor' | 'capacitor' | 'inductor' | 'diode' | 'transistor' | 'ic' | 'other';
8
+ export interface NormalizedValue {
9
+ displayValue: string;
10
+ originalValue: string;
11
+ params?: {
12
+ value?: string;
13
+ tolerance?: string;
14
+ voltage?: string;
15
+ power?: string;
16
+ current?: string;
17
+ };
18
+ }
19
+ /**
20
+ * Detect component type from prefix and category
21
+ */
22
+ export declare function detectComponentType(prefix: string, category?: string): ComponentType;
23
+ /**
24
+ * Main normalization function
25
+ * Returns normalized value based on component type
26
+ */
27
+ export declare function normalizeValue(description: string, type: ComponentType): NormalizedValue;
28
+ /**
29
+ * Extract value from component name or description
30
+ * Tries multiple strategies to find a meaningful value
31
+ */
32
+ export declare function extractDisplayValue(name: string, description: string | undefined, prefix: string, category?: string): string;
33
+ //# sourceMappingURL=value-normalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-normalizer.d.ts","sourceRoot":"","sources":["../../src/converter/value-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC;AAE5G,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AA8CD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CA6BpF;AA4GD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,aAAa,GAClB,eAAe,CAwBjB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAcR"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * jlc-core
3
+ * Core library for JLC/EasyEDA component sourcing and KiCad conversion
4
+ */
5
+ export * from './services/index.js';
6
+ export * from './api/index.js';
7
+ export * from './converter/index.js';
8
+ export * from './types/index.js';
9
+ export * from './utils/index.js';
10
+ export * from './constants/index.js';
11
+ export * from './parsers/index.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,sBAAsB,CAAC;AAGrC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,oBAAoB,CAAC"}