@tscircuit/parts-engine 0.0.22 → 0.0.24
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.js +940 -281
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -46,8 +46,10 @@ __export(dist_exports, {
|
|
|
46
46
|
layer_ref: () => layer_ref,
|
|
47
47
|
layer_string: () => layer_string,
|
|
48
48
|
length: () => length,
|
|
49
|
+
manufacturing_drc_properties: () => manufacturing_drc_properties,
|
|
49
50
|
ms: () => ms,
|
|
50
51
|
ninePointAnchor: () => ninePointAnchor,
|
|
52
|
+
parseAndConvertSiUnit: () => parseAndConvertSiUnit,
|
|
51
53
|
pcbRenderLayer: () => pcbRenderLayer,
|
|
52
54
|
pcb_autorouting_error: () => pcb_autorouting_error,
|
|
53
55
|
pcb_board: () => pcb_board,
|
|
@@ -65,6 +67,7 @@ __export(dist_exports, {
|
|
|
65
67
|
pcb_courtyard_circle: () => pcb_courtyard_circle,
|
|
66
68
|
pcb_courtyard_outline: () => pcb_courtyard_outline,
|
|
67
69
|
pcb_courtyard_overlap_error: () => pcb_courtyard_overlap_error,
|
|
70
|
+
pcb_courtyard_pill: () => pcb_courtyard_pill,
|
|
68
71
|
pcb_courtyard_polygon: () => pcb_courtyard_polygon,
|
|
69
72
|
pcb_courtyard_rect: () => pcb_courtyard_rect,
|
|
70
73
|
pcb_cutout: () => pcb_cutout,
|
|
@@ -96,6 +99,8 @@ __export(dist_exports, {
|
|
|
96
99
|
pcb_note_path: () => pcb_note_path,
|
|
97
100
|
pcb_note_rect: () => pcb_note_rect,
|
|
98
101
|
pcb_note_text: () => pcb_note_text,
|
|
102
|
+
pcb_pad_pad_clearance_error: () => pcb_pad_pad_clearance_error,
|
|
103
|
+
pcb_pad_trace_clearance_error: () => pcb_pad_trace_clearance_error,
|
|
99
104
|
pcb_panel: () => pcb_panel,
|
|
100
105
|
pcb_panelization_placement_error: () => pcb_panelization_placement_error,
|
|
101
106
|
pcb_placement_error: () => pcb_placement_error,
|
|
@@ -106,6 +111,8 @@ __export(dist_exports, {
|
|
|
106
111
|
pcb_route_hint: () => pcb_route_hint,
|
|
107
112
|
pcb_route_hints: () => pcb_route_hints,
|
|
108
113
|
pcb_silkscreen_circle: () => pcb_silkscreen_circle,
|
|
114
|
+
pcb_silkscreen_graphic: () => pcb_silkscreen_graphic,
|
|
115
|
+
pcb_silkscreen_graphic_brep: () => pcb_silkscreen_graphic_brep,
|
|
109
116
|
pcb_silkscreen_line: () => pcb_silkscreen_line,
|
|
110
117
|
pcb_silkscreen_oval: () => pcb_silkscreen_oval,
|
|
111
118
|
pcb_silkscreen_path: () => pcb_silkscreen_path,
|
|
@@ -122,10 +129,13 @@ __export(dist_exports, {
|
|
|
122
129
|
pcb_trace_hint: () => pcb_trace_hint,
|
|
123
130
|
pcb_trace_missing_error: () => pcb_trace_missing_error,
|
|
124
131
|
pcb_trace_route_point: () => pcb_trace_route_point,
|
|
132
|
+
pcb_trace_route_point_through_pad: () => pcb_trace_route_point_through_pad,
|
|
125
133
|
pcb_trace_route_point_via: () => pcb_trace_route_point_via,
|
|
126
134
|
pcb_trace_route_point_wire: () => pcb_trace_route_point_wire,
|
|
135
|
+
pcb_trace_warning: () => pcb_trace_warning,
|
|
127
136
|
pcb_via: () => pcb_via,
|
|
128
137
|
pcb_via_clearance_error: () => pcb_via_clearance_error,
|
|
138
|
+
pcb_via_trace_clearance_error: () => pcb_via_trace_clearance_error,
|
|
129
139
|
point: () => point,
|
|
130
140
|
point3: () => point3,
|
|
131
141
|
point_with_bulge: () => point_with_bulge,
|
|
@@ -166,12 +176,16 @@ __export(dist_exports, {
|
|
|
166
176
|
schematic_voltage_probe: () => schematic_voltage_probe,
|
|
167
177
|
simulation_ac_current_source: () => simulation_ac_current_source,
|
|
168
178
|
simulation_ac_voltage_source: () => simulation_ac_voltage_source,
|
|
179
|
+
simulation_current_probe: () => simulation_current_probe,
|
|
169
180
|
simulation_current_source: () => simulation_current_source,
|
|
170
181
|
simulation_dc_current_source: () => simulation_dc_current_source,
|
|
171
182
|
simulation_dc_voltage_source: () => simulation_dc_voltage_source,
|
|
172
183
|
simulation_experiment: () => simulation_experiment,
|
|
173
184
|
simulation_op_amp: () => simulation_op_amp,
|
|
185
|
+
simulation_oscilloscope_trace: () => simulation_oscilloscope_trace,
|
|
186
|
+
simulation_spice_subcircuit: () => simulation_spice_subcircuit,
|
|
174
187
|
simulation_switch: () => simulation_switch,
|
|
188
|
+
simulation_transient_current_graph: () => simulation_transient_current_graph,
|
|
175
189
|
simulation_transient_voltage_graph: () => simulation_transient_voltage_graph,
|
|
176
190
|
simulation_unknown_experiment_error: () => simulation_unknown_experiment_error,
|
|
177
191
|
simulation_voltage_probe: () => simulation_voltage_probe,
|
|
@@ -181,6 +195,7 @@ __export(dist_exports, {
|
|
|
181
195
|
source_board: () => source_board,
|
|
182
196
|
source_component_base: () => source_component_base,
|
|
183
197
|
source_component_internal_connection: () => source_component_internal_connection,
|
|
198
|
+
source_component_misconfigured_error: () => source_component_misconfigured_error,
|
|
184
199
|
source_component_pins_underspecified_warning: () => source_component_pins_underspecified_warning,
|
|
185
200
|
source_failed_to_create_component_error: () => source_failed_to_create_component_error,
|
|
186
201
|
source_group: () => source_group,
|
|
@@ -188,10 +203,12 @@ __export(dist_exports, {
|
|
|
188
203
|
source_interconnect: () => source_interconnect,
|
|
189
204
|
source_invalid_component_property_error: () => source_invalid_component_property_error,
|
|
190
205
|
source_manually_placed_via: () => source_manually_placed_via,
|
|
206
|
+
source_missing_manufacturer_part_number_warning: () => source_missing_manufacturer_part_number_warning,
|
|
191
207
|
source_missing_property_error: () => source_missing_property_error,
|
|
192
208
|
source_net: () => source_net,
|
|
193
209
|
source_no_ground_pin_defined_warning: () => source_no_ground_pin_defined_warning,
|
|
194
210
|
source_no_power_pin_defined_warning: () => source_no_power_pin_defined_warning,
|
|
211
|
+
source_part_not_found_warning: () => source_part_not_found_warning,
|
|
195
212
|
source_pcb_ground_plane: () => source_pcb_ground_plane,
|
|
196
213
|
source_pin_attributes: () => source_pin_attributes,
|
|
197
214
|
source_pin_missing_trace_warning: () => source_pin_missing_trace_warning,
|
|
@@ -199,6 +216,8 @@ __export(dist_exports, {
|
|
|
199
216
|
source_port: () => source_port,
|
|
200
217
|
source_project_metadata: () => source_project_metadata,
|
|
201
218
|
source_property_ignored_warning: () => source_property_ignored_warning,
|
|
219
|
+
source_refdes_convention_warning: () => source_refdes_convention_warning,
|
|
220
|
+
source_simple_ammeter: () => source_simple_ammeter,
|
|
202
221
|
source_simple_battery: () => source_simple_battery,
|
|
203
222
|
source_simple_capacitor: () => source_simple_capacitor,
|
|
204
223
|
source_simple_chip: () => source_simple_chip,
|
|
@@ -207,6 +226,7 @@ __export(dist_exports, {
|
|
|
207
226
|
source_simple_current_source: () => source_simple_current_source,
|
|
208
227
|
source_simple_diode: () => source_simple_diode,
|
|
209
228
|
source_simple_fiducial: () => source_simple_fiducial,
|
|
229
|
+
source_simple_fuse: () => source_simple_fuse,
|
|
210
230
|
source_simple_ground: () => source_simple_ground,
|
|
211
231
|
source_simple_inductor: () => source_simple_inductor,
|
|
212
232
|
source_simple_led: () => source_simple_led,
|
|
@@ -226,6 +246,9 @@ __export(dist_exports, {
|
|
|
226
246
|
source_simple_voltage_source: () => source_simple_voltage_source,
|
|
227
247
|
source_trace: () => source_trace,
|
|
228
248
|
source_trace_not_connected_error: () => source_trace_not_connected_error,
|
|
249
|
+
source_unnamed_trace_warning: () => source_unnamed_trace_warning,
|
|
250
|
+
spice_simulation_options: () => spice_simulation_options,
|
|
251
|
+
supplier_footprint_mismatch_warning: () => supplier_footprint_mismatch_warning,
|
|
229
252
|
supplier_name: () => supplier_name,
|
|
230
253
|
time: () => time,
|
|
231
254
|
timestamp: () => timestamp,
|
|
@@ -234,6 +257,271 @@ __export(dist_exports, {
|
|
|
234
257
|
voltage: () => voltage,
|
|
235
258
|
wave_shape: () => wave_shape
|
|
236
259
|
});
|
|
260
|
+
var SI_PREFIX_VALUES = /* @__PURE__ */ new Map([
|
|
261
|
+
["T", 1e12],
|
|
262
|
+
["G", 1e9],
|
|
263
|
+
["M", 1e6],
|
|
264
|
+
["K", 1e3],
|
|
265
|
+
["k", 1e3],
|
|
266
|
+
["", 1],
|
|
267
|
+
["m", 1e-3],
|
|
268
|
+
["\xB5", 1e-6],
|
|
269
|
+
["u", 1e-6],
|
|
270
|
+
["n", 1e-9],
|
|
271
|
+
["p", 1e-12],
|
|
272
|
+
["f", 1e-15]
|
|
273
|
+
]);
|
|
274
|
+
var SI_PREFIXES = [...SI_PREFIX_VALUES.keys()];
|
|
275
|
+
function getSiPrefixMultiplier(prefix) {
|
|
276
|
+
return SI_PREFIX_VALUES.get(prefix);
|
|
277
|
+
}
|
|
278
|
+
var unitMappings = {
|
|
279
|
+
Hz: {
|
|
280
|
+
baseUnit: "Hz",
|
|
281
|
+
variants: {
|
|
282
|
+
MHz: 1e6,
|
|
283
|
+
kHz: 1e3,
|
|
284
|
+
Hz: 1
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
g: {
|
|
288
|
+
baseUnit: "g",
|
|
289
|
+
variants: {
|
|
290
|
+
kg: 1e3,
|
|
291
|
+
g: 1
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
\u03A9: {
|
|
295
|
+
baseUnit: "\u03A9",
|
|
296
|
+
variants: {
|
|
297
|
+
m\u03A9: 1e-3,
|
|
298
|
+
mohm: 1e-3,
|
|
299
|
+
mOhm: 1e-3,
|
|
300
|
+
milliohm: 1e-3,
|
|
301
|
+
\u03A9: 1,
|
|
302
|
+
ohm: 1,
|
|
303
|
+
Ohm: 1,
|
|
304
|
+
k\u03A9: 1e3,
|
|
305
|
+
K\u03A9: 1e3,
|
|
306
|
+
kohm: 1e3,
|
|
307
|
+
kOhm: 1e3,
|
|
308
|
+
KOhm: 1e3,
|
|
309
|
+
Kohm: 1e3,
|
|
310
|
+
M\u03A9: 1e6,
|
|
311
|
+
Mohm: 1e6,
|
|
312
|
+
MOhm: 1e6,
|
|
313
|
+
megohm: 1e6,
|
|
314
|
+
Megohm: 1e6,
|
|
315
|
+
G\u03A9: 1e9,
|
|
316
|
+
Gohm: 1e9,
|
|
317
|
+
GOhm: 1e9,
|
|
318
|
+
T\u03A9: 1e12,
|
|
319
|
+
Tohm: 1e12,
|
|
320
|
+
TOhm: 1e12
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
V: {
|
|
324
|
+
baseUnit: "V",
|
|
325
|
+
variants: {
|
|
326
|
+
mV: 1e-3,
|
|
327
|
+
V: 1,
|
|
328
|
+
kV: 1e3,
|
|
329
|
+
KV: 1e3,
|
|
330
|
+
MV: 1e6,
|
|
331
|
+
GV: 1e9,
|
|
332
|
+
TV: 1e12
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
A: {
|
|
336
|
+
baseUnit: "A",
|
|
337
|
+
variants: {
|
|
338
|
+
\u00B5A: 1e-6,
|
|
339
|
+
mA: 1e-3,
|
|
340
|
+
ma: 1e-3,
|
|
341
|
+
A: 1,
|
|
342
|
+
kA: 1e3,
|
|
343
|
+
MA: 1e6
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
F: {
|
|
347
|
+
baseUnit: "F",
|
|
348
|
+
variants: {
|
|
349
|
+
pF: 1e-12,
|
|
350
|
+
nF: 1e-9,
|
|
351
|
+
\u00B5F: 1e-6,
|
|
352
|
+
uF: 1e-6,
|
|
353
|
+
mF: 1e-3,
|
|
354
|
+
F: 1,
|
|
355
|
+
kF: 1e3,
|
|
356
|
+
KF: 1e3,
|
|
357
|
+
MF: 1e6
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
H: {
|
|
361
|
+
baseUnit: "H",
|
|
362
|
+
variants: {
|
|
363
|
+
pH: 1e-12,
|
|
364
|
+
nH: 1e-9,
|
|
365
|
+
\u00B5H: 1e-6,
|
|
366
|
+
uH: 1e-6,
|
|
367
|
+
mH: 1e-3,
|
|
368
|
+
H: 1,
|
|
369
|
+
kH: 1e3,
|
|
370
|
+
KH: 1e3,
|
|
371
|
+
MH: 1e6
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
ml: {
|
|
375
|
+
baseUnit: "ml",
|
|
376
|
+
variants: {
|
|
377
|
+
ml: 1,
|
|
378
|
+
mL: 1,
|
|
379
|
+
l: 1e3,
|
|
380
|
+
L: 1e3
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
deg: {
|
|
384
|
+
baseUnit: "deg",
|
|
385
|
+
variants: {
|
|
386
|
+
rad: 180 / Math.PI
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
ms: {
|
|
390
|
+
baseUnit: "ms",
|
|
391
|
+
variants: {
|
|
392
|
+
fs: 1e-12,
|
|
393
|
+
ps: 1e-9,
|
|
394
|
+
ns: 1e-6,
|
|
395
|
+
us: 1e-3,
|
|
396
|
+
\u00B5s: 1e-3,
|
|
397
|
+
ms: 1,
|
|
398
|
+
s: 1e3
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
mm: {
|
|
402
|
+
baseUnit: "mm",
|
|
403
|
+
variants: {
|
|
404
|
+
nm: 1e-6,
|
|
405
|
+
\u00B5m: 1e-3,
|
|
406
|
+
um: 1e-3,
|
|
407
|
+
mm: 1,
|
|
408
|
+
cm: 10,
|
|
409
|
+
dm: 100,
|
|
410
|
+
m: 1e3,
|
|
411
|
+
km: 1e6,
|
|
412
|
+
in: 25.4,
|
|
413
|
+
ft: 304.8,
|
|
414
|
+
IN: 25.4,
|
|
415
|
+
FT: 304.8,
|
|
416
|
+
yd: 914.4,
|
|
417
|
+
mi: 1609344,
|
|
418
|
+
mil: 0.0254
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
var unitMappingAndVariantSuffixes = /* @__PURE__ */ new Set();
|
|
423
|
+
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
424
|
+
unitMappingAndVariantSuffixes.add(baseUnit);
|
|
425
|
+
for (const variant of Object.keys(info.variants)) {
|
|
426
|
+
unitMappingAndVariantSuffixes.add(variant);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function getBaseTscircuitUnit(unit) {
|
|
430
|
+
for (const info of Object.values(unitMappings)) {
|
|
431
|
+
if (unit in info.variants) {
|
|
432
|
+
return {
|
|
433
|
+
baseUnit: info.baseUnit,
|
|
434
|
+
conversionFactor: info.variants[unit]
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
for (const [variant, conversionFactor] of Object.entries(info.variants)) {
|
|
438
|
+
if (!unit.endsWith(variant)) continue;
|
|
439
|
+
const prefix = unit.slice(0, -variant.length);
|
|
440
|
+
const prefixMultiplier = getSiPrefixMultiplier(prefix);
|
|
441
|
+
if (prefixMultiplier == null) continue;
|
|
442
|
+
return {
|
|
443
|
+
baseUnit: info.baseUnit,
|
|
444
|
+
conversionFactor: prefixMultiplier * conversionFactor
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
baseUnit: unit,
|
|
450
|
+
conversionFactor: 1
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function parseAndConvertSiUnit(v, unitOfValue) {
|
|
454
|
+
if (v === void 0 || v === null)
|
|
455
|
+
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
456
|
+
if (typeof v === "string" && v.match(/^-?[\d.]+$/))
|
|
457
|
+
return {
|
|
458
|
+
value: Number.parseFloat(v),
|
|
459
|
+
parsedUnit: null,
|
|
460
|
+
unitOfValue: null
|
|
461
|
+
};
|
|
462
|
+
if (typeof v === "number")
|
|
463
|
+
return { value: v, parsedUnit: null, unitOfValue: null };
|
|
464
|
+
if (typeof v === "object" && "x" in v && "y" in v) {
|
|
465
|
+
const firstResult = parseAndConvertSiUnit(v.x, unitOfValue);
|
|
466
|
+
const xResult = parseAndConvertSiUnit(v.x, unitOfValue);
|
|
467
|
+
const yResult = parseAndConvertSiUnit(v.y, unitOfValue);
|
|
468
|
+
if (xResult.value === null || yResult.value === null) {
|
|
469
|
+
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
parsedUnit: firstResult.parsedUnit,
|
|
473
|
+
unitOfValue: firstResult.unitOfValue,
|
|
474
|
+
value: {
|
|
475
|
+
x: xResult.value,
|
|
476
|
+
y: yResult.value
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
const reversedInputString = v.toString().split("").reverse().join("");
|
|
481
|
+
const unitReversed = reversedInputString.match(/[^\d\s]+/)?.[0];
|
|
482
|
+
if (!unitReversed) {
|
|
483
|
+
throw new Error(`Could not determine unit: "${v}"`);
|
|
484
|
+
}
|
|
485
|
+
const unit = unitReversed.split("").reverse().join("");
|
|
486
|
+
const numberPart = v.slice(0, -unit.length);
|
|
487
|
+
const bareSiPrefixMultiplier = getSiPrefixMultiplier(unit);
|
|
488
|
+
if (unitOfValue && bareSiPrefixMultiplier != null) {
|
|
489
|
+
return {
|
|
490
|
+
parsedUnit: null,
|
|
491
|
+
unitOfValue,
|
|
492
|
+
value: Number.parseFloat(numberPart) * bareSiPrefixMultiplier
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
if (bareSiPrefixMultiplier != null && !unitMappingAndVariantSuffixes.has(unit)) {
|
|
496
|
+
return {
|
|
497
|
+
parsedUnit: null,
|
|
498
|
+
unitOfValue: null,
|
|
499
|
+
value: Number.parseFloat(numberPart) * bareSiPrefixMultiplier
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
const { baseUnit, conversionFactor } = getBaseTscircuitUnit(unit);
|
|
503
|
+
return {
|
|
504
|
+
parsedUnit: unit,
|
|
505
|
+
unitOfValue: baseUnit,
|
|
506
|
+
value: conversionFactor * Number.parseFloat(numberPart)
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
var SI_PREFIX_PATTERN = SI_PREFIXES.filter((prefix) => prefix !== "").sort((a, b) => b.length - a.length).map((prefix) => prefix.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
510
|
+
var SI_UNIT_PATTERN = new RegExp(
|
|
511
|
+
`^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)(?:(${SI_PREFIX_PATTERN}))?$`
|
|
512
|
+
);
|
|
513
|
+
var SI_PREFIXES2 = [
|
|
514
|
+
{ value: 1e12, symbol: "T" },
|
|
515
|
+
{ value: 1e9, symbol: "G" },
|
|
516
|
+
{ value: 1e6, symbol: "M" },
|
|
517
|
+
{ value: 1e3, symbol: "k" },
|
|
518
|
+
{ value: 1, symbol: "" },
|
|
519
|
+
{ value: 1e-3, symbol: "m" },
|
|
520
|
+
{ value: 1e-6, symbol: "\xB5" },
|
|
521
|
+
{ value: 1e-9, symbol: "n" },
|
|
522
|
+
{ value: 1e-12, symbol: "p" }
|
|
523
|
+
];
|
|
524
|
+
var FALLBACK_PREFIX = SI_PREFIXES2[SI_PREFIXES2.length - 1];
|
|
237
525
|
var external_exports = {};
|
|
238
526
|
__export(external_exports, {
|
|
239
527
|
BRAND: () => BRAND,
|
|
@@ -4243,236 +4531,32 @@ var promiseType = ZodPromise.create;
|
|
|
4243
4531
|
var effectsType = ZodEffects.create;
|
|
4244
4532
|
var optionalType = ZodOptional.create;
|
|
4245
4533
|
var nullableType = ZodNullable.create;
|
|
4246
|
-
var preprocessType = ZodEffects.createWithPreprocess;
|
|
4247
|
-
var pipelineType = ZodPipeline.create;
|
|
4248
|
-
var ostring = () => stringType().optional();
|
|
4249
|
-
var onumber = () => numberType().optional();
|
|
4250
|
-
var oboolean = () => booleanType().optional();
|
|
4251
|
-
var coerce = {
|
|
4252
|
-
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
4253
|
-
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
4254
|
-
boolean: (arg) => ZodBoolean.create({
|
|
4255
|
-
...arg,
|
|
4256
|
-
coerce: true
|
|
4257
|
-
}),
|
|
4258
|
-
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
4259
|
-
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
4260
|
-
};
|
|
4261
|
-
var NEVER = INVALID;
|
|
4262
|
-
var
|
|
4263
|
-
|
|
4264
|
-
baseUnit: "Hz",
|
|
4265
|
-
variants: {
|
|
4266
|
-
MHz: 1e6,
|
|
4267
|
-
kHz: 1e3,
|
|
4268
|
-
Hz: 1
|
|
4269
|
-
}
|
|
4270
|
-
},
|
|
4271
|
-
g: {
|
|
4272
|
-
baseUnit: "g",
|
|
4273
|
-
variants: {
|
|
4274
|
-
kg: 1e3,
|
|
4275
|
-
g: 1
|
|
4276
|
-
}
|
|
4277
|
-
},
|
|
4278
|
-
\u03A9: {
|
|
4279
|
-
baseUnit: "\u03A9",
|
|
4280
|
-
variants: {
|
|
4281
|
-
m\u03A9: 1e-3,
|
|
4282
|
-
\u03A9: 1,
|
|
4283
|
-
k\u03A9: 1e3,
|
|
4284
|
-
K\u03A9: 1e3,
|
|
4285
|
-
kohm: 1e3,
|
|
4286
|
-
M\u03A9: 1e6,
|
|
4287
|
-
G\u03A9: 1e9,
|
|
4288
|
-
T\u03A9: 1e12
|
|
4289
|
-
}
|
|
4290
|
-
},
|
|
4291
|
-
V: {
|
|
4292
|
-
baseUnit: "V",
|
|
4293
|
-
variants: {
|
|
4294
|
-
mV: 1e-3,
|
|
4295
|
-
V: 1,
|
|
4296
|
-
kV: 1e3,
|
|
4297
|
-
KV: 1e3,
|
|
4298
|
-
MV: 1e6,
|
|
4299
|
-
GV: 1e9,
|
|
4300
|
-
TV: 1e12
|
|
4301
|
-
}
|
|
4302
|
-
},
|
|
4303
|
-
A: {
|
|
4304
|
-
baseUnit: "A",
|
|
4305
|
-
variants: {
|
|
4306
|
-
\u00B5A: 1e-6,
|
|
4307
|
-
mA: 1e-3,
|
|
4308
|
-
ma: 1e-3,
|
|
4309
|
-
A: 1,
|
|
4310
|
-
kA: 1e3,
|
|
4311
|
-
MA: 1e6
|
|
4312
|
-
}
|
|
4313
|
-
},
|
|
4314
|
-
F: {
|
|
4315
|
-
baseUnit: "F",
|
|
4316
|
-
variants: {
|
|
4317
|
-
pF: 1e-12,
|
|
4318
|
-
nF: 1e-9,
|
|
4319
|
-
\u00B5F: 1e-6,
|
|
4320
|
-
uF: 1e-6,
|
|
4321
|
-
mF: 1e-3,
|
|
4322
|
-
F: 1
|
|
4323
|
-
}
|
|
4324
|
-
},
|
|
4325
|
-
ml: {
|
|
4326
|
-
baseUnit: "ml",
|
|
4327
|
-
variants: {
|
|
4328
|
-
ml: 1,
|
|
4329
|
-
mL: 1,
|
|
4330
|
-
l: 1e3,
|
|
4331
|
-
L: 1e3
|
|
4332
|
-
}
|
|
4333
|
-
},
|
|
4334
|
-
deg: {
|
|
4335
|
-
baseUnit: "deg",
|
|
4336
|
-
variants: {
|
|
4337
|
-
rad: 180 / Math.PI
|
|
4338
|
-
}
|
|
4339
|
-
},
|
|
4340
|
-
ms: {
|
|
4341
|
-
baseUnit: "ms",
|
|
4342
|
-
variants: {
|
|
4343
|
-
fs: 1e-12,
|
|
4344
|
-
ps: 1e-9,
|
|
4345
|
-
ns: 1e-6,
|
|
4346
|
-
us: 1e-3,
|
|
4347
|
-
\u00B5s: 1e-3,
|
|
4348
|
-
ms: 1,
|
|
4349
|
-
s: 1e3
|
|
4350
|
-
}
|
|
4351
|
-
},
|
|
4352
|
-
mm: {
|
|
4353
|
-
baseUnit: "mm",
|
|
4354
|
-
variants: {
|
|
4355
|
-
nm: 1e-6,
|
|
4356
|
-
\u00B5m: 1e-3,
|
|
4357
|
-
um: 1e-3,
|
|
4358
|
-
mm: 1,
|
|
4359
|
-
cm: 10,
|
|
4360
|
-
dm: 100,
|
|
4361
|
-
m: 1e3,
|
|
4362
|
-
km: 1e6,
|
|
4363
|
-
in: 25.4,
|
|
4364
|
-
ft: 304.8,
|
|
4365
|
-
IN: 25.4,
|
|
4366
|
-
FT: 304.8,
|
|
4367
|
-
yd: 914.4,
|
|
4368
|
-
mi: 1609344,
|
|
4369
|
-
mil: 0.0254
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
};
|
|
4373
|
-
var unitMappingAndVariantSuffixes = /* @__PURE__ */ new Set();
|
|
4374
|
-
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
4375
|
-
unitMappingAndVariantSuffixes.add(baseUnit);
|
|
4376
|
-
for (const variant of Object.keys(info.variants)) {
|
|
4377
|
-
unitMappingAndVariantSuffixes.add(variant);
|
|
4378
|
-
}
|
|
4379
|
-
}
|
|
4380
|
-
function getBaseTscircuitUnit(unit) {
|
|
4381
|
-
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
4382
|
-
if (unit in info.variants) {
|
|
4383
|
-
return {
|
|
4384
|
-
baseUnit: info.baseUnit,
|
|
4385
|
-
conversionFactor: info.variants[unit]
|
|
4386
|
-
};
|
|
4387
|
-
}
|
|
4388
|
-
}
|
|
4389
|
-
return {
|
|
4390
|
-
baseUnit: unit,
|
|
4391
|
-
conversionFactor: 1
|
|
4392
|
-
};
|
|
4393
|
-
}
|
|
4394
|
-
var si_prefix_multiplier = {
|
|
4395
|
-
tera: 1e12,
|
|
4396
|
-
T: 1e12,
|
|
4397
|
-
giga: 1e9,
|
|
4398
|
-
G: 1e9,
|
|
4399
|
-
mega: 1e6,
|
|
4400
|
-
M: 1e6,
|
|
4401
|
-
kilo: 1e3,
|
|
4402
|
-
k: 1e3,
|
|
4403
|
-
deci: 0.1,
|
|
4404
|
-
d: 0.1,
|
|
4405
|
-
centi: 0.01,
|
|
4406
|
-
c: 0.01,
|
|
4407
|
-
milli: 1e-3,
|
|
4408
|
-
m: 1e-3,
|
|
4409
|
-
micro: 1e-6,
|
|
4410
|
-
u: 1e-6,
|
|
4411
|
-
\u00B5: 1e-6,
|
|
4412
|
-
nano: 1e-9,
|
|
4413
|
-
n: 1e-9,
|
|
4414
|
-
pico: 1e-12,
|
|
4415
|
-
p: 1e-12
|
|
4416
|
-
};
|
|
4417
|
-
function parseAndConvertSiUnit(v) {
|
|
4418
|
-
if (v === void 0 || v === null)
|
|
4419
|
-
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
4420
|
-
if (typeof v === "string" && v.match(/^-?[\d\.]+$/))
|
|
4421
|
-
return {
|
|
4422
|
-
value: Number.parseFloat(v),
|
|
4423
|
-
parsedUnit: null,
|
|
4424
|
-
unitOfValue: null
|
|
4425
|
-
};
|
|
4426
|
-
if (typeof v === "number")
|
|
4427
|
-
return { value: v, parsedUnit: null, unitOfValue: null };
|
|
4428
|
-
if (typeof v === "object" && "x" in v && "y" in v) {
|
|
4429
|
-
const { parsedUnit, unitOfValue } = parseAndConvertSiUnit(v.x);
|
|
4430
|
-
const xResult = parseAndConvertSiUnit(v.x);
|
|
4431
|
-
const yResult = parseAndConvertSiUnit(v.y);
|
|
4432
|
-
if (xResult.value === null || yResult.value === null) {
|
|
4433
|
-
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
4434
|
-
}
|
|
4435
|
-
return {
|
|
4436
|
-
parsedUnit,
|
|
4437
|
-
unitOfValue,
|
|
4438
|
-
value: {
|
|
4439
|
-
x: xResult.value,
|
|
4440
|
-
y: yResult.value
|
|
4441
|
-
}
|
|
4442
|
-
};
|
|
4443
|
-
}
|
|
4444
|
-
const reversed_input_string = v.toString().split("").reverse().join("");
|
|
4445
|
-
const unit_reversed = reversed_input_string.match(/[^\d\s]+/)?.[0];
|
|
4446
|
-
if (!unit_reversed) {
|
|
4447
|
-
throw new Error(`Could not determine unit: "${v}"`);
|
|
4448
|
-
}
|
|
4449
|
-
const unit = unit_reversed.split("").reverse().join("");
|
|
4450
|
-
const numberPart = v.slice(0, -unit.length);
|
|
4451
|
-
if (unit in si_prefix_multiplier && !unitMappingAndVariantSuffixes.has(unit)) {
|
|
4452
|
-
const siMultiplier = si_prefix_multiplier[unit];
|
|
4453
|
-
return {
|
|
4454
|
-
parsedUnit: null,
|
|
4455
|
-
unitOfValue: null,
|
|
4456
|
-
value: Number.parseFloat(numberPart) * siMultiplier
|
|
4457
|
-
};
|
|
4458
|
-
}
|
|
4459
|
-
const { baseUnit, conversionFactor } = getBaseTscircuitUnit(unit);
|
|
4460
|
-
return {
|
|
4461
|
-
parsedUnit: unit,
|
|
4462
|
-
unitOfValue: baseUnit,
|
|
4463
|
-
value: conversionFactor * Number.parseFloat(numberPart)
|
|
4464
|
-
};
|
|
4465
|
-
}
|
|
4466
|
-
var resistance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4467
|
-
var capacitance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value).transform((value) => {
|
|
4534
|
+
var preprocessType = ZodEffects.createWithPreprocess;
|
|
4535
|
+
var pipelineType = ZodPipeline.create;
|
|
4536
|
+
var ostring = () => stringType().optional();
|
|
4537
|
+
var onumber = () => numberType().optional();
|
|
4538
|
+
var oboolean = () => booleanType().optional();
|
|
4539
|
+
var coerce = {
|
|
4540
|
+
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
4541
|
+
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
4542
|
+
boolean: (arg) => ZodBoolean.create({
|
|
4543
|
+
...arg,
|
|
4544
|
+
coerce: true
|
|
4545
|
+
}),
|
|
4546
|
+
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
4547
|
+
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
4548
|
+
};
|
|
4549
|
+
var NEVER = INVALID;
|
|
4550
|
+
var resistance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v, "\u03A9").value);
|
|
4551
|
+
var capacitance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v, "F").value).transform((value) => {
|
|
4468
4552
|
return Number.parseFloat(value.toPrecision(12));
|
|
4469
4553
|
});
|
|
4470
|
-
var inductance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4471
|
-
var voltage = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4554
|
+
var inductance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v, "H").value);
|
|
4555
|
+
var voltage = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v, "V").value);
|
|
4472
4556
|
var length = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4473
|
-
var frequency = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4557
|
+
var frequency = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v, "Hz").value);
|
|
4474
4558
|
var distance = length;
|
|
4475
|
-
var current = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4559
|
+
var current = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v, "A").value);
|
|
4476
4560
|
var duration_ms = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4477
4561
|
var time = duration_ms;
|
|
4478
4562
|
var ms = duration_ms;
|
|
@@ -4785,6 +4869,16 @@ var source_simple_current_source = source_component_base.extend({
|
|
|
4785
4869
|
expectTypesMatch(
|
|
4786
4870
|
true
|
|
4787
4871
|
);
|
|
4872
|
+
var source_simple_fuse = source_component_base.extend({
|
|
4873
|
+
ftype: external_exports.literal("simple_fuse"),
|
|
4874
|
+
current_rating_amps: external_exports.number().describe("Nominal current in amps the fuse is rated for"),
|
|
4875
|
+
voltage_rating_volts: external_exports.number().describe("Voltage rating in volts, e.g. \xB15V would be 5")
|
|
4876
|
+
});
|
|
4877
|
+
expectTypesMatch(true);
|
|
4878
|
+
var source_simple_ammeter = source_component_base.extend({
|
|
4879
|
+
ftype: external_exports.literal("simple_ammeter")
|
|
4880
|
+
});
|
|
4881
|
+
expectTypesMatch(true);
|
|
4788
4882
|
var source_pin_attributes = external_exports.object({
|
|
4789
4883
|
must_be_connected: external_exports.boolean().optional(),
|
|
4790
4884
|
provides_power: external_exports.boolean().optional(),
|
|
@@ -4825,12 +4919,6 @@ var source_pin_attributes = external_exports.object({
|
|
|
4825
4919
|
supports_uart_rx: external_exports.boolean().optional()
|
|
4826
4920
|
});
|
|
4827
4921
|
expectTypesMatch(true);
|
|
4828
|
-
var source_simple_fuse = source_component_base.extend({
|
|
4829
|
-
ftype: external_exports.literal("simple_fuse"),
|
|
4830
|
-
current_rating_amps: external_exports.number().describe("Nominal current in amps the fuse is rated for"),
|
|
4831
|
-
voltage_rating_volts: external_exports.number().describe("Voltage rating in volts, e.g. \xB15V would be 5")
|
|
4832
|
-
});
|
|
4833
|
-
expectTypesMatch(true);
|
|
4834
4922
|
var source_simple_battery = source_component_base.extend({
|
|
4835
4923
|
ftype: external_exports.literal("simple_battery"),
|
|
4836
4924
|
capacity: battery_capacity
|
|
@@ -4839,6 +4927,7 @@ expectTypesMatch(true);
|
|
|
4839
4927
|
var source_simple_inductor = source_component_base.extend({
|
|
4840
4928
|
ftype: external_exports.literal("simple_inductor"),
|
|
4841
4929
|
inductance,
|
|
4930
|
+
display_inductance: external_exports.string().optional(),
|
|
4842
4931
|
max_current_rating: external_exports.number().optional()
|
|
4843
4932
|
});
|
|
4844
4933
|
expectTypesMatch(true);
|
|
@@ -5002,6 +5091,37 @@ var source_pin_missing_trace_warning = external_exports.object({
|
|
|
5002
5091
|
"Warning emitted when a source component pin is missing a trace connection"
|
|
5003
5092
|
);
|
|
5004
5093
|
expectTypesMatch(true);
|
|
5094
|
+
var source_missing_manufacturer_part_number_warning = external_exports.object({
|
|
5095
|
+
type: external_exports.literal("source_missing_manufacturer_part_number_warning"),
|
|
5096
|
+
source_missing_manufacturer_part_number_warning_id: getZodPrefixedIdWithDefault(
|
|
5097
|
+
"source_missing_manufacturer_part_number_warning"
|
|
5098
|
+
),
|
|
5099
|
+
warning_type: external_exports.literal("source_missing_manufacturer_part_number_warning").default("source_missing_manufacturer_part_number_warning"),
|
|
5100
|
+
message: external_exports.string(),
|
|
5101
|
+
source_component_id: external_exports.string(),
|
|
5102
|
+
standard: external_exports.string(),
|
|
5103
|
+
subcircuit_id: external_exports.string().optional()
|
|
5104
|
+
}).describe(
|
|
5105
|
+
"Warning emitted when a standard connector is missing manufacturer part number"
|
|
5106
|
+
);
|
|
5107
|
+
expectTypesMatch(true);
|
|
5108
|
+
var source_refdes_convention_warning = external_exports.object({
|
|
5109
|
+
type: external_exports.literal("source_refdes_convention_warning"),
|
|
5110
|
+
source_refdes_convention_warning_id: getZodPrefixedIdWithDefault(
|
|
5111
|
+
"source_refdes_convention_warning"
|
|
5112
|
+
),
|
|
5113
|
+
warning_type: external_exports.literal("source_refdes_convention_warning").default("source_refdes_convention_warning"),
|
|
5114
|
+
message: external_exports.string(),
|
|
5115
|
+
source_component_id: external_exports.string(),
|
|
5116
|
+
refdes: external_exports.string(),
|
|
5117
|
+
source_component_ftype: external_exports.string(),
|
|
5118
|
+
expected_prefixes: external_exports.array(external_exports.string()),
|
|
5119
|
+
actual_prefix: external_exports.string().optional(),
|
|
5120
|
+
subcircuit_id: external_exports.string().optional()
|
|
5121
|
+
}).describe(
|
|
5122
|
+
"Warning emitted when a source component reference designator does not match the component type convention"
|
|
5123
|
+
);
|
|
5124
|
+
expectTypesMatch(true);
|
|
5005
5125
|
var source_simple_voltage_probe = source_component_base.extend({
|
|
5006
5126
|
ftype: external_exports.literal("simple_voltage_probe")
|
|
5007
5127
|
});
|
|
@@ -5023,6 +5143,18 @@ var source_i2c_misconfigured_error = base_circuit_json_error.extend({
|
|
|
5023
5143
|
"Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net"
|
|
5024
5144
|
);
|
|
5025
5145
|
expectTypesMatch(true);
|
|
5146
|
+
var source_component_misconfigured_error = base_circuit_json_error.extend({
|
|
5147
|
+
type: external_exports.literal("source_component_misconfigured_error"),
|
|
5148
|
+
source_component_misconfigured_error_id: getZodPrefixedIdWithDefault(
|
|
5149
|
+
"source_component_misconfigured_error"
|
|
5150
|
+
),
|
|
5151
|
+
error_type: external_exports.literal("source_component_misconfigured_error").default("source_component_misconfigured_error"),
|
|
5152
|
+
source_component_ids: external_exports.array(external_exports.string()),
|
|
5153
|
+
source_port_ids: external_exports.array(external_exports.string()).optional()
|
|
5154
|
+
}).describe(
|
|
5155
|
+
"Error emitted when one or more source components have an invalid or conflicting configuration"
|
|
5156
|
+
);
|
|
5157
|
+
expectTypesMatch(true);
|
|
5026
5158
|
var source_simple_voltage_source = source_component_base.extend({
|
|
5027
5159
|
ftype: external_exports.literal("simple_voltage_source"),
|
|
5028
5160
|
voltage,
|
|
@@ -5030,7 +5162,12 @@ var source_simple_voltage_source = source_component_base.extend({
|
|
|
5030
5162
|
peak_to_peak_voltage: voltage.optional(),
|
|
5031
5163
|
wave_shape: external_exports.enum(["sinewave", "square", "triangle", "sawtooth"]).optional(),
|
|
5032
5164
|
phase: rotation.optional(),
|
|
5033
|
-
duty_cycle: external_exports.number().optional().describe("Duty cycle as a fraction (0 to 1)")
|
|
5165
|
+
duty_cycle: external_exports.number().optional().describe("Duty cycle as a fraction (0 to 1)"),
|
|
5166
|
+
pulse_delay: ms.optional(),
|
|
5167
|
+
rise_time: ms.optional(),
|
|
5168
|
+
fall_time: ms.optional(),
|
|
5169
|
+
pulse_width: ms.optional(),
|
|
5170
|
+
period: ms.optional()
|
|
5034
5171
|
});
|
|
5035
5172
|
expectTypesMatch(
|
|
5036
5173
|
true
|
|
@@ -5045,6 +5182,7 @@ var any_source_component = external_exports.union([
|
|
|
5045
5182
|
source_simple_chip,
|
|
5046
5183
|
source_simple_power_source,
|
|
5047
5184
|
source_simple_current_source,
|
|
5185
|
+
source_simple_ammeter,
|
|
5048
5186
|
source_simple_battery,
|
|
5049
5187
|
source_simple_inductor,
|
|
5050
5188
|
source_simple_push_button,
|
|
@@ -5070,7 +5208,10 @@ var any_source_component = external_exports.union([
|
|
|
5070
5208
|
source_trace_not_connected_error,
|
|
5071
5209
|
source_property_ignored_warning,
|
|
5072
5210
|
source_pin_missing_trace_warning,
|
|
5073
|
-
|
|
5211
|
+
source_missing_manufacturer_part_number_warning,
|
|
5212
|
+
source_refdes_convention_warning,
|
|
5213
|
+
source_i2c_misconfigured_error,
|
|
5214
|
+
source_component_misconfigured_error
|
|
5074
5215
|
]);
|
|
5075
5216
|
expectTypesMatch(true);
|
|
5076
5217
|
var source_port = external_exports.object({
|
|
@@ -5102,6 +5243,7 @@ var source_trace = external_exports.object({
|
|
|
5102
5243
|
subcircuit_id: external_exports.string().optional(),
|
|
5103
5244
|
subcircuit_connectivity_map_key: external_exports.string().optional(),
|
|
5104
5245
|
max_length: external_exports.number().optional(),
|
|
5246
|
+
name: external_exports.string().optional(),
|
|
5105
5247
|
min_trace_thickness: external_exports.number().optional(),
|
|
5106
5248
|
display_name: external_exports.string().optional()
|
|
5107
5249
|
});
|
|
@@ -5192,6 +5334,19 @@ var source_manually_placed_via = external_exports.object({
|
|
|
5192
5334
|
source_trace_id: external_exports.string().optional()
|
|
5193
5335
|
}).describe("Defines a via that is manually placed in the source domain");
|
|
5194
5336
|
expectTypesMatch(true);
|
|
5337
|
+
var source_unnamed_trace_warning = external_exports.object({
|
|
5338
|
+
type: external_exports.literal("source_unnamed_trace_warning"),
|
|
5339
|
+
source_unnamed_trace_warning_id: getZodPrefixedIdWithDefault(
|
|
5340
|
+
"source_unnamed_trace_warning"
|
|
5341
|
+
),
|
|
5342
|
+
warning_type: external_exports.literal("source_unnamed_trace_warning").default("source_unnamed_trace_warning"),
|
|
5343
|
+
message: external_exports.string(),
|
|
5344
|
+
source_trace_id: external_exports.string(),
|
|
5345
|
+
subcircuit_id: external_exports.string().optional()
|
|
5346
|
+
}).describe("Warning emitted when a source trace is missing a name");
|
|
5347
|
+
expectTypesMatch(
|
|
5348
|
+
true
|
|
5349
|
+
);
|
|
5195
5350
|
var source_no_power_pin_defined_warning = external_exports.object({
|
|
5196
5351
|
type: external_exports.literal("source_no_power_pin_defined_warning"),
|
|
5197
5352
|
source_no_power_pin_defined_warning_id: getZodPrefixedIdWithDefault(
|
|
@@ -5259,8 +5414,26 @@ var unknown_error_finding_part = base_circuit_json_error.extend({
|
|
|
5259
5414
|
"Error emitted when an unexpected error occurs while finding a part"
|
|
5260
5415
|
);
|
|
5261
5416
|
expectTypesMatch(true);
|
|
5417
|
+
var source_part_not_found_warning = external_exports.object({
|
|
5418
|
+
type: external_exports.literal("source_part_not_found_warning"),
|
|
5419
|
+
source_part_not_found_warning_id: getZodPrefixedIdWithDefault(
|
|
5420
|
+
"source_part_not_found_warning"
|
|
5421
|
+
),
|
|
5422
|
+
warning_type: external_exports.literal("source_part_not_found_warning").default("source_part_not_found_warning"),
|
|
5423
|
+
message: external_exports.string(),
|
|
5424
|
+
source_component_id: external_exports.string().optional(),
|
|
5425
|
+
subcircuit_id: external_exports.string().optional(),
|
|
5426
|
+
supplier_name: supplier_name.optional(),
|
|
5427
|
+
manufacturer_part_number: external_exports.string().optional(),
|
|
5428
|
+
supplier_part_number: external_exports.string().optional(),
|
|
5429
|
+
part_name: external_exports.string().optional()
|
|
5430
|
+
}).describe("Warning emitted when a requested part can not be found");
|
|
5431
|
+
expectTypesMatch(
|
|
5432
|
+
true
|
|
5433
|
+
);
|
|
5262
5434
|
var schematic_box = external_exports.object({
|
|
5263
5435
|
type: external_exports.literal("schematic_box"),
|
|
5436
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5264
5437
|
schematic_component_id: external_exports.string().optional(),
|
|
5265
5438
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5266
5439
|
width: distance,
|
|
@@ -5274,12 +5447,16 @@ expectTypesMatch(true);
|
|
|
5274
5447
|
var schematic_path = external_exports.object({
|
|
5275
5448
|
type: external_exports.literal("schematic_path"),
|
|
5276
5449
|
schematic_path_id: getZodPrefixedIdWithDefault("schematic_path"),
|
|
5450
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5277
5451
|
schematic_component_id: external_exports.string().optional(),
|
|
5278
5452
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5279
5453
|
fill_color: external_exports.string().optional(),
|
|
5280
5454
|
is_filled: external_exports.boolean().optional(),
|
|
5455
|
+
is_dashed: external_exports.boolean().default(false),
|
|
5281
5456
|
stroke_width: distance.nullable().optional(),
|
|
5282
5457
|
stroke_color: external_exports.string().optional(),
|
|
5458
|
+
dash_length: distance.optional(),
|
|
5459
|
+
dash_gap: distance.optional(),
|
|
5283
5460
|
points: external_exports.array(point),
|
|
5284
5461
|
subcircuit_id: external_exports.string().optional()
|
|
5285
5462
|
});
|
|
@@ -5332,6 +5509,7 @@ var schematic_component = external_exports.object({
|
|
|
5332
5509
|
center: point,
|
|
5333
5510
|
source_component_id: external_exports.string().optional(),
|
|
5334
5511
|
schematic_component_id: external_exports.string(),
|
|
5512
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5335
5513
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5336
5514
|
pin_spacing: length.optional(),
|
|
5337
5515
|
pin_styles: schematic_pin_styles.optional(),
|
|
@@ -5362,6 +5540,7 @@ expectTypesMatch(true);
|
|
|
5362
5540
|
var schematic_line = external_exports.object({
|
|
5363
5541
|
type: external_exports.literal("schematic_line"),
|
|
5364
5542
|
schematic_line_id: getZodPrefixedIdWithDefault("schematic_line"),
|
|
5543
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5365
5544
|
schematic_component_id: external_exports.string().optional(),
|
|
5366
5545
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5367
5546
|
x1: distance,
|
|
@@ -5371,12 +5550,15 @@ var schematic_line = external_exports.object({
|
|
|
5371
5550
|
stroke_width: distance.nullable().optional(),
|
|
5372
5551
|
color: external_exports.string().default("#000000"),
|
|
5373
5552
|
is_dashed: external_exports.boolean().default(false),
|
|
5553
|
+
dash_length: distance.optional(),
|
|
5554
|
+
dash_gap: distance.optional(),
|
|
5374
5555
|
subcircuit_id: external_exports.string().optional()
|
|
5375
5556
|
}).describe("Draws a styled line on the schematic");
|
|
5376
5557
|
expectTypesMatch(true);
|
|
5377
5558
|
var schematic_rect = external_exports.object({
|
|
5378
5559
|
type: external_exports.literal("schematic_rect"),
|
|
5379
5560
|
schematic_rect_id: getZodPrefixedIdWithDefault("schematic_rect"),
|
|
5561
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5380
5562
|
schematic_component_id: external_exports.string().optional(),
|
|
5381
5563
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5382
5564
|
center: point,
|
|
@@ -5394,6 +5576,7 @@ expectTypesMatch(true);
|
|
|
5394
5576
|
var schematic_circle = external_exports.object({
|
|
5395
5577
|
type: external_exports.literal("schematic_circle"),
|
|
5396
5578
|
schematic_circle_id: getZodPrefixedIdWithDefault("schematic_circle"),
|
|
5579
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5397
5580
|
schematic_component_id: external_exports.string().optional(),
|
|
5398
5581
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5399
5582
|
center: point,
|
|
@@ -5409,6 +5592,7 @@ expectTypesMatch(true);
|
|
|
5409
5592
|
var schematic_arc = external_exports.object({
|
|
5410
5593
|
type: external_exports.literal("schematic_arc"),
|
|
5411
5594
|
schematic_arc_id: getZodPrefixedIdWithDefault("schematic_arc"),
|
|
5595
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5412
5596
|
schematic_component_id: external_exports.string().optional(),
|
|
5413
5597
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5414
5598
|
center: point,
|
|
@@ -5425,6 +5609,7 @@ expectTypesMatch(true);
|
|
|
5425
5609
|
var schematic_trace = external_exports.object({
|
|
5426
5610
|
type: external_exports.literal("schematic_trace"),
|
|
5427
5611
|
schematic_trace_id: external_exports.string(),
|
|
5612
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5428
5613
|
source_trace_id: external_exports.string().optional(),
|
|
5429
5614
|
junctions: external_exports.array(
|
|
5430
5615
|
external_exports.object({
|
|
@@ -5462,6 +5647,7 @@ var fivePointAnchor = external_exports.enum([
|
|
|
5462
5647
|
expectTypesMatch(true);
|
|
5463
5648
|
var schematic_text = external_exports.object({
|
|
5464
5649
|
type: external_exports.literal("schematic_text"),
|
|
5650
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5465
5651
|
schematic_component_id: external_exports.string().optional(),
|
|
5466
5652
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5467
5653
|
schematic_text_id: external_exports.string(),
|
|
@@ -5481,6 +5667,7 @@ var schematic_port = external_exports.object({
|
|
|
5481
5667
|
type: external_exports.literal("schematic_port"),
|
|
5482
5668
|
schematic_port_id: external_exports.string(),
|
|
5483
5669
|
source_port_id: external_exports.string(),
|
|
5670
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5484
5671
|
schematic_component_id: external_exports.string().optional(),
|
|
5485
5672
|
center: point,
|
|
5486
5673
|
facing_direction: external_exports.enum(["up", "down", "left", "right"]).optional(),
|
|
@@ -5499,6 +5686,7 @@ expectTypesMatch(true);
|
|
|
5499
5686
|
var schematic_net_label = external_exports.object({
|
|
5500
5687
|
type: external_exports.literal("schematic_net_label"),
|
|
5501
5688
|
schematic_net_label_id: getZodPrefixedIdWithDefault("schematic_net_label"),
|
|
5689
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5502
5690
|
schematic_trace_id: external_exports.string().optional(),
|
|
5503
5691
|
source_trace_id: external_exports.string().optional(),
|
|
5504
5692
|
source_net_id: external_exports.string(),
|
|
@@ -5558,6 +5746,7 @@ expectTypesMatch(true);
|
|
|
5558
5746
|
var schematic_voltage_probe = external_exports.object({
|
|
5559
5747
|
type: external_exports.literal("schematic_voltage_probe"),
|
|
5560
5748
|
schematic_voltage_probe_id: external_exports.string(),
|
|
5749
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5561
5750
|
source_component_id: external_exports.string().optional(),
|
|
5562
5751
|
name: external_exports.string().optional(),
|
|
5563
5752
|
position: point,
|
|
@@ -5586,6 +5775,7 @@ expectTypesMatch(true);
|
|
|
5586
5775
|
var schematic_group = external_exports.object({
|
|
5587
5776
|
type: external_exports.literal("schematic_group"),
|
|
5588
5777
|
schematic_group_id: getZodPrefixedIdWithDefault("schematic_group"),
|
|
5778
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5589
5779
|
source_group_id: external_exports.string(),
|
|
5590
5780
|
is_subcircuit: external_exports.boolean().optional(),
|
|
5591
5781
|
subcircuit_id: external_exports.string().optional(),
|
|
@@ -5601,6 +5791,7 @@ expectTypesMatch(true);
|
|
|
5601
5791
|
var schematic_table = external_exports.object({
|
|
5602
5792
|
type: external_exports.literal("schematic_table"),
|
|
5603
5793
|
schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
|
|
5794
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5604
5795
|
anchor_position: point,
|
|
5605
5796
|
column_widths: external_exports.array(distance),
|
|
5606
5797
|
row_heights: external_exports.array(distance),
|
|
@@ -5616,6 +5807,7 @@ var schematic_table_cell = external_exports.object({
|
|
|
5616
5807
|
schematic_table_cell_id: getZodPrefixedIdWithDefault(
|
|
5617
5808
|
"schematic_table_cell"
|
|
5618
5809
|
),
|
|
5810
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5619
5811
|
schematic_table_id: external_exports.string(),
|
|
5620
5812
|
start_row_index: external_exports.number(),
|
|
5621
5813
|
end_row_index: external_exports.number(),
|
|
@@ -5635,7 +5827,9 @@ var schematic_sheet = external_exports.object({
|
|
|
5635
5827
|
type: external_exports.literal("schematic_sheet"),
|
|
5636
5828
|
schematic_sheet_id: getZodPrefixedIdWithDefault("schematic_sheet"),
|
|
5637
5829
|
name: external_exports.string().optional(),
|
|
5638
|
-
|
|
5830
|
+
sheet_index: external_exports.number().optional(),
|
|
5831
|
+
subcircuit_id: external_exports.string().optional(),
|
|
5832
|
+
outline_color: external_exports.string().optional()
|
|
5639
5833
|
}).describe(
|
|
5640
5834
|
"Defines a schematic sheet or page that components can be placed on"
|
|
5641
5835
|
);
|
|
@@ -5672,6 +5866,19 @@ var route_hint_point = external_exports.object({
|
|
|
5672
5866
|
trace_width: distance.optional()
|
|
5673
5867
|
});
|
|
5674
5868
|
expectTypesMatch(true);
|
|
5869
|
+
var manufacturing_drc_properties = external_exports.object({
|
|
5870
|
+
min_trace_width: length.optional(),
|
|
5871
|
+
min_board_edge_clearance: length.optional(),
|
|
5872
|
+
min_via_hole_edge_to_via_hole_edge_clearance: length.optional(),
|
|
5873
|
+
min_plated_hole_drill_edge_to_drill_edge_clearance: length.optional(),
|
|
5874
|
+
min_trace_to_pad_edge_clearance: length.optional(),
|
|
5875
|
+
min_pad_edge_to_pad_edge_clearance: length.optional(),
|
|
5876
|
+
min_same_net_trace_edge_to_trace_edge_clearance: length.optional(),
|
|
5877
|
+
min_different_net_trace_edge_to_trace_edge_clearance: length.optional(),
|
|
5878
|
+
min_via_edge_to_pad_edge_clearance: length.optional(),
|
|
5879
|
+
min_via_hole_diameter: length.optional(),
|
|
5880
|
+
min_via_pad_diameter: length.optional()
|
|
5881
|
+
});
|
|
5675
5882
|
var pcb_component = external_exports.object({
|
|
5676
5883
|
type: external_exports.literal("pcb_component"),
|
|
5677
5884
|
pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
|
|
@@ -5702,6 +5909,13 @@ var pcb_component = external_exports.object({
|
|
|
5702
5909
|
positioned_relative_to_pcb_group_id: external_exports.string().optional(),
|
|
5703
5910
|
positioned_relative_to_pcb_board_id: external_exports.string().optional(),
|
|
5704
5911
|
cable_insertion_center: point.optional(),
|
|
5912
|
+
insertion_direction: external_exports.enum([
|
|
5913
|
+
"from_above",
|
|
5914
|
+
"from_left",
|
|
5915
|
+
"from_right",
|
|
5916
|
+
"from_front",
|
|
5917
|
+
"from_back"
|
|
5918
|
+
]).optional(),
|
|
5705
5919
|
metadata: external_exports.object({
|
|
5706
5920
|
kicad_footprint: kicadFootprintMetadata.optional()
|
|
5707
5921
|
}).optional(),
|
|
@@ -6233,12 +6447,23 @@ var pcb_trace_route_point_via = external_exports.object({
|
|
|
6233
6447
|
is_inside_copper_pour: external_exports.boolean().optional(),
|
|
6234
6448
|
hole_diameter: distance.optional(),
|
|
6235
6449
|
outer_diameter: distance.optional(),
|
|
6236
|
-
from_layer:
|
|
6237
|
-
to_layer:
|
|
6450
|
+
from_layer: layer_ref,
|
|
6451
|
+
to_layer: layer_ref
|
|
6452
|
+
});
|
|
6453
|
+
var pcb_trace_route_point_through_pad = external_exports.object({
|
|
6454
|
+
route_type: external_exports.literal("through_pad"),
|
|
6455
|
+
start: point,
|
|
6456
|
+
end: point,
|
|
6457
|
+
width: distance,
|
|
6458
|
+
start_layer: layer_ref,
|
|
6459
|
+
end_layer: layer_ref,
|
|
6460
|
+
pcb_smtpad_id: external_exports.string().optional(),
|
|
6461
|
+
pcb_plated_hole_id: external_exports.string().optional()
|
|
6238
6462
|
});
|
|
6239
6463
|
var pcb_trace_route_point = external_exports.union([
|
|
6240
6464
|
pcb_trace_route_point_wire,
|
|
6241
|
-
pcb_trace_route_point_via
|
|
6465
|
+
pcb_trace_route_point_via,
|
|
6466
|
+
pcb_trace_route_point_through_pad
|
|
6242
6467
|
]);
|
|
6243
6468
|
var pcb_trace = external_exports.object({
|
|
6244
6469
|
type: external_exports.literal("pcb_trace"),
|
|
@@ -6256,6 +6481,19 @@ var pcb_trace = external_exports.object({
|
|
|
6256
6481
|
}).describe("Defines a trace on the PCB");
|
|
6257
6482
|
expectTypesMatch(true);
|
|
6258
6483
|
expectTypesMatch(true);
|
|
6484
|
+
var pcb_trace_warning = external_exports.object({
|
|
6485
|
+
type: external_exports.literal("pcb_trace_warning"),
|
|
6486
|
+
pcb_trace_warning_id: getZodPrefixedIdWithDefault("pcb_trace_warning"),
|
|
6487
|
+
warning_type: external_exports.literal("pcb_trace_warning").default("pcb_trace_warning"),
|
|
6488
|
+
message: external_exports.string(),
|
|
6489
|
+
center: point.optional(),
|
|
6490
|
+
pcb_trace_id: external_exports.string(),
|
|
6491
|
+
source_trace_id: external_exports.string(),
|
|
6492
|
+
pcb_component_ids: external_exports.array(external_exports.string()),
|
|
6493
|
+
pcb_port_ids: external_exports.array(external_exports.string()),
|
|
6494
|
+
subcircuit_id: external_exports.string().optional()
|
|
6495
|
+
}).describe("Defines a trace warning on the PCB");
|
|
6496
|
+
expectTypesMatch(true);
|
|
6259
6497
|
var pcb_trace_error = base_circuit_json_error.extend({
|
|
6260
6498
|
type: external_exports.literal("pcb_trace_error"),
|
|
6261
6499
|
pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
|
|
@@ -6354,10 +6592,12 @@ var pcb_board = external_exports.object({
|
|
|
6354
6592
|
outline: external_exports.array(point).optional(),
|
|
6355
6593
|
shape: external_exports.enum(["rect", "polygon"]).optional(),
|
|
6356
6594
|
material: external_exports.enum(["fr4", "fr1"]).default("fr4"),
|
|
6595
|
+
solder_mask_color: external_exports.string().optional(),
|
|
6596
|
+
silkscreen_color: external_exports.string().optional(),
|
|
6357
6597
|
anchor_position: point.optional(),
|
|
6358
6598
|
anchor_alignment: ninePointAnchor.optional(),
|
|
6359
6599
|
position_mode: external_exports.enum(["relative_to_panel_anchor", "none"]).optional()
|
|
6360
|
-
}).describe("Defines the board outline of the PCB");
|
|
6600
|
+
}).merge(manufacturing_drc_properties).describe("Defines the board outline of the PCB");
|
|
6361
6601
|
expectTypesMatch(true);
|
|
6362
6602
|
var pcb_panel = external_exports.object({
|
|
6363
6603
|
type: external_exports.literal("pcb_panel"),
|
|
@@ -6365,6 +6605,7 @@ var pcb_panel = external_exports.object({
|
|
|
6365
6605
|
width: length,
|
|
6366
6606
|
height: length,
|
|
6367
6607
|
center: point,
|
|
6608
|
+
thickness: length.optional().default(1.4),
|
|
6368
6609
|
covered_with_solder_mask: external_exports.boolean().optional().default(true)
|
|
6369
6610
|
}).describe("Defines a PCB panel that can contain multiple boards");
|
|
6370
6611
|
expectTypesMatch(true);
|
|
@@ -6505,7 +6746,8 @@ var pcb_silkscreen_circle = external_exports.object({
|
|
|
6505
6746
|
center: point,
|
|
6506
6747
|
radius: length,
|
|
6507
6748
|
layer: visible_layer,
|
|
6508
|
-
stroke_width: length.default("1mm")
|
|
6749
|
+
stroke_width: length.default("1mm"),
|
|
6750
|
+
is_filled: external_exports.boolean().optional()
|
|
6509
6751
|
}).describe("Defines a silkscreen circle on the PCB");
|
|
6510
6752
|
expectTypesMatch(true);
|
|
6511
6753
|
var pcb_silkscreen_oval = external_exports.object({
|
|
@@ -6521,6 +6763,26 @@ var pcb_silkscreen_oval = external_exports.object({
|
|
|
6521
6763
|
ccw_rotation: rotation.optional()
|
|
6522
6764
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
6523
6765
|
expectTypesMatch(true);
|
|
6766
|
+
var pcb_silkscreen_graphic_base = external_exports.object({
|
|
6767
|
+
type: external_exports.literal("pcb_silkscreen_graphic"),
|
|
6768
|
+
pcb_silkscreen_graphic_id: getZodPrefixedIdWithDefault(
|
|
6769
|
+
"pcb_silkscreen_graphic"
|
|
6770
|
+
),
|
|
6771
|
+
pcb_component_id: external_exports.string(),
|
|
6772
|
+
pcb_group_id: external_exports.string().optional(),
|
|
6773
|
+
subcircuit_id: external_exports.string().optional(),
|
|
6774
|
+
layer: visible_layer,
|
|
6775
|
+
image_asset: asset.optional()
|
|
6776
|
+
});
|
|
6777
|
+
var pcb_silkscreen_graphic_brep = pcb_silkscreen_graphic_base.extend({
|
|
6778
|
+
shape: external_exports.literal("brep"),
|
|
6779
|
+
brep_shape
|
|
6780
|
+
}).describe("Defines a BRep silkscreen graphic on the PCB");
|
|
6781
|
+
expectTypesMatch(
|
|
6782
|
+
true
|
|
6783
|
+
);
|
|
6784
|
+
var pcb_silkscreen_graphic = external_exports.discriminatedUnion("shape", [pcb_silkscreen_graphic_brep]).describe("Defines a silkscreen graphic on the PCB");
|
|
6785
|
+
expectTypesMatch(true);
|
|
6524
6786
|
var pcb_silkscreen_pill = external_exports.object({
|
|
6525
6787
|
type: external_exports.literal("pcb_silkscreen_pill"),
|
|
6526
6788
|
pcb_silkscreen_pill_id: getZodPrefixedIdWithDefault("pcb_silkscreen_pill"),
|
|
@@ -6545,6 +6807,7 @@ var pcb_fabrication_note_text = external_exports.object({
|
|
|
6545
6807
|
font_size: distance.default("1mm"),
|
|
6546
6808
|
pcb_component_id: external_exports.string(),
|
|
6547
6809
|
text: external_exports.string(),
|
|
6810
|
+
ccw_rotation: external_exports.number().optional(),
|
|
6548
6811
|
layer: visible_layer,
|
|
6549
6812
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
6550
6813
|
anchor_alignment: external_exports.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
@@ -6625,6 +6888,8 @@ var pcb_note_text = external_exports.object({
|
|
|
6625
6888
|
text: external_exports.string().optional(),
|
|
6626
6889
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
6627
6890
|
anchor_alignment: external_exports.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
6891
|
+
layer: visible_layer.default("top"),
|
|
6892
|
+
is_mirrored_from_top_view: external_exports.boolean().optional(),
|
|
6628
6893
|
color: external_exports.string().optional()
|
|
6629
6894
|
}).describe("Defines a documentation note in text on the PCB");
|
|
6630
6895
|
expectTypesMatch(true);
|
|
@@ -6639,6 +6904,7 @@ var pcb_note_rect = external_exports.object({
|
|
|
6639
6904
|
center: point,
|
|
6640
6905
|
width: length,
|
|
6641
6906
|
height: length,
|
|
6907
|
+
layer: visible_layer.default("top"),
|
|
6642
6908
|
stroke_width: length.default("0.1mm"),
|
|
6643
6909
|
corner_radius: length.optional(),
|
|
6644
6910
|
is_filled: external_exports.boolean().optional(),
|
|
@@ -6656,6 +6922,7 @@ var pcb_note_path = external_exports.object({
|
|
|
6656
6922
|
name: external_exports.string().optional(),
|
|
6657
6923
|
text: external_exports.string().optional(),
|
|
6658
6924
|
route: external_exports.array(point),
|
|
6925
|
+
layer: visible_layer.default("top"),
|
|
6659
6926
|
stroke_width: length.default("0.1mm"),
|
|
6660
6927
|
color: external_exports.string().optional()
|
|
6661
6928
|
}).describe("Defines a polyline documentation note on the PCB");
|
|
@@ -6672,6 +6939,7 @@ var pcb_note_line = external_exports.object({
|
|
|
6672
6939
|
y1: distance,
|
|
6673
6940
|
x2: distance,
|
|
6674
6941
|
y2: distance,
|
|
6942
|
+
layer: visible_layer.default("top"),
|
|
6675
6943
|
stroke_width: distance.default("0.1mm"),
|
|
6676
6944
|
color: external_exports.string().optional(),
|
|
6677
6945
|
is_dashed: external_exports.boolean().optional()
|
|
@@ -6695,6 +6963,7 @@ var pcb_note_dimension = external_exports.object({
|
|
|
6695
6963
|
}).optional(),
|
|
6696
6964
|
font: external_exports.literal("tscircuit2024").default("tscircuit2024"),
|
|
6697
6965
|
font_size: length.default("1mm"),
|
|
6966
|
+
layer: visible_layer.default("top"),
|
|
6698
6967
|
color: external_exports.string().optional(),
|
|
6699
6968
|
arrow_size: length.default("1mm")
|
|
6700
6969
|
}).describe("Defines a measurement annotation within PCB documentation notes");
|
|
@@ -6906,6 +7175,25 @@ var pcb_connector_not_in_accessible_orientation_warning = external_exports.objec
|
|
|
6906
7175
|
"Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented to an outward-facing direction"
|
|
6907
7176
|
);
|
|
6908
7177
|
expectTypesMatch(true);
|
|
7178
|
+
var supplier_footprint_mismatch_warning = external_exports.object({
|
|
7179
|
+
type: external_exports.literal("supplier_footprint_mismatch_warning"),
|
|
7180
|
+
supplier_footprint_mismatch_warning_id: getZodPrefixedIdWithDefault(
|
|
7181
|
+
"supplier_footprint_mismatch_warning"
|
|
7182
|
+
),
|
|
7183
|
+
warning_type: external_exports.literal("supplier_footprint_mismatch_warning").default("supplier_footprint_mismatch_warning"),
|
|
7184
|
+
message: external_exports.string(),
|
|
7185
|
+
source_component_id: external_exports.string(),
|
|
7186
|
+
pcb_component_id: external_exports.string().optional(),
|
|
7187
|
+
pcb_group_id: external_exports.string().optional(),
|
|
7188
|
+
subcircuit_id: external_exports.string().optional(),
|
|
7189
|
+
supplier_name: supplier_name.optional(),
|
|
7190
|
+
supplier_part_number: external_exports.string().optional(),
|
|
7191
|
+
supplier_footprint_url: external_exports.string().optional(),
|
|
7192
|
+
footprint_copper_intersection_over_union: external_exports.number()
|
|
7193
|
+
}).describe(
|
|
7194
|
+
"Warning emitted when a supplier part footprint does not match the expected footprint"
|
|
7195
|
+
);
|
|
7196
|
+
expectTypesMatch(true);
|
|
6909
7197
|
var pcb_breakout_point = external_exports.object({
|
|
6910
7198
|
type: external_exports.literal("pcb_breakout_point"),
|
|
6911
7199
|
pcb_breakout_point_id: getZodPrefixedIdWithDefault("pcb_breakout_point"),
|
|
@@ -7052,6 +7340,64 @@ var pcb_via_clearance_error = base_circuit_json_error.extend({
|
|
|
7052
7340
|
subcircuit_id: external_exports.string().optional()
|
|
7053
7341
|
}).describe("Error emitted when vias are closer than the allowed clearance");
|
|
7054
7342
|
expectTypesMatch(true);
|
|
7343
|
+
var pcb_via_trace_clearance_error = base_circuit_json_error.extend({
|
|
7344
|
+
type: external_exports.literal("pcb_via_trace_clearance_error"),
|
|
7345
|
+
pcb_via_trace_clearance_error_id: getZodPrefixedIdWithDefault(
|
|
7346
|
+
"pcb_via_trace_clearance_error"
|
|
7347
|
+
),
|
|
7348
|
+
error_type: external_exports.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
|
|
7349
|
+
pcb_via_id: external_exports.string(),
|
|
7350
|
+
pcb_trace_id: external_exports.string(),
|
|
7351
|
+
minimum_clearance: distance.optional(),
|
|
7352
|
+
actual_clearance: distance.optional(),
|
|
7353
|
+
center: external_exports.object({
|
|
7354
|
+
x: external_exports.number().optional(),
|
|
7355
|
+
y: external_exports.number().optional()
|
|
7356
|
+
}).optional(),
|
|
7357
|
+
subcircuit_id: external_exports.string().optional()
|
|
7358
|
+
}).describe(
|
|
7359
|
+
"Error emitted when a via and trace are closer than the allowed clearance"
|
|
7360
|
+
);
|
|
7361
|
+
expectTypesMatch(
|
|
7362
|
+
true
|
|
7363
|
+
);
|
|
7364
|
+
var pcb_pad_pad_clearance_error = base_circuit_json_error.extend({
|
|
7365
|
+
type: external_exports.literal("pcb_pad_pad_clearance_error"),
|
|
7366
|
+
pcb_pad_pad_clearance_error_id: getZodPrefixedIdWithDefault(
|
|
7367
|
+
"pcb_pad_pad_clearance_error"
|
|
7368
|
+
),
|
|
7369
|
+
error_type: external_exports.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
|
|
7370
|
+
pcb_pad_ids: external_exports.array(external_exports.string()).min(2),
|
|
7371
|
+
minimum_clearance: distance.optional(),
|
|
7372
|
+
actual_clearance: distance.optional(),
|
|
7373
|
+
center: external_exports.object({
|
|
7374
|
+
x: external_exports.number().optional(),
|
|
7375
|
+
y: external_exports.number().optional()
|
|
7376
|
+
}).optional(),
|
|
7377
|
+
subcircuit_id: external_exports.string().optional()
|
|
7378
|
+
}).describe("Error emitted when pads are closer than the allowed clearance");
|
|
7379
|
+
expectTypesMatch(true);
|
|
7380
|
+
var pcb_pad_trace_clearance_error = base_circuit_json_error.extend({
|
|
7381
|
+
type: external_exports.literal("pcb_pad_trace_clearance_error"),
|
|
7382
|
+
pcb_pad_trace_clearance_error_id: getZodPrefixedIdWithDefault(
|
|
7383
|
+
"pcb_pad_trace_clearance_error"
|
|
7384
|
+
),
|
|
7385
|
+
error_type: external_exports.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
|
|
7386
|
+
pcb_pad_id: external_exports.string(),
|
|
7387
|
+
pcb_trace_id: external_exports.string(),
|
|
7388
|
+
minimum_clearance: distance.optional(),
|
|
7389
|
+
actual_clearance: distance.optional(),
|
|
7390
|
+
center: external_exports.object({
|
|
7391
|
+
x: external_exports.number().optional(),
|
|
7392
|
+
y: external_exports.number().optional()
|
|
7393
|
+
}).optional(),
|
|
7394
|
+
subcircuit_id: external_exports.string().optional()
|
|
7395
|
+
}).describe(
|
|
7396
|
+
"Error emitted when a pad and trace are closer than allowed clearance"
|
|
7397
|
+
);
|
|
7398
|
+
expectTypesMatch(
|
|
7399
|
+
true
|
|
7400
|
+
);
|
|
7055
7401
|
var pcb_courtyard_rect = external_exports.object({
|
|
7056
7402
|
type: external_exports.literal("pcb_courtyard_rect"),
|
|
7057
7403
|
pcb_courtyard_rect_id: getZodPrefixedIdWithDefault("pcb_courtyard_rect"),
|
|
@@ -7105,6 +7451,20 @@ var pcb_courtyard_circle = external_exports.object({
|
|
|
7105
7451
|
color: external_exports.string().optional()
|
|
7106
7452
|
}).describe("Defines a courtyard circle on the PCB");
|
|
7107
7453
|
expectTypesMatch(true);
|
|
7454
|
+
var pcb_courtyard_pill = external_exports.object({
|
|
7455
|
+
type: external_exports.literal("pcb_courtyard_pill"),
|
|
7456
|
+
pcb_courtyard_pill_id: getZodPrefixedIdWithDefault("pcb_courtyard_pill"),
|
|
7457
|
+
pcb_component_id: external_exports.string(),
|
|
7458
|
+
pcb_group_id: external_exports.string().optional(),
|
|
7459
|
+
subcircuit_id: external_exports.string().optional(),
|
|
7460
|
+
center: point,
|
|
7461
|
+
width: length,
|
|
7462
|
+
height: length,
|
|
7463
|
+
radius: length,
|
|
7464
|
+
layer: visible_layer,
|
|
7465
|
+
color: external_exports.string().optional()
|
|
7466
|
+
}).describe("Defines a courtyard pill on the PCB");
|
|
7467
|
+
expectTypesMatch(true);
|
|
7108
7468
|
var cad_model_formats = [
|
|
7109
7469
|
"obj",
|
|
7110
7470
|
"stl",
|
|
@@ -7165,6 +7525,7 @@ var cad_component = external_exports.object({
|
|
|
7165
7525
|
model_object_fit: external_exports.enum(["contain_within_bounds", "fill_bounds"]).optional().default("contain_within_bounds"),
|
|
7166
7526
|
model_jscad: external_exports.any().optional(),
|
|
7167
7527
|
show_as_translucent_model: external_exports.boolean().optional(),
|
|
7528
|
+
show_as_bounding_box: external_exports.boolean().optional(),
|
|
7168
7529
|
anchor_alignment: external_exports.enum(["center", "center_of_component_on_board_surface"]).optional().default("center")
|
|
7169
7530
|
}).describe("Defines a component on the PCB");
|
|
7170
7531
|
expectTypesMatch(true);
|
|
@@ -7207,7 +7568,12 @@ var simulation_ac_voltage_source = external_exports.object({
|
|
|
7207
7568
|
peak_to_peak_voltage: voltage.optional(),
|
|
7208
7569
|
wave_shape: wave_shape.optional(),
|
|
7209
7570
|
phase: rotation.optional(),
|
|
7210
|
-
duty_cycle: percentage.optional()
|
|
7571
|
+
duty_cycle: percentage.optional(),
|
|
7572
|
+
pulse_delay: ms.optional(),
|
|
7573
|
+
rise_time: ms.optional(),
|
|
7574
|
+
fall_time: ms.optional(),
|
|
7575
|
+
pulse_width: ms.optional(),
|
|
7576
|
+
period: ms.optional()
|
|
7211
7577
|
}).describe("Defines an AC voltage source for simulation");
|
|
7212
7578
|
var simulation_voltage_source = external_exports.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
|
|
7213
7579
|
expectTypesMatch(true);
|
|
@@ -7263,6 +7629,12 @@ var experiment_type = external_exports.union([
|
|
|
7263
7629
|
external_exports.literal("spice_transient_analysis"),
|
|
7264
7630
|
external_exports.literal("spice_ac_analysis")
|
|
7265
7631
|
]);
|
|
7632
|
+
var spice_simulation_options = external_exports.object({
|
|
7633
|
+
method: external_exports.enum(["trap", "gear"]).optional(),
|
|
7634
|
+
reltol: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
7635
|
+
abstol: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
7636
|
+
vntol: external_exports.union([external_exports.number(), external_exports.string()]).optional()
|
|
7637
|
+
}).describe("SPICE solver options for a simulation experiment");
|
|
7266
7638
|
var simulation_experiment = external_exports.object({
|
|
7267
7639
|
type: external_exports.literal("simulation_experiment"),
|
|
7268
7640
|
simulation_experiment_id: getZodPrefixedIdWithDefault(
|
|
@@ -7272,7 +7644,8 @@ var simulation_experiment = external_exports.object({
|
|
|
7272
7644
|
experiment_type,
|
|
7273
7645
|
time_per_step: duration_ms.optional(),
|
|
7274
7646
|
start_time_ms: ms.optional(),
|
|
7275
|
-
end_time_ms: ms.optional()
|
|
7647
|
+
end_time_ms: ms.optional(),
|
|
7648
|
+
spice_options: spice_simulation_options.optional()
|
|
7276
7649
|
}).describe("Defines a simulation experiment configuration");
|
|
7277
7650
|
expectTypesMatch(true);
|
|
7278
7651
|
var simulation_transient_voltage_graph = external_exports.object({
|
|
@@ -7292,6 +7665,23 @@ var simulation_transient_voltage_graph = external_exports.object({
|
|
|
7292
7665
|
color: external_exports.string().optional()
|
|
7293
7666
|
}).describe("Stores voltage measurements over time for a simulation");
|
|
7294
7667
|
expectTypesMatch(true);
|
|
7668
|
+
var simulation_transient_current_graph = external_exports.object({
|
|
7669
|
+
type: external_exports.literal("simulation_transient_current_graph"),
|
|
7670
|
+
simulation_transient_current_graph_id: getZodPrefixedIdWithDefault(
|
|
7671
|
+
"simulation_transient_current_graph"
|
|
7672
|
+
),
|
|
7673
|
+
simulation_experiment_id: external_exports.string(),
|
|
7674
|
+
timestamps_ms: external_exports.array(external_exports.number()).optional(),
|
|
7675
|
+
current_levels: external_exports.array(external_exports.number()),
|
|
7676
|
+
source_component_id: external_exports.string().optional(),
|
|
7677
|
+
subcircuit_connectivity_map_key: external_exports.string().optional(),
|
|
7678
|
+
time_per_step: duration_ms,
|
|
7679
|
+
start_time_ms: ms,
|
|
7680
|
+
end_time_ms: ms,
|
|
7681
|
+
name: external_exports.string().optional(),
|
|
7682
|
+
color: external_exports.string().optional()
|
|
7683
|
+
}).describe("Stores current measurements over time for a simulation");
|
|
7684
|
+
expectTypesMatch(true);
|
|
7295
7685
|
var simulation_switch = external_exports.object({
|
|
7296
7686
|
type: external_exports.literal("simulation_switch"),
|
|
7297
7687
|
simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
|
|
@@ -7352,6 +7742,59 @@ var simulation_voltage_probe = external_exports.object({
|
|
|
7352
7742
|
}
|
|
7353
7743
|
});
|
|
7354
7744
|
expectTypesMatch(true);
|
|
7745
|
+
var simulation_current_probe = external_exports.object({
|
|
7746
|
+
type: external_exports.literal("simulation_current_probe"),
|
|
7747
|
+
simulation_current_probe_id: getZodPrefixedIdWithDefault(
|
|
7748
|
+
"simulation_current_probe"
|
|
7749
|
+
),
|
|
7750
|
+
source_component_id: external_exports.string().optional(),
|
|
7751
|
+
name: external_exports.string().optional(),
|
|
7752
|
+
positive_source_port_id: external_exports.string().optional(),
|
|
7753
|
+
negative_source_port_id: external_exports.string().optional(),
|
|
7754
|
+
positive_source_net_id: external_exports.string().optional(),
|
|
7755
|
+
negative_source_net_id: external_exports.string().optional(),
|
|
7756
|
+
subcircuit_id: external_exports.string().optional(),
|
|
7757
|
+
color: external_exports.string().optional()
|
|
7758
|
+
}).describe(
|
|
7759
|
+
"Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint."
|
|
7760
|
+
).superRefine((data, ctx) => {
|
|
7761
|
+
const hasPositivePort = !!data.positive_source_port_id;
|
|
7762
|
+
const hasNegativePort = !!data.negative_source_port_id;
|
|
7763
|
+
const hasPositiveNet = !!data.positive_source_net_id;
|
|
7764
|
+
const hasNegativeNet = !!data.negative_source_net_id;
|
|
7765
|
+
const hasPorts = hasPositivePort || hasNegativePort;
|
|
7766
|
+
const hasNets = hasPositiveNet || hasNegativeNet;
|
|
7767
|
+
if (hasPorts && hasNets) {
|
|
7768
|
+
ctx.addIssue({
|
|
7769
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7770
|
+
message: "Cannot mix port and net connections in a current probe."
|
|
7771
|
+
});
|
|
7772
|
+
return;
|
|
7773
|
+
}
|
|
7774
|
+
if (hasPorts) {
|
|
7775
|
+
if (!hasPositivePort || !hasNegativePort) {
|
|
7776
|
+
ctx.addIssue({
|
|
7777
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7778
|
+
message: "Current probe using source ports requires both positive_source_port_id and negative_source_port_id."
|
|
7779
|
+
});
|
|
7780
|
+
}
|
|
7781
|
+
return;
|
|
7782
|
+
}
|
|
7783
|
+
if (hasNets) {
|
|
7784
|
+
if (!hasPositiveNet || !hasNegativeNet) {
|
|
7785
|
+
ctx.addIssue({
|
|
7786
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7787
|
+
message: "Current probe using source nets requires both positive_source_net_id and negative_source_net_id."
|
|
7788
|
+
});
|
|
7789
|
+
}
|
|
7790
|
+
return;
|
|
7791
|
+
}
|
|
7792
|
+
ctx.addIssue({
|
|
7793
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7794
|
+
message: "A current probe must have either positive/negative source port ids or positive/negative source net ids."
|
|
7795
|
+
});
|
|
7796
|
+
});
|
|
7797
|
+
expectTypesMatch(true);
|
|
7355
7798
|
var simulation_unknown_experiment_error = base_circuit_json_error.extend({
|
|
7356
7799
|
type: external_exports.literal("simulation_unknown_experiment_error"),
|
|
7357
7800
|
simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
|
|
@@ -7373,6 +7816,65 @@ var simulation_op_amp = external_exports.object({
|
|
|
7373
7816
|
negative_supply_source_port_id: external_exports.string()
|
|
7374
7817
|
}).describe("Defines a simple ideal operational amplifier for simulation");
|
|
7375
7818
|
expectTypesMatch(true);
|
|
7819
|
+
var simulation_spice_subcircuit = external_exports.object({
|
|
7820
|
+
type: external_exports.literal("simulation_spice_subcircuit"),
|
|
7821
|
+
simulation_spice_subcircuit_id: getZodPrefixedIdWithDefault(
|
|
7822
|
+
"simulation_spice_subcircuit"
|
|
7823
|
+
),
|
|
7824
|
+
source_component_id: external_exports.string(),
|
|
7825
|
+
spice_pin_to_source_port_map: external_exports.record(external_exports.string(), external_exports.string()),
|
|
7826
|
+
subcircuit_source: external_exports.string()
|
|
7827
|
+
}).describe("Defines a custom SPICE subcircuit model for simulation");
|
|
7828
|
+
expectTypesMatch(
|
|
7829
|
+
true
|
|
7830
|
+
);
|
|
7831
|
+
var hasValue = (value) => value !== void 0;
|
|
7832
|
+
var simulation_oscilloscope_trace = external_exports.object({
|
|
7833
|
+
type: external_exports.literal("simulation_oscilloscope_trace"),
|
|
7834
|
+
simulation_oscilloscope_trace_id: getZodPrefixedIdWithDefault(
|
|
7835
|
+
"simulation_oscilloscope_trace"
|
|
7836
|
+
),
|
|
7837
|
+
simulation_transient_voltage_graph_id: external_exports.string().optional(),
|
|
7838
|
+
simulation_transient_current_graph_id: external_exports.string().optional(),
|
|
7839
|
+
simulation_voltage_probe_id: external_exports.string().optional(),
|
|
7840
|
+
simulation_current_probe_id: external_exports.string().optional(),
|
|
7841
|
+
display_name: external_exports.string().optional(),
|
|
7842
|
+
color: external_exports.string().optional(),
|
|
7843
|
+
display_center_value: external_exports.number().optional(),
|
|
7844
|
+
display_center_offset_divs: external_exports.number().optional(),
|
|
7845
|
+
volts_per_div: external_exports.number().positive().optional(),
|
|
7846
|
+
amps_per_div: external_exports.number().positive().optional()
|
|
7847
|
+
}).describe(
|
|
7848
|
+
"Defines how a simulation measurement is rendered as an oscilloscope-style trace."
|
|
7849
|
+
).superRefine((data, ctx) => {
|
|
7850
|
+
const voltageReferences = [
|
|
7851
|
+
data.simulation_transient_voltage_graph_id,
|
|
7852
|
+
data.simulation_voltage_probe_id
|
|
7853
|
+
].filter(hasValue).length;
|
|
7854
|
+
const currentReferences = [
|
|
7855
|
+
data.simulation_transient_current_graph_id,
|
|
7856
|
+
data.simulation_current_probe_id
|
|
7857
|
+
].filter(hasValue).length;
|
|
7858
|
+
if (voltageReferences + currentReferences !== 1) {
|
|
7859
|
+
ctx.addIssue({
|
|
7860
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7861
|
+
message: "An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe."
|
|
7862
|
+
});
|
|
7863
|
+
}
|
|
7864
|
+
if (voltageReferences > 0 && data.amps_per_div !== void 0) {
|
|
7865
|
+
ctx.addIssue({
|
|
7866
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7867
|
+
message: "Voltage oscilloscope traces must use volts_per_div, not amps_per_div."
|
|
7868
|
+
});
|
|
7869
|
+
}
|
|
7870
|
+
if (currentReferences > 0 && data.volts_per_div !== void 0) {
|
|
7871
|
+
ctx.addIssue({
|
|
7872
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7873
|
+
message: "Current oscilloscope traces must use amps_per_div, not volts_per_div."
|
|
7874
|
+
});
|
|
7875
|
+
}
|
|
7876
|
+
});
|
|
7877
|
+
expectTypesMatch(true);
|
|
7376
7878
|
var any_circuit_element = external_exports.union([
|
|
7377
7879
|
source_trace,
|
|
7378
7880
|
source_port,
|
|
@@ -7405,12 +7907,17 @@ var any_circuit_element = external_exports.union([
|
|
|
7405
7907
|
source_invalid_component_property_error,
|
|
7406
7908
|
source_trace_not_connected_error,
|
|
7407
7909
|
source_pin_missing_trace_warning,
|
|
7910
|
+
source_unnamed_trace_warning,
|
|
7911
|
+
source_missing_manufacturer_part_number_warning,
|
|
7912
|
+
source_refdes_convention_warning,
|
|
7408
7913
|
source_no_power_pin_defined_warning,
|
|
7409
7914
|
source_no_ground_pin_defined_warning,
|
|
7410
7915
|
source_component_pins_underspecified_warning,
|
|
7411
7916
|
source_pin_must_be_connected_error,
|
|
7412
7917
|
unknown_error_finding_part,
|
|
7918
|
+
source_part_not_found_warning,
|
|
7413
7919
|
source_i2c_misconfigured_error,
|
|
7920
|
+
source_component_misconfigured_error,
|
|
7414
7921
|
source_ambiguous_port_reference,
|
|
7415
7922
|
pcb_component,
|
|
7416
7923
|
pcb_hole,
|
|
@@ -7419,12 +7926,14 @@ var any_circuit_element = external_exports.union([
|
|
|
7419
7926
|
circuit_json_footprint_load_error,
|
|
7420
7927
|
pcb_manual_edit_conflict_warning,
|
|
7421
7928
|
pcb_connector_not_in_accessible_orientation_warning,
|
|
7929
|
+
supplier_footprint_mismatch_warning,
|
|
7422
7930
|
pcb_plated_hole,
|
|
7423
7931
|
pcb_keepout,
|
|
7424
7932
|
pcb_port,
|
|
7425
7933
|
pcb_net,
|
|
7426
7934
|
pcb_text,
|
|
7427
7935
|
pcb_trace,
|
|
7936
|
+
pcb_trace_warning,
|
|
7428
7937
|
pcb_via,
|
|
7429
7938
|
pcb_smtpad,
|
|
7430
7939
|
pcb_solder_paste,
|
|
@@ -7440,6 +7949,7 @@ var any_circuit_element = external_exports.union([
|
|
|
7440
7949
|
pcb_silkscreen_rect,
|
|
7441
7950
|
pcb_silkscreen_circle,
|
|
7442
7951
|
pcb_silkscreen_oval,
|
|
7952
|
+
pcb_silkscreen_graphic,
|
|
7443
7953
|
pcb_trace_error,
|
|
7444
7954
|
pcb_trace_missing_error,
|
|
7445
7955
|
pcb_placement_error,
|
|
@@ -7447,6 +7957,9 @@ var any_circuit_element = external_exports.union([
|
|
|
7447
7957
|
pcb_port_not_matched_error,
|
|
7448
7958
|
pcb_port_not_connected_error,
|
|
7449
7959
|
pcb_via_clearance_error,
|
|
7960
|
+
pcb_via_trace_clearance_error,
|
|
7961
|
+
pcb_pad_pad_clearance_error,
|
|
7962
|
+
pcb_pad_trace_clearance_error,
|
|
7450
7963
|
pcb_fabrication_note_path,
|
|
7451
7964
|
pcb_fabrication_note_text,
|
|
7452
7965
|
pcb_fabrication_note_rect,
|
|
@@ -7472,6 +7985,7 @@ var any_circuit_element = external_exports.union([
|
|
|
7472
7985
|
pcb_courtyard_outline,
|
|
7473
7986
|
pcb_courtyard_polygon,
|
|
7474
7987
|
pcb_courtyard_circle,
|
|
7988
|
+
pcb_courtyard_pill,
|
|
7475
7989
|
schematic_box,
|
|
7476
7990
|
schematic_text,
|
|
7477
7991
|
schematic_line,
|
|
@@ -7498,10 +8012,14 @@ var any_circuit_element = external_exports.union([
|
|
|
7498
8012
|
simulation_current_source,
|
|
7499
8013
|
simulation_experiment,
|
|
7500
8014
|
simulation_transient_voltage_graph,
|
|
8015
|
+
simulation_transient_current_graph,
|
|
7501
8016
|
simulation_switch,
|
|
7502
8017
|
simulation_voltage_probe,
|
|
8018
|
+
simulation_current_probe,
|
|
8019
|
+
simulation_oscilloscope_trace,
|
|
7503
8020
|
simulation_unknown_experiment_error,
|
|
7504
|
-
simulation_op_amp
|
|
8021
|
+
simulation_op_amp,
|
|
8022
|
+
simulation_spice_subcircuit
|
|
7505
8023
|
]);
|
|
7506
8024
|
var any_soup_element = any_circuit_element;
|
|
7507
8025
|
expectTypesMatch(true);
|
|
@@ -8550,9 +9068,52 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
8550
9068
|
return suIndexed;
|
|
8551
9069
|
};
|
|
8552
9070
|
cjuIndexed.unparsed = cjuIndexed;
|
|
9071
|
+
var getQuarterTurns = (angleRadians) => Math.round(angleRadians / (Math.PI / 2));
|
|
9072
|
+
var insertionDirectionToVec = (direction) => {
|
|
9073
|
+
switch (direction) {
|
|
9074
|
+
case "from_left":
|
|
9075
|
+
return { x: -1, y: 0 };
|
|
9076
|
+
case "from_right":
|
|
9077
|
+
return { x: 1, y: 0 };
|
|
9078
|
+
case "from_front":
|
|
9079
|
+
return { x: 0, y: 1 };
|
|
9080
|
+
case "from_back":
|
|
9081
|
+
return { x: 0, y: -1 };
|
|
9082
|
+
}
|
|
9083
|
+
};
|
|
9084
|
+
var vecToInsertionDirection = ({
|
|
9085
|
+
x,
|
|
9086
|
+
y
|
|
9087
|
+
}) => {
|
|
9088
|
+
if (x > 0) return "from_right";
|
|
9089
|
+
if (x < 0) return "from_left";
|
|
9090
|
+
if (y > 0) return "from_front";
|
|
9091
|
+
return "from_back";
|
|
9092
|
+
};
|
|
9093
|
+
var transformInsertionDirection = (direction, opts) => {
|
|
9094
|
+
if (!direction || direction === "from_above") return direction;
|
|
9095
|
+
let { x, y } = insertionDirectionToVec(direction);
|
|
9096
|
+
let quarterTurns = Math.round(opts.rotationDegrees / 90);
|
|
9097
|
+
while (quarterTurns > 0) {
|
|
9098
|
+
;
|
|
9099
|
+
[x, y] = [-y, x];
|
|
9100
|
+
quarterTurns--;
|
|
9101
|
+
}
|
|
9102
|
+
while (quarterTurns < 0) {
|
|
9103
|
+
;
|
|
9104
|
+
[x, y] = [y, -x];
|
|
9105
|
+
quarterTurns++;
|
|
9106
|
+
}
|
|
9107
|
+
if (opts.isFlipped) {
|
|
9108
|
+
y = -y;
|
|
9109
|
+
}
|
|
9110
|
+
return vecToInsertionDirection({ x, y });
|
|
9111
|
+
};
|
|
8553
9112
|
var transformPCBElement = (elm, matrix) => {
|
|
8554
9113
|
const tsr = decomposeTSR(matrix);
|
|
8555
|
-
const flipPadWidthHeight = Math.
|
|
9114
|
+
const flipPadWidthHeight = Math.abs(getQuarterTurns(tsr.rotation.angle)) % 2 === 1;
|
|
9115
|
+
const rotationDegrees = tsr.rotation.angle / Math.PI * 180;
|
|
9116
|
+
const isFlipped = tsr.scale.sy < 0;
|
|
8556
9117
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
8557
9118
|
const { x, y } = applyToPoint(matrix, {
|
|
8558
9119
|
x: Number(elm.x),
|
|
@@ -8573,12 +9134,28 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
8573
9134
|
elm.center = applyToPoint(matrix, elm.center);
|
|
8574
9135
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
8575
9136
|
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
8576
|
-
} else if (elm.type === "
|
|
9137
|
+
} else if (elm.type === "pcb_courtyard_rect") {
|
|
9138
|
+
elm.center = applyToPoint(matrix, elm.center);
|
|
9139
|
+
elm.ccw_rotation = ((elm.ccw_rotation ?? 0) + rotationDegrees) % 360;
|
|
9140
|
+
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
|
|
8577
9141
|
elm.center = applyToPoint(matrix, elm.center);
|
|
8578
9142
|
} else if (elm.type === "pcb_component") {
|
|
8579
9143
|
elm.center = applyToPoint(matrix, elm.center);
|
|
8580
|
-
elm.rotation = elm.rotation +
|
|
9144
|
+
elm.rotation = elm.rotation + rotationDegrees;
|
|
8581
9145
|
elm.rotation = elm.rotation % 360;
|
|
9146
|
+
if (elm.cable_insertion_center) {
|
|
9147
|
+
elm.cable_insertion_center = applyToPoint(
|
|
9148
|
+
matrix,
|
|
9149
|
+
elm.cable_insertion_center
|
|
9150
|
+
);
|
|
9151
|
+
}
|
|
9152
|
+
elm.insertion_direction = transformInsertionDirection(
|
|
9153
|
+
elm.insertion_direction,
|
|
9154
|
+
{
|
|
9155
|
+
rotationDegrees,
|
|
9156
|
+
isFlipped
|
|
9157
|
+
}
|
|
9158
|
+
);
|
|
8582
9159
|
if (flipPadWidthHeight) {
|
|
8583
9160
|
;
|
|
8584
9161
|
[elm.width, elm.height] = [elm.height, elm.width];
|
|
@@ -8625,7 +9202,7 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
8625
9202
|
};
|
|
8626
9203
|
var transformPCBElements = (elms, matrix) => {
|
|
8627
9204
|
const tsr = decomposeTSR(matrix);
|
|
8628
|
-
const quarterTurns =
|
|
9205
|
+
const quarterTurns = getQuarterTurns(tsr.rotation.angle);
|
|
8629
9206
|
const flipPadWidthHeight = Math.abs(quarterTurns) % 2 === 1;
|
|
8630
9207
|
let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
|
|
8631
9208
|
if (flipPadWidthHeight) {
|
|
@@ -8788,6 +9365,16 @@ var getDebugLayoutObject = (lo) => {
|
|
|
8788
9365
|
if ("outer_diameter" in lo) {
|
|
8789
9366
|
width = lo.outer_diameter;
|
|
8790
9367
|
height = lo.outer_diameter;
|
|
9368
|
+
} else if ("rect_pad_width" in lo && "rect_pad_height" in lo) {
|
|
9369
|
+
width = lo.rect_pad_width;
|
|
9370
|
+
height = lo.rect_pad_height;
|
|
9371
|
+
if ("hole_diameter" in lo) {
|
|
9372
|
+
width = Math.max(width, lo.hole_diameter);
|
|
9373
|
+
height = Math.max(height, lo.hole_diameter);
|
|
9374
|
+
}
|
|
9375
|
+
} else if ("hole_diameter" in lo) {
|
|
9376
|
+
width = lo.hole_diameter;
|
|
9377
|
+
height = lo.hole_diameter;
|
|
8791
9378
|
}
|
|
8792
9379
|
}
|
|
8793
9380
|
if (width === void 0 || height === void 0) {
|
|
@@ -9148,6 +9735,11 @@ var handleSilkscreenPath = (track, index) => {
|
|
|
9148
9735
|
});
|
|
9149
9736
|
};
|
|
9150
9737
|
var isCourtyardLayer = (layer) => layer === 13 || layer === 14 || layer === 15;
|
|
9738
|
+
var isSilkscreenLayer = (layer) => layer === 3 || layer === 4;
|
|
9739
|
+
var getSideFromLayer = (layer) => {
|
|
9740
|
+
if (layer === 4 || layer === 14) return "bottom";
|
|
9741
|
+
return "top";
|
|
9742
|
+
};
|
|
9151
9743
|
var handleSilkscreenArc = (arc, index) => {
|
|
9152
9744
|
const arcPath = generateArcFromSweep(
|
|
9153
9745
|
arc.start.x,
|
|
@@ -9171,6 +9763,27 @@ var handleSilkscreenArc = (arc, index) => {
|
|
|
9171
9763
|
stroke_width: mil10ToMm(arc.width)
|
|
9172
9764
|
});
|
|
9173
9765
|
};
|
|
9766
|
+
var SILKSCREEN_CIRCLE_SEGMENTS = 24;
|
|
9767
|
+
var handleSilkscreenCircle = (circle, index) => {
|
|
9768
|
+
const route = Array.from(
|
|
9769
|
+
{ length: SILKSCREEN_CIRCLE_SEGMENTS + 1 },
|
|
9770
|
+
(_, segmentIndex) => {
|
|
9771
|
+
const angle = Math.PI * 2 * segmentIndex / SILKSCREEN_CIRCLE_SEGMENTS;
|
|
9772
|
+
return {
|
|
9773
|
+
x: milx10(circle.center.x + Math.cos(angle) * circle.radius),
|
|
9774
|
+
y: milx10(circle.center.y + Math.sin(angle) * circle.radius)
|
|
9775
|
+
};
|
|
9776
|
+
}
|
|
9777
|
+
);
|
|
9778
|
+
return pcb_silkscreen_path.parse({
|
|
9779
|
+
type: "pcb_silkscreen_path",
|
|
9780
|
+
pcb_silkscreen_path_id: `pcb_silkscreen_circle_${index + 1}`,
|
|
9781
|
+
pcb_component_id: "pcb_component_1",
|
|
9782
|
+
layer: getSideFromLayer(circle.layer),
|
|
9783
|
+
route,
|
|
9784
|
+
stroke_width: mil10ToMm(circle.width)
|
|
9785
|
+
});
|
|
9786
|
+
};
|
|
9174
9787
|
var handleHole = (hole, index) => {
|
|
9175
9788
|
return pcb_hole.parse({
|
|
9176
9789
|
type: "pcb_hole",
|
|
@@ -9433,6 +10046,10 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
9433
10046
|
if (!isCourtyardLayer(shape.layer)) {
|
|
9434
10047
|
circuitElements.push(handleSilkscreenPath(shape, index));
|
|
9435
10048
|
}
|
|
10049
|
+
} else if (shape.type === "CIRCLE") {
|
|
10050
|
+
if (isSilkscreenLayer(shape.layer)) {
|
|
10051
|
+
circuitElements.push(handleSilkscreenCircle(shape, index));
|
|
10052
|
+
}
|
|
9436
10053
|
} else if (shape.type === "ARC") {
|
|
9437
10054
|
if (!isCourtyardLayer(shape.layer)) {
|
|
9438
10055
|
circuitElements.push(handleSilkscreenArc(shape, index));
|
|
@@ -9981,10 +10598,11 @@ var RectangleShapeOutputSchema = external_exports.object({
|
|
|
9981
10598
|
height: external_exports.number(),
|
|
9982
10599
|
color: external_exports.string(),
|
|
9983
10600
|
lineWidth: external_exports.number(),
|
|
10601
|
+
fillColor: external_exports.string().optional(),
|
|
9984
10602
|
id: external_exports.string()
|
|
9985
10603
|
});
|
|
9986
10604
|
var parseRectangle = (str) => {
|
|
9987
|
-
const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
|
|
10605
|
+
const [, x, y, , , width, height, color, lineWidth, , fillColor, id] = str.split("~");
|
|
9988
10606
|
return {
|
|
9989
10607
|
type: "RECTANGLE",
|
|
9990
10608
|
position: { x: Number(x), y: Number(y) },
|
|
@@ -9992,6 +10610,7 @@ var parseRectangle = (str) => {
|
|
|
9992
10610
|
height: Number(height),
|
|
9993
10611
|
color,
|
|
9994
10612
|
lineWidth: Number(lineWidth),
|
|
10613
|
+
fillColor,
|
|
9995
10614
|
id
|
|
9996
10615
|
};
|
|
9997
10616
|
};
|
|
@@ -10003,10 +10622,11 @@ var EllipseShapeOutputSchema = external_exports.object({
|
|
|
10003
10622
|
radiusY: external_exports.number(),
|
|
10004
10623
|
color: external_exports.string(),
|
|
10005
10624
|
lineWidth: external_exports.number(),
|
|
10625
|
+
fillColor: external_exports.string().optional(),
|
|
10006
10626
|
id: external_exports.string()
|
|
10007
10627
|
});
|
|
10008
10628
|
var parseEllipse = (str) => {
|
|
10009
|
-
const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
|
|
10629
|
+
const [, x, y, radiusX, radiusY, color, lineWidth, , fillColor, id] = str.split("~");
|
|
10010
10630
|
return {
|
|
10011
10631
|
type: "ELLIPSE",
|
|
10012
10632
|
center: { x: Number(x), y: Number(y) },
|
|
@@ -10014,12 +10634,14 @@ var parseEllipse = (str) => {
|
|
|
10014
10634
|
radiusY: Number(radiusY),
|
|
10015
10635
|
color,
|
|
10016
10636
|
lineWidth: Number(lineWidth),
|
|
10637
|
+
fillColor,
|
|
10017
10638
|
id
|
|
10018
10639
|
};
|
|
10019
10640
|
};
|
|
10020
10641
|
var EllipseShapeSchema = external_exports.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
10021
10642
|
var ArcShapeOutputSchema = external_exports.object({
|
|
10022
10643
|
type: external_exports.literal("ARC"),
|
|
10644
|
+
pathData: external_exports.string(),
|
|
10023
10645
|
start: PointSchema2,
|
|
10024
10646
|
end: PointSchema2,
|
|
10025
10647
|
radius: external_exports.number(),
|
|
@@ -10029,26 +10651,25 @@ var ArcShapeOutputSchema = external_exports.object({
|
|
|
10029
10651
|
id: external_exports.string()
|
|
10030
10652
|
});
|
|
10031
10653
|
var parseArc = (str) => {
|
|
10032
|
-
const [, pathData,
|
|
10033
|
-
const
|
|
10034
|
-
const
|
|
10035
|
-
const
|
|
10036
|
-
const
|
|
10037
|
-
const
|
|
10038
|
-
const x2 =
|
|
10039
|
-
const y2 = Number(parts[9]) || 0;
|
|
10654
|
+
const [, pathData, ...fields] = str.split("~");
|
|
10655
|
+
const colorIndex = fields.findIndex((field) => /^#[0-9a-f]{6}$/i.test(field));
|
|
10656
|
+
const color = fields[colorIndex] || "#880000";
|
|
10657
|
+
const lineWidth = fields[colorIndex + 1];
|
|
10658
|
+
const id = fields.find((field) => /^(?:gge|rep)/.test(field)) || "gge1";
|
|
10659
|
+
const numbers = pathData.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
|
|
10660
|
+
const [x1 = 0, y1 = 0, radius = 0, , , , sweepFlag = 0, x2 = 0, y2 = 0] = numbers;
|
|
10040
10661
|
const parsedLineWidth = Number(lineWidth);
|
|
10041
10662
|
const finalLineWidth = Number.isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
10042
10663
|
return {
|
|
10043
10664
|
type: "ARC",
|
|
10665
|
+
pathData,
|
|
10044
10666
|
start: { x: x1, y: y1 },
|
|
10045
10667
|
end: { x: x2, y: y2 },
|
|
10046
10668
|
radius,
|
|
10047
|
-
sweepFlag,
|
|
10048
|
-
color
|
|
10049
|
-
// Default color
|
|
10669
|
+
sweepFlag: sweepFlag === 1,
|
|
10670
|
+
color,
|
|
10050
10671
|
lineWidth: finalLineWidth,
|
|
10051
|
-
id
|
|
10672
|
+
id
|
|
10052
10673
|
};
|
|
10053
10674
|
};
|
|
10054
10675
|
var ArcShapeSchema = external_exports.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema);
|
|
@@ -10076,8 +10697,7 @@ var parsePin = (pinString) => {
|
|
|
10076
10697
|
if (/^\+\d+(?:\.\d+)?V$/i.test(label)) label = `V${label.slice(1, -1)}`;
|
|
10077
10698
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
10078
10699
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
10079
|
-
const
|
|
10080
|
-
const path = pathMatch ? pathMatch[1] : "";
|
|
10700
|
+
const path = pinString.split("^^")[2]?.split("~")[0] ?? "";
|
|
10081
10701
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
10082
10702
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
10083
10703
|
const r = Number.parseFloat(rotation2);
|
|
@@ -10135,7 +10755,7 @@ var PolygonShapeOutputSchema = external_exports.object({
|
|
|
10135
10755
|
});
|
|
10136
10756
|
var parsePolygon = (str) => {
|
|
10137
10757
|
const [, ...rest] = str.split("~");
|
|
10138
|
-
const [pointsStr,
|
|
10758
|
+
const [pointsStr, lineColor, lineWidth, , fillColor, id] = rest;
|
|
10139
10759
|
return {
|
|
10140
10760
|
type: "POLYGON",
|
|
10141
10761
|
points: parsePoints2(pointsStr),
|
|
@@ -10155,7 +10775,7 @@ var PathShapeOutputSchema = external_exports.object({
|
|
|
10155
10775
|
id: external_exports.string()
|
|
10156
10776
|
});
|
|
10157
10777
|
var parsePath = (str) => {
|
|
10158
|
-
const [, pathData,
|
|
10778
|
+
const [, pathData, strokeColor, strokeWidth, , fillColor, id] = str.split("~");
|
|
10159
10779
|
return {
|
|
10160
10780
|
type: "PATH",
|
|
10161
10781
|
pathData,
|
|
@@ -10205,8 +10825,8 @@ var parseText = (str) => {
|
|
|
10205
10825
|
fontWeight,
|
|
10206
10826
|
fontStyle,
|
|
10207
10827
|
fontDecoration,
|
|
10208
|
-
content,
|
|
10209
10828
|
textType,
|
|
10829
|
+
content,
|
|
10210
10830
|
visibility,
|
|
10211
10831
|
mirror,
|
|
10212
10832
|
id
|
|
@@ -10489,7 +11109,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
|
|
|
10489
11109
|
body: searchData
|
|
10490
11110
|
});
|
|
10491
11111
|
if (!searchResponse.ok) {
|
|
10492
|
-
|
|
11112
|
+
if (searchResponse.status === 403) {
|
|
11113
|
+
throw new Error(
|
|
11114
|
+
`EasyEDA API rate limit exceeded while searching for "${jlcpcbPartNumber}" (HTTP 403). EasyEDA rate-limits by IP \u2014 the part number is likely fine. Wait ~2 minutes and try again.`
|
|
11115
|
+
);
|
|
11116
|
+
}
|
|
11117
|
+
throw new Error(
|
|
11118
|
+
`Failed to search for the component (HTTP ${searchResponse.status})`
|
|
11119
|
+
);
|
|
10493
11120
|
}
|
|
10494
11121
|
const searchResult = await searchResponse.json();
|
|
10495
11122
|
if (!searchResult.success || !searchResult.result.lists.lcsc.length) {
|
|
@@ -10507,7 +11134,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, {
|
|
|
10507
11134
|
}
|
|
10508
11135
|
});
|
|
10509
11136
|
if (!componentResponse.ok) {
|
|
10510
|
-
|
|
11137
|
+
if (componentResponse.status === 403) {
|
|
11138
|
+
throw new Error(
|
|
11139
|
+
`EasyEDA API rate limit exceeded while fetching "${jlcpcbPartNumber}" (HTTP 403). EasyEDA rate-limits by IP \u2014 the part number is likely fine. Wait ~2 minutes and try again.`
|
|
11140
|
+
);
|
|
11141
|
+
}
|
|
11142
|
+
throw new Error(
|
|
11143
|
+
`Failed to fetch the component details (HTTP ${componentResponse.status})`
|
|
11144
|
+
);
|
|
10511
11145
|
}
|
|
10512
11146
|
const componentResult = await componentResponse.json();
|
|
10513
11147
|
const result = componentResult.result;
|
|
@@ -10657,6 +11291,34 @@ var getFetchWithEasyEdaProxy = ({
|
|
|
10657
11291
|
};
|
|
10658
11292
|
};
|
|
10659
11293
|
|
|
11294
|
+
// lib/jlc-parts-engine/get-pin-header-search-params.ts
|
|
11295
|
+
var parseMillimeters = (value) => {
|
|
11296
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
11297
|
+
if (typeof value !== "string") return void 0;
|
|
11298
|
+
const match = value.trim().match(/^(\d+(?:\.\d+)?)(?:\s*mm)?$/i);
|
|
11299
|
+
if (!match) return void 0;
|
|
11300
|
+
return Number(match[1]);
|
|
11301
|
+
};
|
|
11302
|
+
var parsePinHeaderPitchFromFootprinterString = (footprinterString) => {
|
|
11303
|
+
const match = footprinterString?.match(
|
|
11304
|
+
/(?:^|_)p(\d+(?:\.\d+)?)(?:mm)?(?:_|$)/i
|
|
11305
|
+
);
|
|
11306
|
+
return match ? Number(match[1]) : void 0;
|
|
11307
|
+
};
|
|
11308
|
+
var isKnownPinHeaderGender = (gender) => gender === "male" || gender === "female";
|
|
11309
|
+
var getPinHeaderSearchParams = (sourceComponent, footprinterString) => {
|
|
11310
|
+
const pitch = parseMillimeters(sourceComponent.pitch) ?? parsePinHeaderPitchFromFootprinterString(footprinterString);
|
|
11311
|
+
const numPins = sourceComponent.pin_count ?? sourceComponent.pinCount ?? sourceComponent.num_pins;
|
|
11312
|
+
const gender = isKnownPinHeaderGender(sourceComponent.gender) ? sourceComponent.gender : void 0;
|
|
11313
|
+
const isRightAngle = sourceComponent.is_right_angle ?? sourceComponent.right_angle ?? sourceComponent.rightAngle;
|
|
11314
|
+
return {
|
|
11315
|
+
...pitch ? { pitch } : {},
|
|
11316
|
+
...typeof numPins === "number" ? { num_pins: numPins } : {},
|
|
11317
|
+
...gender ? { gender } : {},
|
|
11318
|
+
...typeof isRightAngle === "boolean" ? { is_right_angle: isRightAngle } : {}
|
|
11319
|
+
};
|
|
11320
|
+
};
|
|
11321
|
+
|
|
10660
11322
|
// lib/jlc-parts-engine/jlc-parts-cache.ts
|
|
10661
11323
|
var cache = /* @__PURE__ */ new Map();
|
|
10662
11324
|
var getJlcPartsCached = async (name, params) => {
|
|
@@ -10682,6 +11344,7 @@ var withBasicPartPreference = (parts) => {
|
|
|
10682
11344
|
};
|
|
10683
11345
|
|
|
10684
11346
|
// lib/jlc-parts-engine/JlcPartsEngine.ts
|
|
11347
|
+
var normalizePartNumber = (partNumber) => typeof partNumber === "string" ? partNumber.trim().toLowerCase() : void 0;
|
|
10685
11348
|
var JlcPcbPartsEngine = class {
|
|
10686
11349
|
defaultPlatformFetch;
|
|
10687
11350
|
easyEdaProxyConfig;
|
|
@@ -10725,20 +11388,9 @@ var JlcPcbPartsEngine = class {
|
|
|
10725
11388
|
jlcpcb: withBasicPartPreference(capacitors).map((c) => `C${c.lcsc}`).slice(0, 3)
|
|
10726
11389
|
};
|
|
10727
11390
|
} else if (sourceComponent.type === "source_component" && sourceComponent.ftype === "simple_pin_header") {
|
|
10728
|
-
let pitch;
|
|
10729
|
-
if (footprinterString?.includes("_p")) {
|
|
10730
|
-
pitch = Number(footprinterString.split("_p")[1]);
|
|
10731
|
-
}
|
|
10732
11391
|
const { headers } = await getJlcPartsCached(
|
|
10733
11392
|
"headers",
|
|
10734
|
-
|
|
10735
|
-
pitch,
|
|
10736
|
-
num_pins: sourceComponent.pin_count,
|
|
10737
|
-
gender: sourceComponent.gender
|
|
10738
|
-
} : {
|
|
10739
|
-
num_pins: sourceComponent.pin_count,
|
|
10740
|
-
gender: sourceComponent.gender
|
|
10741
|
-
}
|
|
11393
|
+
getPinHeaderSearchParams(sourceComponent, footprinterString)
|
|
10742
11394
|
);
|
|
10743
11395
|
return {
|
|
10744
11396
|
jlcpcb: withBasicPartPreference(headers).map((h) => `C${h.lcsc}`).slice(0, 3)
|
|
@@ -10864,7 +11516,14 @@ var JlcPcbPartsEngine = class {
|
|
|
10864
11516
|
const { components } = await getJlcPartsCached("components", {
|
|
10865
11517
|
search: manufacturerPartNumber
|
|
10866
11518
|
});
|
|
10867
|
-
|
|
11519
|
+
const normalizedManufacturerPartNumber = normalizePartNumber(
|
|
11520
|
+
manufacturerPartNumber
|
|
11521
|
+
);
|
|
11522
|
+
const exactManufacturerPartMatch = components?.find(
|
|
11523
|
+
(component) => normalizePartNumber(component.mfr) === normalizedManufacturerPartNumber
|
|
11524
|
+
);
|
|
11525
|
+
const componentMatch = exactManufacturerPartMatch ?? components?.[0];
|
|
11526
|
+
resolvedSupplierPartNumber = componentMatch ? `C${componentMatch.lcsc}` : void 0;
|
|
10868
11527
|
}
|
|
10869
11528
|
if (!resolvedSupplierPartNumber) return void 0;
|
|
10870
11529
|
const rawEasyEdaJson = await fetchEasyEDAComponent(
|