@jlcpcb/core 0.1.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 +10 -0
- package/README.md +474 -0
- package/package.json +48 -0
- package/src/api/easyeda-community.ts +259 -0
- package/src/api/easyeda.ts +153 -0
- package/src/api/index.ts +7 -0
- package/src/api/jlc.ts +185 -0
- package/src/constants/design-rules.ts +119 -0
- package/src/constants/footprints.ts +68 -0
- package/src/constants/index.ts +7 -0
- package/src/constants/kicad.ts +147 -0
- package/src/converter/category-router.ts +638 -0
- package/src/converter/footprint-mapper.ts +236 -0
- package/src/converter/footprint.ts +949 -0
- package/src/converter/global-lib-table.ts +394 -0
- package/src/converter/index.ts +46 -0
- package/src/converter/lib-table.ts +181 -0
- package/src/converter/svg-arc.ts +179 -0
- package/src/converter/symbol-templates.ts +214 -0
- package/src/converter/symbol.ts +1682 -0
- package/src/converter/value-normalizer.ts +262 -0
- package/src/index.ts +25 -0
- package/src/parsers/easyeda-shapes.ts +628 -0
- package/src/parsers/http-client.ts +96 -0
- package/src/parsers/index.ts +38 -0
- package/src/parsers/utils.ts +29 -0
- package/src/services/component-service.ts +100 -0
- package/src/services/fix-service.ts +50 -0
- package/src/services/index.ts +9 -0
- package/src/services/library-service.ts +696 -0
- package/src/types/component.ts +61 -0
- package/src/types/easyeda-community.ts +78 -0
- package/src/types/easyeda.ts +356 -0
- package/src/types/index.ts +12 -0
- package/src/types/jlc.ts +84 -0
- package/src/types/kicad.ts +136 -0
- package/src/types/mcp.ts +77 -0
- package/src/types/project.ts +60 -0
- package/src/utils/conversion.ts +104 -0
- package/src/utils/file-system.ts +143 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +96 -0
- package/src/utils/validation.ts +110 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component and part types for the AI-EDA toolkit
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface Component {
|
|
6
|
+
lcscPartNumber: string; // e.g., "C2040"
|
|
7
|
+
manufacturerPart: string; // e.g., "STM32F103C8T6"
|
|
8
|
+
manufacturer: string;
|
|
9
|
+
description: string;
|
|
10
|
+
category: string;
|
|
11
|
+
subcategory: string;
|
|
12
|
+
package: string;
|
|
13
|
+
stock: number;
|
|
14
|
+
price: PriceTier[];
|
|
15
|
+
datasheet?: string;
|
|
16
|
+
footprint?: FootprintRef;
|
|
17
|
+
symbol?: SymbolRef;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PriceTier {
|
|
21
|
+
quantity: number;
|
|
22
|
+
price: number;
|
|
23
|
+
currency: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FootprintRef {
|
|
27
|
+
source: 'easyeda' | 'kicad' | 'local';
|
|
28
|
+
id: string;
|
|
29
|
+
localPath?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SymbolRef {
|
|
33
|
+
source: 'easyeda' | 'kicad' | 'local';
|
|
34
|
+
id: string;
|
|
35
|
+
localPath?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ComponentSelection {
|
|
39
|
+
role: string; // e.g., "Main MCU", "Power Regulator"
|
|
40
|
+
selected?: Component;
|
|
41
|
+
alternatives?: Component[];
|
|
42
|
+
requirements: string[];
|
|
43
|
+
status: 'pending' | 'selected' | 'placed' | 'routed';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ComponentSearchResult {
|
|
47
|
+
lcscId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
manufacturer: string;
|
|
50
|
+
package: string;
|
|
51
|
+
price?: number;
|
|
52
|
+
stock: number;
|
|
53
|
+
description: string;
|
|
54
|
+
productUrl?: string; // LCSC product page URL
|
|
55
|
+
datasheetPdf?: string; // Actual PDF datasheet URL
|
|
56
|
+
category?: string;
|
|
57
|
+
/** JLCPCB assembly type: "basic" = no setup fee, "extended" = setup fee required */
|
|
58
|
+
libraryType?: 'basic' | 'extended';
|
|
59
|
+
/** Component specifications (e.g., "Output Voltage": "3.3V", "Output Current": "100mA") */
|
|
60
|
+
attributes?: Record<string, string>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for EasyEDA community library API
|
|
3
|
+
* These are for user-contributed components (not official LCSC parts)
|
|
4
|
+
*
|
|
5
|
+
* NOTE: Community components now use the same parsed structure as LCSC components.
|
|
6
|
+
* The only differences are community-specific metadata (owner, creator, etc.)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { EasyEDASymbolData, EasyEDAFootprintData } from './easyeda.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Owner information for a community component
|
|
13
|
+
*/
|
|
14
|
+
export interface EasyEDACommunityOwner {
|
|
15
|
+
uuid: string;
|
|
16
|
+
username: string;
|
|
17
|
+
nickname: string;
|
|
18
|
+
avatar?: string;
|
|
19
|
+
team?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Search result from EasyEDA community library
|
|
24
|
+
*/
|
|
25
|
+
export interface EasyEDACommunitySearchResult {
|
|
26
|
+
uuid: string;
|
|
27
|
+
title: string;
|
|
28
|
+
thumb: string;
|
|
29
|
+
description: string;
|
|
30
|
+
tags: string[];
|
|
31
|
+
package: string;
|
|
32
|
+
packageUuid?: string; // UUID for the footprint/package (for image URL)
|
|
33
|
+
manufacturer?: string;
|
|
34
|
+
owner: EasyEDACommunityOwner;
|
|
35
|
+
contributor?: string;
|
|
36
|
+
has3DModel: boolean;
|
|
37
|
+
docType: number;
|
|
38
|
+
updateTime?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Search parameters for EasyEDA community library
|
|
43
|
+
*/
|
|
44
|
+
export interface EasyEDACommunitySearchParams {
|
|
45
|
+
query: string;
|
|
46
|
+
source?: 'user' | 'lcsc' | 'easyeda' | 'all';
|
|
47
|
+
limit?: number;
|
|
48
|
+
page?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Full component data from EasyEDA community library
|
|
53
|
+
* Uses the same symbol/footprint structure as EasyEDAComponentData with
|
|
54
|
+
* additional community-specific metadata.
|
|
55
|
+
*/
|
|
56
|
+
export interface EasyEDACommunityComponent {
|
|
57
|
+
uuid: string;
|
|
58
|
+
title: string;
|
|
59
|
+
description: string;
|
|
60
|
+
tags: string[];
|
|
61
|
+
owner: EasyEDACommunityOwner;
|
|
62
|
+
creator?: EasyEDACommunityOwner;
|
|
63
|
+
updateTime: number;
|
|
64
|
+
docType: number;
|
|
65
|
+
verify: boolean;
|
|
66
|
+
symbol: EasyEDASymbolData & {
|
|
67
|
+
head: Record<string, unknown>;
|
|
68
|
+
};
|
|
69
|
+
footprint: EasyEDAFootprintData & {
|
|
70
|
+
uuid: string;
|
|
71
|
+
head: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
model3d?: {
|
|
74
|
+
name: string;
|
|
75
|
+
uuid: string;
|
|
76
|
+
};
|
|
77
|
+
rawData: object;
|
|
78
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EasyEDA format types for component data from LCSC/EasyEDA API
|
|
3
|
+
*
|
|
4
|
+
* Based on easyeda2kicad.py analysis - supports all footprint shape types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface EasyEDAComponent {
|
|
8
|
+
uuid: string;
|
|
9
|
+
lcsc: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
symbol: EasyEDASymbol;
|
|
13
|
+
footprint: EasyEDAFootprint;
|
|
14
|
+
attributes: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface EasyEDASymbol {
|
|
18
|
+
docType: string;
|
|
19
|
+
head: EasyEDAHead;
|
|
20
|
+
canvas: string;
|
|
21
|
+
shape: string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface EasyEDAFootprint {
|
|
25
|
+
docType: string;
|
|
26
|
+
head: EasyEDAHead;
|
|
27
|
+
canvas: string;
|
|
28
|
+
shape: string[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface EasyEDAHead {
|
|
32
|
+
x: string;
|
|
33
|
+
y: string;
|
|
34
|
+
c_para?: Record<string, string>;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface EasyEDAPin {
|
|
39
|
+
number: string;
|
|
40
|
+
name: string;
|
|
41
|
+
electricalType: string;
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
rotation: number;
|
|
45
|
+
// Pin style indicators (for inverted/clock pins)
|
|
46
|
+
hasDot: boolean; // Inverted bubble indicator
|
|
47
|
+
hasClock: boolean; // Clock triangle indicator
|
|
48
|
+
pinLength: number; // Pin length in EasyEDA units (extracted from SVG path)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// =============================================================================
|
|
52
|
+
// Symbol Shape Types (different from footprint shapes!)
|
|
53
|
+
// =============================================================================
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Symbol Rectangle - body outlines, IC bodies
|
|
57
|
+
* Format: R~x~y~rx~ry~width~height~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
58
|
+
*/
|
|
59
|
+
export interface EasyEDASymbolRect {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
strokeWidth: number;
|
|
65
|
+
strokeColor: string;
|
|
66
|
+
fillColor: string;
|
|
67
|
+
rx: number; // corner radius X
|
|
68
|
+
ry: number; // corner radius Y
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Symbol Circle
|
|
73
|
+
* Format: C~cx~cy~radius~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
74
|
+
*/
|
|
75
|
+
export interface EasyEDASymbolCircle {
|
|
76
|
+
cx: number;
|
|
77
|
+
cy: number;
|
|
78
|
+
radius: number;
|
|
79
|
+
strokeWidth: number;
|
|
80
|
+
strokeColor: string;
|
|
81
|
+
fillColor: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Symbol Ellipse
|
|
86
|
+
* Format: E~cx~cy~rx~ry~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
87
|
+
*/
|
|
88
|
+
export interface EasyEDASymbolEllipse {
|
|
89
|
+
cx: number;
|
|
90
|
+
cy: number;
|
|
91
|
+
radiusX: number;
|
|
92
|
+
radiusY: number;
|
|
93
|
+
strokeWidth: number;
|
|
94
|
+
strokeColor: string;
|
|
95
|
+
fillColor: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Symbol Arc with SVG path
|
|
100
|
+
* Format: A~path~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
101
|
+
*/
|
|
102
|
+
export interface EasyEDASymbolArc {
|
|
103
|
+
path: string; // SVG arc path "M x1 y1 A rx ry rotation largeArc sweep x2 y2"
|
|
104
|
+
strokeWidth: number;
|
|
105
|
+
strokeColor: string;
|
|
106
|
+
fillColor: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Symbol Polyline - open path
|
|
111
|
+
* Format: PL~points~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
112
|
+
*/
|
|
113
|
+
export interface EasyEDASymbolPolyline {
|
|
114
|
+
points: string; // Space-separated "x1 y1 x2 y2 ..."
|
|
115
|
+
strokeWidth: number;
|
|
116
|
+
strokeColor: string;
|
|
117
|
+
fillColor: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Symbol Polygon - closed filled path
|
|
122
|
+
* Format: PG~points~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
123
|
+
*/
|
|
124
|
+
export interface EasyEDASymbolPolygon {
|
|
125
|
+
points: string; // Space-separated "x1 y1 x2 y2 ..."
|
|
126
|
+
strokeWidth: number;
|
|
127
|
+
strokeColor: string;
|
|
128
|
+
fillColor: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Symbol Path - SVG path commands
|
|
133
|
+
* Format: PT~path~strokeColor~strokeWidth~strokeStyle~fillColor~id~locked
|
|
134
|
+
*/
|
|
135
|
+
export interface EasyEDASymbolPath {
|
|
136
|
+
path: string; // SVG path commands (M/L/Z/C/A)
|
|
137
|
+
strokeWidth: number;
|
|
138
|
+
strokeColor: string;
|
|
139
|
+
fillColor: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Complete symbol data with all shape types
|
|
144
|
+
*/
|
|
145
|
+
export interface EasyEDASymbolData {
|
|
146
|
+
pins: EasyEDAPin[];
|
|
147
|
+
rectangles: EasyEDASymbolRect[];
|
|
148
|
+
circles: EasyEDASymbolCircle[];
|
|
149
|
+
ellipses: EasyEDASymbolEllipse[];
|
|
150
|
+
arcs: EasyEDASymbolArc[];
|
|
151
|
+
polylines: EasyEDASymbolPolyline[];
|
|
152
|
+
polygons: EasyEDASymbolPolygon[];
|
|
153
|
+
paths: EasyEDASymbolPath[];
|
|
154
|
+
origin: { x: number; y: number };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Parsed symbol data before origin is added */
|
|
158
|
+
export type ParsedSymbolData = Omit<EasyEDASymbolData, 'origin'>;
|
|
159
|
+
|
|
160
|
+
// =============================================================================
|
|
161
|
+
// Footprint Shape Types (all coordinates in 10mil units)
|
|
162
|
+
// =============================================================================
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* PAD element - 18 fields
|
|
166
|
+
* Format: PAD~shape~cx~cy~width~height~layerId~net~number~holeRadius~points~rotation~id~holeLength~holePoint~isPlated~isLocked
|
|
167
|
+
*/
|
|
168
|
+
export interface EasyEDAPad {
|
|
169
|
+
shape: string; // RECT, ELLIPSE, OVAL, POLYGON
|
|
170
|
+
centerX: number; // center X coordinate
|
|
171
|
+
centerY: number; // center Y coordinate
|
|
172
|
+
width: number; // pad width
|
|
173
|
+
height: number; // pad height
|
|
174
|
+
layerId: number; // 1=F.Cu, 2=B.Cu, 11=*.Cu
|
|
175
|
+
net: string; // net name (usually empty)
|
|
176
|
+
number: string; // pad number "1", "2", "GND"
|
|
177
|
+
holeRadius: number; // 0 for SMD, >0 for THT (radius, not diameter)
|
|
178
|
+
points: string; // space-separated "x1 y1 x2 y2..." for POLYGON shape
|
|
179
|
+
rotation: number; // rotation in degrees
|
|
180
|
+
id: string; // unique element ID
|
|
181
|
+
holeLength: number; // for slot/oval holes
|
|
182
|
+
holePoint: string; // slot orientation
|
|
183
|
+
isPlated: boolean; // true for PTH, false for NPTH
|
|
184
|
+
isLocked: boolean; // locked in editor
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* TRACK element - silkscreen/fab lines
|
|
189
|
+
* Format: TRACK~strokeWidth~layerId~net~points~id~isLocked
|
|
190
|
+
*/
|
|
191
|
+
export interface EasyEDATrack {
|
|
192
|
+
strokeWidth: number; // line width
|
|
193
|
+
layerId: number; // layer ID
|
|
194
|
+
net: string; // net name
|
|
195
|
+
points: string; // space-separated "x1 y1 x2 y2..."
|
|
196
|
+
id: string; // unique element ID
|
|
197
|
+
isLocked: boolean;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* HOLE element - non-plated through hole (NPTH)
|
|
202
|
+
* Format: HOLE~cx~cy~radius~id~isLocked
|
|
203
|
+
*/
|
|
204
|
+
export interface EasyEDAHole {
|
|
205
|
+
centerX: number;
|
|
206
|
+
centerY: number;
|
|
207
|
+
radius: number; // hole radius (NOT diameter)
|
|
208
|
+
id: string;
|
|
209
|
+
isLocked: boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* CIRCLE element - circular graphics
|
|
214
|
+
* Format: CIRCLE~cx~cy~radius~strokeWidth~layerId~id~isLocked
|
|
215
|
+
*/
|
|
216
|
+
export interface EasyEDACircle {
|
|
217
|
+
cx: number;
|
|
218
|
+
cy: number;
|
|
219
|
+
radius: number;
|
|
220
|
+
strokeWidth: number;
|
|
221
|
+
layerId: number;
|
|
222
|
+
id: string;
|
|
223
|
+
isLocked: boolean;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* ARC element - arc graphics with SVG path
|
|
228
|
+
* Format: ARC~strokeWidth~layerId~net~path~helperDots~id~isLocked
|
|
229
|
+
*/
|
|
230
|
+
export interface EasyEDAArc {
|
|
231
|
+
strokeWidth: number;
|
|
232
|
+
layerId: number;
|
|
233
|
+
net: string;
|
|
234
|
+
path: string; // SVG arc path "M x1 y1 A rx ry rotation largeArc sweep x2 y2"
|
|
235
|
+
helperDots: string;
|
|
236
|
+
id: string;
|
|
237
|
+
isLocked: boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* RECT element - rectangle graphics
|
|
242
|
+
* Format: RECT~x~y~width~height~strokeWidth~id~layerId~isLocked
|
|
243
|
+
*/
|
|
244
|
+
export interface EasyEDARect {
|
|
245
|
+
x: number;
|
|
246
|
+
y: number;
|
|
247
|
+
width: number;
|
|
248
|
+
height: number;
|
|
249
|
+
strokeWidth: number;
|
|
250
|
+
id: string;
|
|
251
|
+
layerId: number;
|
|
252
|
+
isLocked: boolean;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* VIA element - through-hole via
|
|
257
|
+
* Format: VIA~cx~cy~diameter~net~radius~id~isLocked
|
|
258
|
+
*/
|
|
259
|
+
export interface EasyEDAVia {
|
|
260
|
+
centerX: number;
|
|
261
|
+
centerY: number;
|
|
262
|
+
diameter: number;
|
|
263
|
+
net: string;
|
|
264
|
+
radius: number; // drill radius
|
|
265
|
+
id: string;
|
|
266
|
+
isLocked: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* TEXT element - text graphics
|
|
271
|
+
* Format: TEXT~type~cx~cy~strokeWidth~rotation~mirror~layerId~net~fontSize~text~textPath~isDisplayed~id~isLocked
|
|
272
|
+
*/
|
|
273
|
+
export interface EasyEDAText {
|
|
274
|
+
type: string; // text type
|
|
275
|
+
centerX: number;
|
|
276
|
+
centerY: number;
|
|
277
|
+
strokeWidth: number;
|
|
278
|
+
rotation: number;
|
|
279
|
+
mirror: string;
|
|
280
|
+
layerId: number;
|
|
281
|
+
net: string;
|
|
282
|
+
fontSize: number;
|
|
283
|
+
text: string;
|
|
284
|
+
textPath: string;
|
|
285
|
+
isDisplayed: boolean;
|
|
286
|
+
id: string;
|
|
287
|
+
isLocked: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* SOLIDREGION element - filled polygon region
|
|
292
|
+
* Format: SOLIDREGION~layerId~~path~fillType~id~~~~
|
|
293
|
+
* Used for copper fills, solder paste regions, and documentation shapes
|
|
294
|
+
*/
|
|
295
|
+
export interface EasyEDASolidRegion {
|
|
296
|
+
layerId: number;
|
|
297
|
+
path: string; // SVG path with M/L/Z commands (e.g., "M425,230L445,230L445,220L425,220Z")
|
|
298
|
+
fillType: string; // "solid", "none", etc.
|
|
299
|
+
id: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// =============================================================================
|
|
303
|
+
// Parsed Component Data
|
|
304
|
+
// =============================================================================
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Complete footprint data with all shape types
|
|
308
|
+
*/
|
|
309
|
+
export interface EasyEDAFootprintData {
|
|
310
|
+
name: string;
|
|
311
|
+
type: 'smd' | 'tht';
|
|
312
|
+
pads: EasyEDAPad[];
|
|
313
|
+
tracks: EasyEDATrack[];
|
|
314
|
+
holes: EasyEDAHole[];
|
|
315
|
+
circles: EasyEDACircle[];
|
|
316
|
+
arcs: EasyEDAArc[];
|
|
317
|
+
rects: EasyEDARect[];
|
|
318
|
+
texts: EasyEDAText[];
|
|
319
|
+
vias: EasyEDAVia[];
|
|
320
|
+
solidRegions: EasyEDASolidRegion[];
|
|
321
|
+
origin: { x: number; y: number };
|
|
322
|
+
model3d?: { name: string; uuid: string }; // Extracted from SVGNODE
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** Parsed footprint data before origin is added */
|
|
326
|
+
export type ParsedFootprintData = Omit<EasyEDAFootprintData, 'origin'>;
|
|
327
|
+
|
|
328
|
+
export interface EasyEDAComponentData {
|
|
329
|
+
info: {
|
|
330
|
+
name: string;
|
|
331
|
+
prefix: string;
|
|
332
|
+
package?: string;
|
|
333
|
+
manufacturer?: string;
|
|
334
|
+
datasheet?: string; // Product page URL
|
|
335
|
+
datasheetPdf?: string; // Actual PDF datasheet URL
|
|
336
|
+
lcscId?: string;
|
|
337
|
+
jlcId?: string;
|
|
338
|
+
description?: string;
|
|
339
|
+
category?: string;
|
|
340
|
+
attributes?: Record<string, string>;
|
|
341
|
+
// CDFER parity fields
|
|
342
|
+
stock?: number;
|
|
343
|
+
price?: number;
|
|
344
|
+
minOrderQty?: number;
|
|
345
|
+
process?: 'SMT' | 'THT';
|
|
346
|
+
partClass?: string;
|
|
347
|
+
partNumber?: string;
|
|
348
|
+
};
|
|
349
|
+
symbol: EasyEDASymbolData;
|
|
350
|
+
footprint: EasyEDAFootprintData;
|
|
351
|
+
model3d?: {
|
|
352
|
+
name: string;
|
|
353
|
+
uuid: string;
|
|
354
|
+
};
|
|
355
|
+
rawData: object;
|
|
356
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ai-eda-common types
|
|
3
|
+
* Shared types for the AI-EDA toolkit
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './component.js';
|
|
7
|
+
export * from './kicad.js';
|
|
8
|
+
export * from './easyeda.js';
|
|
9
|
+
export * from './easyeda-community.js';
|
|
10
|
+
export * from './jlc.js';
|
|
11
|
+
export * from './project.js';
|
|
12
|
+
export * from './mcp.js';
|
package/src/types/jlc.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JLC/LCSC API response types
|
|
3
|
+
* Note: Interface names keep "LCSC" prefix as they represent LCSC part number formats
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface LCSCSearchResponse {
|
|
7
|
+
code: number;
|
|
8
|
+
result: {
|
|
9
|
+
productList: LCSCProduct[];
|
|
10
|
+
totalCount: number;
|
|
11
|
+
pageNumber: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface LCSCProduct {
|
|
17
|
+
productCode: string; // LCSC part number (e.g., "C2040")
|
|
18
|
+
productModel: string; // Manufacturer part number
|
|
19
|
+
brandNameEn: string; // Manufacturer name
|
|
20
|
+
encapStandard: string; // Package type
|
|
21
|
+
productPriceList: LCSCPriceItem[];
|
|
22
|
+
stockNumber: number;
|
|
23
|
+
productIntroEn: string; // Description
|
|
24
|
+
productImages: string[];
|
|
25
|
+
productUrl: string;
|
|
26
|
+
datasheet?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface LCSCPriceItem {
|
|
30
|
+
ladder: number;
|
|
31
|
+
productPrice: number;
|
|
32
|
+
currencySymbol: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface LCSCComponentResponse {
|
|
36
|
+
code: number;
|
|
37
|
+
result: {
|
|
38
|
+
dataStr: {
|
|
39
|
+
head: {
|
|
40
|
+
x: string;
|
|
41
|
+
y: string;
|
|
42
|
+
c_para: Record<string, string>;
|
|
43
|
+
};
|
|
44
|
+
shape: string[];
|
|
45
|
+
};
|
|
46
|
+
packageDetail: {
|
|
47
|
+
dataStr: {
|
|
48
|
+
head: {
|
|
49
|
+
x: string;
|
|
50
|
+
y: string;
|
|
51
|
+
c_para: Record<string, string>;
|
|
52
|
+
};
|
|
53
|
+
shape: string[];
|
|
54
|
+
};
|
|
55
|
+
title: string;
|
|
56
|
+
};
|
|
57
|
+
lcsc: {
|
|
58
|
+
number: string;
|
|
59
|
+
url: string;
|
|
60
|
+
};
|
|
61
|
+
SMT: boolean;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface LCSCSearchOptions {
|
|
66
|
+
category?: string;
|
|
67
|
+
inStock?: boolean;
|
|
68
|
+
basicOnly?: boolean;
|
|
69
|
+
limit?: number;
|
|
70
|
+
page?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface LCSCStockInfo {
|
|
74
|
+
lcscPartNumber: string;
|
|
75
|
+
stock: number;
|
|
76
|
+
priceBreaks: PriceBreak[];
|
|
77
|
+
minimumOrder: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface PriceBreak {
|
|
81
|
+
quantity: number;
|
|
82
|
+
unitPrice: number;
|
|
83
|
+
currency: string;
|
|
84
|
+
}
|