easyeda 0.0.61 → 0.0.63
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.
|
@@ -11,6 +11,7 @@ __export(dist_exports, {
|
|
|
11
11
|
any_circuit_element: () => any_circuit_element,
|
|
12
12
|
any_soup_element: () => any_soup_element,
|
|
13
13
|
any_source_component: () => any_source_component,
|
|
14
|
+
battery_capacity: () => battery_capacity,
|
|
14
15
|
cad_component: () => cad_component,
|
|
15
16
|
capacitance: () => capacitance,
|
|
16
17
|
current: () => current,
|
|
@@ -59,6 +60,11 @@ __export(dist_exports, {
|
|
|
59
60
|
route_hint_point: () => route_hint_point,
|
|
60
61
|
schematic_box: () => schematic_box,
|
|
61
62
|
schematic_component: () => schematic_component,
|
|
63
|
+
schematic_debug_line: () => schematic_debug_line,
|
|
64
|
+
schematic_debug_object: () => schematic_debug_object,
|
|
65
|
+
schematic_debug_object_base: () => schematic_debug_object_base,
|
|
66
|
+
schematic_debug_point: () => schematic_debug_point,
|
|
67
|
+
schematic_debug_rect: () => schematic_debug_rect,
|
|
62
68
|
schematic_error: () => schematic_error,
|
|
63
69
|
schematic_line: () => schematic_line,
|
|
64
70
|
schematic_net_label: () => schematic_net_label,
|
|
@@ -73,11 +79,13 @@ __export(dist_exports, {
|
|
|
73
79
|
source_led: () => source_led,
|
|
74
80
|
source_net: () => source_net,
|
|
75
81
|
source_port: () => source_port,
|
|
82
|
+
source_simple_battery: () => source_simple_battery,
|
|
76
83
|
source_simple_bug: () => source_simple_bug,
|
|
77
84
|
source_simple_capacitor: () => source_simple_capacitor,
|
|
78
85
|
source_simple_chip: () => source_simple_chip,
|
|
79
86
|
source_simple_diode: () => source_simple_diode,
|
|
80
87
|
source_simple_ground: () => source_simple_ground,
|
|
88
|
+
source_simple_inductor: () => source_simple_inductor,
|
|
81
89
|
source_simple_power_source: () => source_simple_power_source,
|
|
82
90
|
source_simple_resistor: () => source_simple_resistor,
|
|
83
91
|
source_trace: () => source_trace,
|
|
@@ -134,8 +142,8 @@ import { z as z13 } from "zod";
|
|
|
134
142
|
import { z as z14 } from "zod";
|
|
135
143
|
import { z as z15 } from "zod";
|
|
136
144
|
import { z as z16 } from "zod";
|
|
137
|
-
import { z as z17 } from "zod";
|
|
138
145
|
import { z as z18 } from "zod";
|
|
146
|
+
import { z as z17 } from "zod";
|
|
139
147
|
import { z as z19 } from "zod";
|
|
140
148
|
import { z as z20 } from "zod";
|
|
141
149
|
import { z as z21 } from "zod";
|
|
@@ -176,6 +184,8 @@ import { z as z55 } from "zod";
|
|
|
176
184
|
import { z as z56 } from "zod";
|
|
177
185
|
import { z as z57 } from "zod";
|
|
178
186
|
import { z as z58 } from "zod";
|
|
187
|
+
import { z as z59 } from "zod";
|
|
188
|
+
import { z as z60 } from "zod";
|
|
179
189
|
var unitMappings = {
|
|
180
190
|
Hz: {
|
|
181
191
|
baseUnit: "Hz",
|
|
@@ -272,7 +282,8 @@ var unitMappings = {
|
|
|
272
282
|
IN: 25.4,
|
|
273
283
|
FT: 304.8,
|
|
274
284
|
yd: 914.4,
|
|
275
|
-
mi: 1609344
|
|
285
|
+
mi: 1609344,
|
|
286
|
+
mil: 0.0254
|
|
276
287
|
}
|
|
277
288
|
}
|
|
278
289
|
};
|
|
@@ -343,6 +354,17 @@ var rotation = z.string().or(z.number()).transform((arg) => {
|
|
|
343
354
|
}
|
|
344
355
|
return Number.parseFloat(arg);
|
|
345
356
|
});
|
|
357
|
+
var battery_capacity = z.number().or(z.string().endsWith("mAh")).transform((v) => {
|
|
358
|
+
if (typeof v === "string") {
|
|
359
|
+
const valString = v.replace("mAh", "");
|
|
360
|
+
const num = Number.parseFloat(valString);
|
|
361
|
+
if (Number.isNaN(num)) {
|
|
362
|
+
throw new Error("Invalid capacity");
|
|
363
|
+
}
|
|
364
|
+
return num;
|
|
365
|
+
}
|
|
366
|
+
return v;
|
|
367
|
+
}).describe("Battery capacity in mAh");
|
|
346
368
|
var point = z2.object({
|
|
347
369
|
x: distance,
|
|
348
370
|
y: distance
|
|
@@ -375,7 +397,8 @@ var source_component_base = z7.object({
|
|
|
375
397
|
source_component_id: z7.string(),
|
|
376
398
|
name: z7.string(),
|
|
377
399
|
manufacturer_part_number: z7.string().optional(),
|
|
378
|
-
supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional()
|
|
400
|
+
supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional(),
|
|
401
|
+
display_value: z7.string().optional()
|
|
379
402
|
});
|
|
380
403
|
var source_simple_capacitor = source_component_base.extend({
|
|
381
404
|
ftype: z8.literal("simple_capacitor"),
|
|
@@ -408,7 +431,11 @@ var source_simple_power_source = source_component_base.extend({
|
|
|
408
431
|
ftype: z16.literal("simple_power_source"),
|
|
409
432
|
voltage
|
|
410
433
|
});
|
|
411
|
-
var
|
|
434
|
+
var source_simple_battery = source_component_base.extend({
|
|
435
|
+
ftype: z17.literal("simple_battery"),
|
|
436
|
+
capacity: battery_capacity
|
|
437
|
+
});
|
|
438
|
+
var any_source_component = z18.union([
|
|
412
439
|
source_simple_resistor,
|
|
413
440
|
source_simple_capacitor,
|
|
414
441
|
source_simple_diode,
|
|
@@ -416,161 +443,191 @@ var any_source_component = z17.union([
|
|
|
416
443
|
source_simple_chip,
|
|
417
444
|
source_simple_bug,
|
|
418
445
|
source_led,
|
|
419
|
-
source_simple_power_source
|
|
446
|
+
source_simple_power_source,
|
|
447
|
+
source_simple_battery,
|
|
448
|
+
source_simple_inductor
|
|
420
449
|
]);
|
|
421
|
-
var source_port =
|
|
422
|
-
type:
|
|
423
|
-
pin_number:
|
|
424
|
-
port_hints:
|
|
425
|
-
name:
|
|
426
|
-
source_port_id:
|
|
427
|
-
source_component_id:
|
|
428
|
-
});
|
|
429
|
-
var source_trace =
|
|
430
|
-
type:
|
|
431
|
-
source_trace_id:
|
|
432
|
-
connected_source_port_ids:
|
|
433
|
-
connected_source_net_ids:
|
|
434
|
-
});
|
|
435
|
-
var source_group =
|
|
436
|
-
type:
|
|
437
|
-
source_group_id:
|
|
438
|
-
name:
|
|
439
|
-
});
|
|
440
|
-
var source_net =
|
|
441
|
-
type:
|
|
442
|
-
source_net_id:
|
|
443
|
-
name:
|
|
444
|
-
member_source_group_ids:
|
|
445
|
-
is_power:
|
|
446
|
-
is_ground:
|
|
447
|
-
is_digital_signal:
|
|
448
|
-
is_analog_signal:
|
|
449
|
-
trace_width:
|
|
450
|
-
});
|
|
451
|
-
var schematic_box =
|
|
452
|
-
type:
|
|
453
|
-
schematic_component_id:
|
|
450
|
+
var source_port = z19.object({
|
|
451
|
+
type: z19.literal("source_port"),
|
|
452
|
+
pin_number: z19.number().optional(),
|
|
453
|
+
port_hints: z19.array(z19.string()).optional(),
|
|
454
|
+
name: z19.string(),
|
|
455
|
+
source_port_id: z19.string(),
|
|
456
|
+
source_component_id: z19.string()
|
|
457
|
+
});
|
|
458
|
+
var source_trace = z20.object({
|
|
459
|
+
type: z20.literal("source_trace"),
|
|
460
|
+
source_trace_id: z20.string(),
|
|
461
|
+
connected_source_port_ids: z20.array(z20.string()),
|
|
462
|
+
connected_source_net_ids: z20.array(z20.string())
|
|
463
|
+
});
|
|
464
|
+
var source_group = z21.object({
|
|
465
|
+
type: z21.literal("source_group"),
|
|
466
|
+
source_group_id: z21.string(),
|
|
467
|
+
name: z21.string().optional()
|
|
468
|
+
});
|
|
469
|
+
var source_net = z22.object({
|
|
470
|
+
type: z22.literal("source_net"),
|
|
471
|
+
source_net_id: z22.string(),
|
|
472
|
+
name: z22.string(),
|
|
473
|
+
member_source_group_ids: z22.array(z22.string()),
|
|
474
|
+
is_power: z22.boolean().optional(),
|
|
475
|
+
is_ground: z22.boolean().optional(),
|
|
476
|
+
is_digital_signal: z22.boolean().optional(),
|
|
477
|
+
is_analog_signal: z22.boolean().optional(),
|
|
478
|
+
trace_width: z22.number().optional()
|
|
479
|
+
});
|
|
480
|
+
var schematic_box = z23.object({
|
|
481
|
+
type: z23.literal("schematic_box"),
|
|
482
|
+
schematic_component_id: z23.string(),
|
|
454
483
|
width: distance,
|
|
455
484
|
height: distance,
|
|
456
485
|
x: distance,
|
|
457
486
|
y: distance
|
|
458
487
|
}).describe("Draws a box on the schematic");
|
|
459
|
-
var schematic_path =
|
|
460
|
-
type:
|
|
461
|
-
schematic_component_id:
|
|
462
|
-
fill_color:
|
|
463
|
-
is_filled:
|
|
464
|
-
points:
|
|
488
|
+
var schematic_path = z24.object({
|
|
489
|
+
type: z24.literal("schematic_path"),
|
|
490
|
+
schematic_component_id: z24.string(),
|
|
491
|
+
fill_color: z24.enum(["red", "blue"]).optional(),
|
|
492
|
+
is_filled: z24.boolean().optional(),
|
|
493
|
+
points: z24.array(point)
|
|
465
494
|
});
|
|
466
|
-
var schematic_pin_styles =
|
|
467
|
-
|
|
495
|
+
var schematic_pin_styles = z25.record(
|
|
496
|
+
z25.object({
|
|
468
497
|
left_margin: length.optional(),
|
|
469
498
|
right_margin: length.optional(),
|
|
470
499
|
top_margin: length.optional(),
|
|
471
500
|
bottom_margin: length.optional()
|
|
472
501
|
})
|
|
473
502
|
);
|
|
474
|
-
var schematic_component =
|
|
475
|
-
type:
|
|
503
|
+
var schematic_component = z25.object({
|
|
504
|
+
type: z25.literal("schematic_component"),
|
|
476
505
|
rotation: rotation.default(0),
|
|
477
506
|
size,
|
|
478
507
|
center: point,
|
|
479
|
-
source_component_id:
|
|
480
|
-
schematic_component_id:
|
|
508
|
+
source_component_id: z25.string(),
|
|
509
|
+
schematic_component_id: z25.string(),
|
|
481
510
|
pin_spacing: length.optional(),
|
|
482
511
|
pin_styles: schematic_pin_styles.optional(),
|
|
483
512
|
box_width: length.optional(),
|
|
484
|
-
symbol_name:
|
|
485
|
-
port_arrangement:
|
|
486
|
-
|
|
487
|
-
left_size:
|
|
488
|
-
right_size:
|
|
489
|
-
top_size:
|
|
490
|
-
bottom_size:
|
|
513
|
+
symbol_name: z25.string().optional(),
|
|
514
|
+
port_arrangement: z25.union([
|
|
515
|
+
z25.object({
|
|
516
|
+
left_size: z25.number(),
|
|
517
|
+
right_size: z25.number(),
|
|
518
|
+
top_size: z25.number().optional(),
|
|
519
|
+
bottom_size: z25.number().optional()
|
|
491
520
|
}),
|
|
492
|
-
|
|
493
|
-
left_side:
|
|
494
|
-
pins:
|
|
495
|
-
direction:
|
|
521
|
+
z25.object({
|
|
522
|
+
left_side: z25.object({
|
|
523
|
+
pins: z25.array(z25.number()),
|
|
524
|
+
direction: z25.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
496
525
|
}).optional(),
|
|
497
|
-
right_side:
|
|
498
|
-
pins:
|
|
499
|
-
direction:
|
|
526
|
+
right_side: z25.object({
|
|
527
|
+
pins: z25.array(z25.number()),
|
|
528
|
+
direction: z25.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
500
529
|
}).optional(),
|
|
501
|
-
top_side:
|
|
502
|
-
pins:
|
|
503
|
-
direction:
|
|
530
|
+
top_side: z25.object({
|
|
531
|
+
pins: z25.array(z25.number()),
|
|
532
|
+
direction: z25.enum(["left-to-right", "right-to-left"]).optional()
|
|
504
533
|
}).optional(),
|
|
505
|
-
bottom_side:
|
|
506
|
-
pins:
|
|
507
|
-
direction:
|
|
534
|
+
bottom_side: z25.object({
|
|
535
|
+
pins: z25.array(z25.number()),
|
|
536
|
+
direction: z25.enum(["left-to-right", "right-to-left"]).optional()
|
|
508
537
|
}).optional()
|
|
509
538
|
})
|
|
510
539
|
]).optional(),
|
|
511
|
-
port_labels:
|
|
540
|
+
port_labels: z25.record(z25.string()).optional()
|
|
512
541
|
});
|
|
513
|
-
var schematic_line =
|
|
514
|
-
type:
|
|
515
|
-
schematic_component_id:
|
|
542
|
+
var schematic_line = z26.object({
|
|
543
|
+
type: z26.literal("schematic_line"),
|
|
544
|
+
schematic_component_id: z26.string(),
|
|
516
545
|
x1: distance,
|
|
517
546
|
x2: distance,
|
|
518
547
|
y1: distance,
|
|
519
548
|
y2: distance
|
|
520
549
|
});
|
|
521
|
-
var schematic_trace =
|
|
522
|
-
type:
|
|
523
|
-
schematic_trace_id:
|
|
524
|
-
source_trace_id:
|
|
525
|
-
edges:
|
|
526
|
-
|
|
527
|
-
from:
|
|
528
|
-
x:
|
|
529
|
-
y:
|
|
550
|
+
var schematic_trace = z27.object({
|
|
551
|
+
type: z27.literal("schematic_trace"),
|
|
552
|
+
schematic_trace_id: z27.string(),
|
|
553
|
+
source_trace_id: z27.string(),
|
|
554
|
+
edges: z27.array(
|
|
555
|
+
z27.object({
|
|
556
|
+
from: z27.object({
|
|
557
|
+
x: z27.number(),
|
|
558
|
+
y: z27.number()
|
|
530
559
|
}),
|
|
531
|
-
to:
|
|
532
|
-
x:
|
|
533
|
-
y:
|
|
560
|
+
to: z27.object({
|
|
561
|
+
x: z27.number(),
|
|
562
|
+
y: z27.number()
|
|
534
563
|
}),
|
|
535
|
-
from_schematic_port_id:
|
|
536
|
-
to_schematic_port_id:
|
|
564
|
+
from_schematic_port_id: z27.string().optional(),
|
|
565
|
+
to_schematic_port_id: z27.string().optional()
|
|
537
566
|
})
|
|
538
567
|
)
|
|
539
568
|
});
|
|
540
|
-
var schematic_text =
|
|
541
|
-
type:
|
|
542
|
-
schematic_component_id:
|
|
543
|
-
schematic_text_id:
|
|
544
|
-
text:
|
|
545
|
-
position:
|
|
569
|
+
var schematic_text = z28.object({
|
|
570
|
+
type: z28.literal("schematic_text"),
|
|
571
|
+
schematic_component_id: z28.string(),
|
|
572
|
+
schematic_text_id: z28.string(),
|
|
573
|
+
text: z28.string(),
|
|
574
|
+
position: z28.object({
|
|
546
575
|
x: distance,
|
|
547
576
|
y: distance
|
|
548
577
|
}),
|
|
549
|
-
rotation:
|
|
550
|
-
anchor:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
578
|
+
rotation: z28.number().default(0),
|
|
579
|
+
anchor: z28.enum(["center", "left", "right", "top", "bottom"]).default("center"),
|
|
580
|
+
color: z28.string().default("#000000")
|
|
581
|
+
});
|
|
582
|
+
var schematic_port = z29.object({
|
|
583
|
+
type: z29.literal("schematic_port"),
|
|
584
|
+
schematic_port_id: z29.string(),
|
|
585
|
+
source_port_id: z29.string(),
|
|
586
|
+
schematic_component_id: z29.string().optional(),
|
|
557
587
|
center: point,
|
|
558
|
-
facing_direction:
|
|
588
|
+
facing_direction: z29.enum(["up", "down", "left", "right"]).optional(),
|
|
589
|
+
distance_from_component_edge: z29.number().optional(),
|
|
590
|
+
side_of_component: z29.enum(["top", "bottom", "left", "right"]).optional(),
|
|
591
|
+
true_ccw_index: z29.number().optional(),
|
|
592
|
+
pin_number: z29.number().optional()
|
|
559
593
|
}).describe("Defines a port on a schematic component");
|
|
560
|
-
var schematic_net_label =
|
|
561
|
-
type:
|
|
562
|
-
source_net_id:
|
|
594
|
+
var schematic_net_label = z30.object({
|
|
595
|
+
type: z30.literal("schematic_net_label"),
|
|
596
|
+
source_net_id: z30.string(),
|
|
563
597
|
center: point,
|
|
564
|
-
anchor_side:
|
|
565
|
-
text:
|
|
598
|
+
anchor_side: z30.enum(["top", "bottom", "left", "right"]),
|
|
599
|
+
text: z30.string()
|
|
566
600
|
});
|
|
567
|
-
var schematic_error =
|
|
568
|
-
schematic_error_id:
|
|
569
|
-
type:
|
|
601
|
+
var schematic_error = z31.object({
|
|
602
|
+
schematic_error_id: z31.string(),
|
|
603
|
+
type: z31.literal("schematic_error"),
|
|
570
604
|
// eventually each error type should be broken out into a dir of files
|
|
571
|
-
error_type:
|
|
572
|
-
message:
|
|
605
|
+
error_type: z31.literal("schematic_port_not_found"),
|
|
606
|
+
message: z31.string()
|
|
573
607
|
}).describe("Defines a schematic error on the schematic");
|
|
608
|
+
var schematic_debug_object_base = z32.object({
|
|
609
|
+
type: z32.literal("schematic_debug_object"),
|
|
610
|
+
label: z32.string().optional()
|
|
611
|
+
});
|
|
612
|
+
var schematic_debug_rect = schematic_debug_object_base.extend({
|
|
613
|
+
shape: z32.literal("rect"),
|
|
614
|
+
center: point,
|
|
615
|
+
size
|
|
616
|
+
});
|
|
617
|
+
var schematic_debug_line = schematic_debug_object_base.extend({
|
|
618
|
+
shape: z32.literal("line"),
|
|
619
|
+
start: point,
|
|
620
|
+
end: point
|
|
621
|
+
});
|
|
622
|
+
var schematic_debug_point = schematic_debug_object_base.extend({
|
|
623
|
+
shape: z32.literal("point"),
|
|
624
|
+
center: point
|
|
625
|
+
});
|
|
626
|
+
var schematic_debug_object = z32.discriminatedUnion("shape", [
|
|
627
|
+
schematic_debug_rect,
|
|
628
|
+
schematic_debug_line,
|
|
629
|
+
schematic_debug_point
|
|
630
|
+
]);
|
|
574
631
|
var all_layers = [
|
|
575
632
|
"top",
|
|
576
633
|
"bottom",
|
|
@@ -581,9 +638,9 @@ var all_layers = [
|
|
|
581
638
|
"inner5",
|
|
582
639
|
"inner6"
|
|
583
640
|
];
|
|
584
|
-
var layer_string =
|
|
641
|
+
var layer_string = z33.enum(all_layers);
|
|
585
642
|
var layer_ref = layer_string.or(
|
|
586
|
-
|
|
643
|
+
z33.object({
|
|
587
644
|
name: layer_string
|
|
588
645
|
})
|
|
589
646
|
).transform((layer) => {
|
|
@@ -592,27 +649,27 @@ var layer_ref = layer_string.or(
|
|
|
592
649
|
}
|
|
593
650
|
return layer.name;
|
|
594
651
|
});
|
|
595
|
-
var visible_layer =
|
|
596
|
-
var pcb_route_hint =
|
|
652
|
+
var visible_layer = z33.enum(["top", "bottom"]);
|
|
653
|
+
var pcb_route_hint = z34.object({
|
|
597
654
|
x: distance,
|
|
598
655
|
y: distance,
|
|
599
|
-
via:
|
|
656
|
+
via: z34.boolean().optional(),
|
|
600
657
|
via_to_layer: layer_ref.optional()
|
|
601
658
|
});
|
|
602
|
-
var pcb_route_hints =
|
|
603
|
-
var route_hint_point =
|
|
659
|
+
var pcb_route_hints = z34.array(pcb_route_hint);
|
|
660
|
+
var route_hint_point = z35.object({
|
|
604
661
|
x: distance,
|
|
605
662
|
y: distance,
|
|
606
|
-
via:
|
|
663
|
+
via: z35.boolean().optional(),
|
|
607
664
|
to_layer: layer_ref.optional(),
|
|
608
665
|
trace_width: distance.optional()
|
|
609
666
|
});
|
|
610
667
|
var expectTypesMatch = (shouldBe) => {
|
|
611
668
|
};
|
|
612
|
-
var pcb_component =
|
|
613
|
-
type:
|
|
669
|
+
var pcb_component = z36.object({
|
|
670
|
+
type: z36.literal("pcb_component"),
|
|
614
671
|
pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
|
|
615
|
-
source_component_id:
|
|
672
|
+
source_component_id: z36.string(),
|
|
616
673
|
center: point,
|
|
617
674
|
layer: layer_ref,
|
|
618
675
|
rotation,
|
|
@@ -620,11 +677,11 @@ var pcb_component = z34.object({
|
|
|
620
677
|
height: length
|
|
621
678
|
}).describe("Defines a component on the PCB");
|
|
622
679
|
expectTypesMatch(true);
|
|
623
|
-
var pcb_hole_circle_or_square =
|
|
624
|
-
type:
|
|
680
|
+
var pcb_hole_circle_or_square = z37.object({
|
|
681
|
+
type: z37.literal("pcb_hole"),
|
|
625
682
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
626
|
-
hole_shape:
|
|
627
|
-
hole_diameter:
|
|
683
|
+
hole_shape: z37.enum(["circle", "square"]),
|
|
684
|
+
hole_diameter: z37.number(),
|
|
628
685
|
x: distance,
|
|
629
686
|
y: distance
|
|
630
687
|
});
|
|
@@ -632,12 +689,12 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
|
|
|
632
689
|
"Defines a circular or square hole on the PCB"
|
|
633
690
|
);
|
|
634
691
|
expectTypesMatch(true);
|
|
635
|
-
var pcb_hole_oval =
|
|
636
|
-
type:
|
|
692
|
+
var pcb_hole_oval = z37.object({
|
|
693
|
+
type: z37.literal("pcb_hole"),
|
|
637
694
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
638
|
-
hole_shape:
|
|
639
|
-
hole_width:
|
|
640
|
-
hole_height:
|
|
695
|
+
hole_shape: z37.literal("oval"),
|
|
696
|
+
hole_width: z37.number(),
|
|
697
|
+
hole_height: z37.number(),
|
|
641
698
|
x: distance,
|
|
642
699
|
y: distance
|
|
643
700
|
});
|
|
@@ -646,35 +703,35 @@ var pcb_hole_oval_shape = pcb_hole_oval.describe(
|
|
|
646
703
|
);
|
|
647
704
|
expectTypesMatch(true);
|
|
648
705
|
var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
|
|
649
|
-
var pcb_plated_hole_circle =
|
|
650
|
-
type:
|
|
651
|
-
shape:
|
|
652
|
-
outer_diameter:
|
|
653
|
-
hole_diameter:
|
|
706
|
+
var pcb_plated_hole_circle = z38.object({
|
|
707
|
+
type: z38.literal("pcb_plated_hole"),
|
|
708
|
+
shape: z38.literal("circle"),
|
|
709
|
+
outer_diameter: z38.number(),
|
|
710
|
+
hole_diameter: z38.number(),
|
|
654
711
|
x: distance,
|
|
655
712
|
y: distance,
|
|
656
|
-
layers:
|
|
657
|
-
port_hints:
|
|
658
|
-
pcb_component_id:
|
|
659
|
-
pcb_port_id:
|
|
713
|
+
layers: z38.array(layer_ref),
|
|
714
|
+
port_hints: z38.array(z38.string()).optional(),
|
|
715
|
+
pcb_component_id: z38.string().optional(),
|
|
716
|
+
pcb_port_id: z38.string().optional(),
|
|
660
717
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
661
718
|
});
|
|
662
|
-
var pcb_plated_hole_oval =
|
|
663
|
-
type:
|
|
664
|
-
shape:
|
|
665
|
-
outer_width:
|
|
666
|
-
outer_height:
|
|
667
|
-
hole_width:
|
|
668
|
-
hole_height:
|
|
719
|
+
var pcb_plated_hole_oval = z38.object({
|
|
720
|
+
type: z38.literal("pcb_plated_hole"),
|
|
721
|
+
shape: z38.enum(["oval", "pill"]),
|
|
722
|
+
outer_width: z38.number(),
|
|
723
|
+
outer_height: z38.number(),
|
|
724
|
+
hole_width: z38.number(),
|
|
725
|
+
hole_height: z38.number(),
|
|
669
726
|
x: distance,
|
|
670
727
|
y: distance,
|
|
671
|
-
layers:
|
|
672
|
-
port_hints:
|
|
673
|
-
pcb_component_id:
|
|
674
|
-
pcb_port_id:
|
|
728
|
+
layers: z38.array(layer_ref),
|
|
729
|
+
port_hints: z38.array(z38.string()).optional(),
|
|
730
|
+
pcb_component_id: z38.string().optional(),
|
|
731
|
+
pcb_port_id: z38.string().optional(),
|
|
675
732
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
676
733
|
});
|
|
677
|
-
var pcb_plated_hole =
|
|
734
|
+
var pcb_plated_hole = z38.union([
|
|
678
735
|
pcb_plated_hole_circle,
|
|
679
736
|
pcb_plated_hole_oval
|
|
680
737
|
]);
|
|
@@ -682,154 +739,154 @@ expectTypesMatch(
|
|
|
682
739
|
true
|
|
683
740
|
);
|
|
684
741
|
expectTypesMatch(true);
|
|
685
|
-
var pcb_port =
|
|
686
|
-
type:
|
|
742
|
+
var pcb_port = z39.object({
|
|
743
|
+
type: z39.literal("pcb_port"),
|
|
687
744
|
pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
|
|
688
|
-
source_port_id:
|
|
689
|
-
pcb_component_id:
|
|
745
|
+
source_port_id: z39.string(),
|
|
746
|
+
pcb_component_id: z39.string(),
|
|
690
747
|
x: distance,
|
|
691
748
|
y: distance,
|
|
692
|
-
layers:
|
|
749
|
+
layers: z39.array(layer_ref)
|
|
693
750
|
}).describe("Defines a port on the PCB");
|
|
694
751
|
expectTypesMatch(true);
|
|
695
|
-
var pcb_smtpad_circle =
|
|
696
|
-
type:
|
|
697
|
-
shape:
|
|
752
|
+
var pcb_smtpad_circle = z40.object({
|
|
753
|
+
type: z40.literal("pcb_smtpad"),
|
|
754
|
+
shape: z40.literal("circle"),
|
|
698
755
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
699
756
|
x: distance,
|
|
700
757
|
y: distance,
|
|
701
|
-
radius:
|
|
758
|
+
radius: z40.number(),
|
|
702
759
|
layer: layer_ref,
|
|
703
|
-
port_hints:
|
|
704
|
-
pcb_component_id:
|
|
705
|
-
pcb_port_id:
|
|
760
|
+
port_hints: z40.array(z40.string()).optional(),
|
|
761
|
+
pcb_component_id: z40.string().optional(),
|
|
762
|
+
pcb_port_id: z40.string().optional()
|
|
706
763
|
});
|
|
707
|
-
var pcb_smtpad_rect =
|
|
708
|
-
type:
|
|
709
|
-
shape:
|
|
764
|
+
var pcb_smtpad_rect = z40.object({
|
|
765
|
+
type: z40.literal("pcb_smtpad"),
|
|
766
|
+
shape: z40.literal("rect"),
|
|
710
767
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
711
768
|
x: distance,
|
|
712
769
|
y: distance,
|
|
713
|
-
width:
|
|
714
|
-
height:
|
|
770
|
+
width: z40.number(),
|
|
771
|
+
height: z40.number(),
|
|
715
772
|
layer: layer_ref,
|
|
716
|
-
port_hints:
|
|
717
|
-
pcb_component_id:
|
|
718
|
-
pcb_port_id:
|
|
773
|
+
port_hints: z40.array(z40.string()).optional(),
|
|
774
|
+
pcb_component_id: z40.string().optional(),
|
|
775
|
+
pcb_port_id: z40.string().optional()
|
|
719
776
|
});
|
|
720
|
-
var pcb_smtpad =
|
|
777
|
+
var pcb_smtpad = z40.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
|
|
721
778
|
expectTypesMatch(true);
|
|
722
779
|
expectTypesMatch(true);
|
|
723
|
-
var pcb_solder_paste_circle =
|
|
724
|
-
type:
|
|
725
|
-
shape:
|
|
780
|
+
var pcb_solder_paste_circle = z41.object({
|
|
781
|
+
type: z41.literal("pcb_solder_paste"),
|
|
782
|
+
shape: z41.literal("circle"),
|
|
726
783
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
727
784
|
x: distance,
|
|
728
785
|
y: distance,
|
|
729
|
-
radius:
|
|
786
|
+
radius: z41.number(),
|
|
730
787
|
layer: layer_ref,
|
|
731
|
-
pcb_component_id:
|
|
732
|
-
pcb_smtpad_id:
|
|
788
|
+
pcb_component_id: z41.string().optional(),
|
|
789
|
+
pcb_smtpad_id: z41.string().optional()
|
|
733
790
|
});
|
|
734
|
-
var pcb_solder_paste_rect =
|
|
735
|
-
type:
|
|
736
|
-
shape:
|
|
791
|
+
var pcb_solder_paste_rect = z41.object({
|
|
792
|
+
type: z41.literal("pcb_solder_paste"),
|
|
793
|
+
shape: z41.literal("rect"),
|
|
737
794
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
738
795
|
x: distance,
|
|
739
796
|
y: distance,
|
|
740
|
-
width:
|
|
741
|
-
height:
|
|
797
|
+
width: z41.number(),
|
|
798
|
+
height: z41.number(),
|
|
742
799
|
layer: layer_ref,
|
|
743
|
-
pcb_component_id:
|
|
744
|
-
pcb_smtpad_id:
|
|
800
|
+
pcb_component_id: z41.string().optional(),
|
|
801
|
+
pcb_smtpad_id: z41.string().optional()
|
|
745
802
|
});
|
|
746
|
-
var pcb_solder_paste =
|
|
803
|
+
var pcb_solder_paste = z41.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
|
|
747
804
|
expectTypesMatch(true);
|
|
748
805
|
expectTypesMatch(true);
|
|
749
|
-
var pcb_text =
|
|
750
|
-
type:
|
|
806
|
+
var pcb_text = z42.object({
|
|
807
|
+
type: z42.literal("pcb_text"),
|
|
751
808
|
pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
|
|
752
|
-
text:
|
|
809
|
+
text: z42.string(),
|
|
753
810
|
center: point,
|
|
754
811
|
layer: layer_ref,
|
|
755
812
|
width: length,
|
|
756
813
|
height: length,
|
|
757
|
-
lines:
|
|
758
|
-
align:
|
|
814
|
+
lines: z42.number(),
|
|
815
|
+
align: z42.enum(["bottom-left"])
|
|
759
816
|
}).describe("Defines text on the PCB");
|
|
760
817
|
expectTypesMatch(true);
|
|
761
|
-
var pcb_trace_route_point_wire =
|
|
762
|
-
route_type:
|
|
818
|
+
var pcb_trace_route_point_wire = z43.object({
|
|
819
|
+
route_type: z43.literal("wire"),
|
|
763
820
|
x: distance,
|
|
764
821
|
y: distance,
|
|
765
822
|
width: distance,
|
|
766
|
-
start_pcb_port_id:
|
|
767
|
-
end_pcb_port_id:
|
|
823
|
+
start_pcb_port_id: z43.string().optional(),
|
|
824
|
+
end_pcb_port_id: z43.string().optional(),
|
|
768
825
|
layer: layer_ref
|
|
769
826
|
});
|
|
770
|
-
var pcb_trace_route_point_via =
|
|
771
|
-
route_type:
|
|
827
|
+
var pcb_trace_route_point_via = z43.object({
|
|
828
|
+
route_type: z43.literal("via"),
|
|
772
829
|
x: distance,
|
|
773
830
|
y: distance,
|
|
774
|
-
from_layer:
|
|
775
|
-
to_layer:
|
|
831
|
+
from_layer: z43.string(),
|
|
832
|
+
to_layer: z43.string()
|
|
776
833
|
});
|
|
777
|
-
var pcb_trace_route_point =
|
|
834
|
+
var pcb_trace_route_point = z43.union([
|
|
778
835
|
pcb_trace_route_point_wire,
|
|
779
836
|
pcb_trace_route_point_via
|
|
780
837
|
]);
|
|
781
|
-
var pcb_trace =
|
|
782
|
-
type:
|
|
783
|
-
source_trace_id:
|
|
784
|
-
pcb_component_id:
|
|
838
|
+
var pcb_trace = z43.object({
|
|
839
|
+
type: z43.literal("pcb_trace"),
|
|
840
|
+
source_trace_id: z43.string().optional(),
|
|
841
|
+
pcb_component_id: z43.string().optional(),
|
|
785
842
|
pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
|
|
786
|
-
route_thickness_mode:
|
|
787
|
-
route_order_index:
|
|
788
|
-
should_round_corners:
|
|
789
|
-
route:
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
route_type:
|
|
843
|
+
route_thickness_mode: z43.enum(["constant", "interpolated"]).default("constant").optional(),
|
|
844
|
+
route_order_index: z43.number().optional(),
|
|
845
|
+
should_round_corners: z43.boolean().optional(),
|
|
846
|
+
route: z43.array(
|
|
847
|
+
z43.union([
|
|
848
|
+
z43.object({
|
|
849
|
+
route_type: z43.literal("wire"),
|
|
793
850
|
x: distance,
|
|
794
851
|
y: distance,
|
|
795
852
|
width: distance,
|
|
796
|
-
start_pcb_port_id:
|
|
797
|
-
end_pcb_port_id:
|
|
853
|
+
start_pcb_port_id: z43.string().optional(),
|
|
854
|
+
end_pcb_port_id: z43.string().optional(),
|
|
798
855
|
layer: layer_ref
|
|
799
856
|
}),
|
|
800
|
-
|
|
801
|
-
route_type:
|
|
857
|
+
z43.object({
|
|
858
|
+
route_type: z43.literal("via"),
|
|
802
859
|
x: distance,
|
|
803
860
|
y: distance,
|
|
804
|
-
from_layer:
|
|
805
|
-
to_layer:
|
|
861
|
+
from_layer: z43.string(),
|
|
862
|
+
to_layer: z43.string()
|
|
806
863
|
})
|
|
807
864
|
])
|
|
808
865
|
)
|
|
809
866
|
}).describe("Defines a trace on the PCB");
|
|
810
867
|
expectTypesMatch(true);
|
|
811
868
|
expectTypesMatch(true);
|
|
812
|
-
var pcb_trace_error =
|
|
813
|
-
type:
|
|
869
|
+
var pcb_trace_error = z44.object({
|
|
870
|
+
type: z44.literal("pcb_trace_error"),
|
|
814
871
|
pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
|
|
815
|
-
error_type:
|
|
816
|
-
message:
|
|
872
|
+
error_type: z44.literal("pcb_trace_error"),
|
|
873
|
+
message: z44.string(),
|
|
817
874
|
center: point.optional(),
|
|
818
|
-
pcb_trace_id:
|
|
819
|
-
source_trace_id:
|
|
820
|
-
pcb_component_ids:
|
|
821
|
-
pcb_port_ids:
|
|
875
|
+
pcb_trace_id: z44.string(),
|
|
876
|
+
source_trace_id: z44.string(),
|
|
877
|
+
pcb_component_ids: z44.array(z44.string()),
|
|
878
|
+
pcb_port_ids: z44.array(z44.string())
|
|
822
879
|
}).describe("Defines a trace error on the PCB");
|
|
823
880
|
expectTypesMatch(true);
|
|
824
|
-
var pcb_port_not_matched_error =
|
|
825
|
-
type:
|
|
881
|
+
var pcb_port_not_matched_error = z45.object({
|
|
882
|
+
type: z45.literal("pcb_port_not_matched_error"),
|
|
826
883
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
827
|
-
message:
|
|
828
|
-
pcb_component_ids:
|
|
884
|
+
message: z45.string(),
|
|
885
|
+
pcb_component_ids: z45.array(z45.string())
|
|
829
886
|
}).describe("Defines a trace error on the PCB where a port is not matched");
|
|
830
887
|
expectTypesMatch(true);
|
|
831
|
-
var pcb_via =
|
|
832
|
-
type:
|
|
888
|
+
var pcb_via = z46.object({
|
|
889
|
+
type: z46.literal("pcb_via"),
|
|
833
890
|
pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
|
|
834
891
|
x: distance,
|
|
835
892
|
y: distance,
|
|
@@ -839,39 +896,39 @@ var pcb_via = z44.object({
|
|
|
839
896
|
from_layer: layer_ref.optional(),
|
|
840
897
|
/** @deprecated */
|
|
841
898
|
to_layer: layer_ref.optional(),
|
|
842
|
-
layers:
|
|
843
|
-
pcb_trace_id:
|
|
899
|
+
layers: z46.array(layer_ref),
|
|
900
|
+
pcb_trace_id: z46.string().optional()
|
|
844
901
|
}).describe("Defines a via on the PCB");
|
|
845
902
|
expectTypesMatch(true);
|
|
846
|
-
var pcb_board =
|
|
847
|
-
type:
|
|
903
|
+
var pcb_board = z47.object({
|
|
904
|
+
type: z47.literal("pcb_board"),
|
|
848
905
|
pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
|
|
849
906
|
width: length,
|
|
850
907
|
height: length,
|
|
851
908
|
center: point,
|
|
852
909
|
thickness: length.optional().default(1.4),
|
|
853
|
-
num_layers:
|
|
854
|
-
outline:
|
|
910
|
+
num_layers: z47.number().optional().default(4),
|
|
911
|
+
outline: z47.array(point).optional()
|
|
855
912
|
}).describe("Defines the board outline of the PCB");
|
|
856
913
|
expectTypesMatch(true);
|
|
857
|
-
var pcb_placement_error =
|
|
858
|
-
type:
|
|
914
|
+
var pcb_placement_error = z48.object({
|
|
915
|
+
type: z48.literal("pcb_placement_error"),
|
|
859
916
|
pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
|
|
860
|
-
message:
|
|
917
|
+
message: z48.string()
|
|
861
918
|
}).describe("Defines a placement error on the PCB");
|
|
862
919
|
expectTypesMatch(true);
|
|
863
|
-
var pcb_trace_hint =
|
|
864
|
-
type:
|
|
920
|
+
var pcb_trace_hint = z49.object({
|
|
921
|
+
type: z49.literal("pcb_trace_hint"),
|
|
865
922
|
pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
|
|
866
|
-
pcb_port_id:
|
|
867
|
-
pcb_component_id:
|
|
868
|
-
route:
|
|
923
|
+
pcb_port_id: z49.string(),
|
|
924
|
+
pcb_component_id: z49.string(),
|
|
925
|
+
route: z49.array(route_hint_point)
|
|
869
926
|
}).describe("A hint that can be used during generation of a PCB trace");
|
|
870
927
|
expectTypesMatch(true);
|
|
871
|
-
var pcb_silkscreen_line =
|
|
872
|
-
type:
|
|
928
|
+
var pcb_silkscreen_line = z50.object({
|
|
929
|
+
type: z50.literal("pcb_silkscreen_line"),
|
|
873
930
|
pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
|
|
874
|
-
pcb_component_id:
|
|
931
|
+
pcb_component_id: z50.string(),
|
|
875
932
|
stroke_width: distance.default("0.1mm"),
|
|
876
933
|
x1: distance,
|
|
877
934
|
y1: distance,
|
|
@@ -880,131 +937,131 @@ var pcb_silkscreen_line = z48.object({
|
|
|
880
937
|
layer: visible_layer
|
|
881
938
|
}).describe("Defines a silkscreen line on the PCB");
|
|
882
939
|
expectTypesMatch(true);
|
|
883
|
-
var pcb_silkscreen_path =
|
|
884
|
-
type:
|
|
940
|
+
var pcb_silkscreen_path = z51.object({
|
|
941
|
+
type: z51.literal("pcb_silkscreen_path"),
|
|
885
942
|
pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
|
|
886
|
-
pcb_component_id:
|
|
943
|
+
pcb_component_id: z51.string(),
|
|
887
944
|
layer: visible_layer,
|
|
888
|
-
route:
|
|
945
|
+
route: z51.array(point),
|
|
889
946
|
stroke_width: length
|
|
890
947
|
}).describe("Defines a silkscreen path on the PCB");
|
|
891
948
|
expectTypesMatch(true);
|
|
892
|
-
var pcb_silkscreen_text =
|
|
893
|
-
type:
|
|
949
|
+
var pcb_silkscreen_text = z52.object({
|
|
950
|
+
type: z52.literal("pcb_silkscreen_text"),
|
|
894
951
|
pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
|
|
895
|
-
font:
|
|
952
|
+
font: z52.literal("tscircuit2024").default("tscircuit2024"),
|
|
896
953
|
font_size: distance.default("0.2mm"),
|
|
897
|
-
pcb_component_id:
|
|
898
|
-
text:
|
|
954
|
+
pcb_component_id: z52.string(),
|
|
955
|
+
text: z52.string(),
|
|
899
956
|
layer: layer_ref,
|
|
900
|
-
is_mirrored:
|
|
957
|
+
is_mirrored: z52.boolean().default(false).optional(),
|
|
901
958
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
902
|
-
anchor_alignment:
|
|
959
|
+
anchor_alignment: z52.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
|
|
903
960
|
}).describe("Defines silkscreen text on the PCB");
|
|
904
961
|
expectTypesMatch(true);
|
|
905
|
-
var pcb_silkscreen_rect =
|
|
906
|
-
type:
|
|
962
|
+
var pcb_silkscreen_rect = z53.object({
|
|
963
|
+
type: z53.literal("pcb_silkscreen_rect"),
|
|
907
964
|
pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
|
|
908
|
-
pcb_component_id:
|
|
965
|
+
pcb_component_id: z53.string(),
|
|
909
966
|
center: point,
|
|
910
967
|
width: length,
|
|
911
968
|
height: length,
|
|
912
969
|
layer: layer_ref
|
|
913
970
|
}).describe("Defines a silkscreen rect on the PCB");
|
|
914
971
|
expectTypesMatch(true);
|
|
915
|
-
var pcb_silkscreen_circle =
|
|
916
|
-
type:
|
|
972
|
+
var pcb_silkscreen_circle = z54.object({
|
|
973
|
+
type: z54.literal("pcb_silkscreen_circle"),
|
|
917
974
|
pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
|
|
918
975
|
"pcb_silkscreen_circle"
|
|
919
976
|
),
|
|
920
|
-
pcb_component_id:
|
|
977
|
+
pcb_component_id: z54.string(),
|
|
921
978
|
center: point,
|
|
922
979
|
radius: length,
|
|
923
980
|
layer: visible_layer
|
|
924
981
|
}).describe("Defines a silkscreen circle on the PCB");
|
|
925
982
|
expectTypesMatch(true);
|
|
926
|
-
var pcb_silkscreen_oval =
|
|
927
|
-
type:
|
|
983
|
+
var pcb_silkscreen_oval = z55.object({
|
|
984
|
+
type: z55.literal("pcb_silkscreen_oval"),
|
|
928
985
|
pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
|
|
929
|
-
pcb_component_id:
|
|
986
|
+
pcb_component_id: z55.string(),
|
|
930
987
|
center: point,
|
|
931
988
|
radius_x: distance,
|
|
932
989
|
radius_y: distance,
|
|
933
990
|
layer: visible_layer
|
|
934
991
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
935
992
|
expectTypesMatch(true);
|
|
936
|
-
var pcb_fabrication_note_text =
|
|
937
|
-
type:
|
|
993
|
+
var pcb_fabrication_note_text = z56.object({
|
|
994
|
+
type: z56.literal("pcb_fabrication_note_text"),
|
|
938
995
|
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
|
|
939
996
|
"pcb_fabrication_note_text"
|
|
940
997
|
),
|
|
941
|
-
font:
|
|
998
|
+
font: z56.literal("tscircuit2024").default("tscircuit2024"),
|
|
942
999
|
font_size: distance.default("1mm"),
|
|
943
|
-
pcb_component_id:
|
|
944
|
-
text:
|
|
1000
|
+
pcb_component_id: z56.string(),
|
|
1001
|
+
text: z56.string(),
|
|
945
1002
|
layer: visible_layer,
|
|
946
1003
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
947
|
-
anchor_alignment:
|
|
948
|
-
color:
|
|
1004
|
+
anchor_alignment: z56.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
1005
|
+
color: z56.string().optional()
|
|
949
1006
|
}).describe(
|
|
950
1007
|
"Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
|
|
951
1008
|
);
|
|
952
1009
|
expectTypesMatch(true);
|
|
953
|
-
var pcb_fabrication_note_path =
|
|
954
|
-
type:
|
|
1010
|
+
var pcb_fabrication_note_path = z57.object({
|
|
1011
|
+
type: z57.literal("pcb_fabrication_note_path"),
|
|
955
1012
|
pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
|
|
956
1013
|
"pcb_fabrication_note_path"
|
|
957
1014
|
),
|
|
958
|
-
pcb_component_id:
|
|
1015
|
+
pcb_component_id: z57.string(),
|
|
959
1016
|
layer: layer_ref,
|
|
960
|
-
route:
|
|
1017
|
+
route: z57.array(point),
|
|
961
1018
|
stroke_width: length,
|
|
962
|
-
color:
|
|
1019
|
+
color: z57.string().optional()
|
|
963
1020
|
}).describe(
|
|
964
1021
|
"Defines a fabrication path on the PCB for fabricators or assemblers"
|
|
965
1022
|
);
|
|
966
1023
|
expectTypesMatch(true);
|
|
967
|
-
var pcb_keepout =
|
|
968
|
-
type:
|
|
969
|
-
shape:
|
|
1024
|
+
var pcb_keepout = z58.object({
|
|
1025
|
+
type: z58.literal("pcb_keepout"),
|
|
1026
|
+
shape: z58.literal("rect"),
|
|
970
1027
|
center: point,
|
|
971
1028
|
width: distance,
|
|
972
1029
|
height: distance,
|
|
973
|
-
pcb_keepout_id:
|
|
974
|
-
layers:
|
|
1030
|
+
pcb_keepout_id: z58.string(),
|
|
1031
|
+
layers: z58.array(z58.string()),
|
|
975
1032
|
// Specify layers where the keepout applies
|
|
976
|
-
description:
|
|
1033
|
+
description: z58.string().optional()
|
|
977
1034
|
// Optional description of the keepout
|
|
978
1035
|
}).or(
|
|
979
|
-
|
|
980
|
-
type:
|
|
981
|
-
shape:
|
|
1036
|
+
z58.object({
|
|
1037
|
+
type: z58.literal("pcb_keepout"),
|
|
1038
|
+
shape: z58.literal("circle"),
|
|
982
1039
|
center: point,
|
|
983
1040
|
radius: distance,
|
|
984
|
-
pcb_keepout_id:
|
|
985
|
-
layers:
|
|
1041
|
+
pcb_keepout_id: z58.string(),
|
|
1042
|
+
layers: z58.array(z58.string()),
|
|
986
1043
|
// Specify layers where the keepout applies
|
|
987
|
-
description:
|
|
1044
|
+
description: z58.string().optional()
|
|
988
1045
|
// Optional description of the keepout
|
|
989
1046
|
})
|
|
990
1047
|
);
|
|
991
|
-
var cad_component =
|
|
992
|
-
type:
|
|
993
|
-
cad_component_id:
|
|
994
|
-
pcb_component_id:
|
|
995
|
-
source_component_id:
|
|
1048
|
+
var cad_component = z59.object({
|
|
1049
|
+
type: z59.literal("cad_component"),
|
|
1050
|
+
cad_component_id: z59.string(),
|
|
1051
|
+
pcb_component_id: z59.string(),
|
|
1052
|
+
source_component_id: z59.string(),
|
|
996
1053
|
position: point3,
|
|
997
1054
|
rotation: point3.optional(),
|
|
998
1055
|
size: point3.optional(),
|
|
999
1056
|
layer: layer_ref.optional(),
|
|
1000
1057
|
// These are all ways to generate/load the 3d model
|
|
1001
|
-
footprinter_string:
|
|
1002
|
-
model_obj_url:
|
|
1003
|
-
model_stl_url:
|
|
1004
|
-
model_3mf_url:
|
|
1005
|
-
model_jscad:
|
|
1058
|
+
footprinter_string: z59.string().optional(),
|
|
1059
|
+
model_obj_url: z59.string().optional(),
|
|
1060
|
+
model_stl_url: z59.string().optional(),
|
|
1061
|
+
model_3mf_url: z59.string().optional(),
|
|
1062
|
+
model_jscad: z59.any().optional()
|
|
1006
1063
|
}).describe("Defines a component on the PCB");
|
|
1007
|
-
var any_circuit_element =
|
|
1064
|
+
var any_circuit_element = z60.union([
|
|
1008
1065
|
source_trace,
|
|
1009
1066
|
source_port,
|
|
1010
1067
|
any_source_component,
|
|
@@ -1017,6 +1074,7 @@ var any_circuit_element = z58.union([
|
|
|
1017
1074
|
source_simple_diode,
|
|
1018
1075
|
source_simple_resistor,
|
|
1019
1076
|
source_simple_power_source,
|
|
1077
|
+
source_simple_battery,
|
|
1020
1078
|
pcb_component,
|
|
1021
1079
|
pcb_hole,
|
|
1022
1080
|
pcb_plated_hole,
|
|
@@ -1049,6 +1107,7 @@ var any_circuit_element = z58.union([
|
|
|
1049
1107
|
schematic_path,
|
|
1050
1108
|
schematic_error,
|
|
1051
1109
|
schematic_net_label,
|
|
1110
|
+
schematic_debug_object,
|
|
1052
1111
|
cad_component
|
|
1053
1112
|
]);
|
|
1054
1113
|
var any_soup_element = any_circuit_element;
|
|
@@ -1490,6 +1549,80 @@ import { mm as mm2 } from "@tscircuit/mm";
|
|
|
1490
1549
|
// lib/utils/easyeda-unit-to-mm.ts
|
|
1491
1550
|
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
1492
1551
|
|
|
1552
|
+
// lib/normalize-pin-labels.ts
|
|
1553
|
+
var normalizePinLabels = (inputPinLabels) => {
|
|
1554
|
+
const unqInputPinLabels = inputPinLabels.map((labels) => [...new Set(labels)]);
|
|
1555
|
+
const result = unqInputPinLabels.map(() => []);
|
|
1556
|
+
const desiredNumbers = unqInputPinLabels.map(() => null);
|
|
1557
|
+
for (let i = 0; i < unqInputPinLabels.length; i++) {
|
|
1558
|
+
for (const label of unqInputPinLabels[i]) {
|
|
1559
|
+
if (/^\d+$/.test(label)) {
|
|
1560
|
+
desiredNumbers[i] = Number.parseInt(label);
|
|
1561
|
+
break;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
let highestPinNumber = 0;
|
|
1566
|
+
const alreadyAcceptedDesiredNumbers = /* @__PURE__ */ new Set();
|
|
1567
|
+
for (let i = 0; i < desiredNumbers.length; i++) {
|
|
1568
|
+
const desiredNumber = desiredNumbers[i];
|
|
1569
|
+
if (desiredNumber === null || desiredNumber < 1) {
|
|
1570
|
+
continue;
|
|
1571
|
+
}
|
|
1572
|
+
if (!alreadyAcceptedDesiredNumbers.has(desiredNumber)) {
|
|
1573
|
+
alreadyAcceptedDesiredNumbers.add(desiredNumber);
|
|
1574
|
+
result[i].push(`pin${desiredNumber}`);
|
|
1575
|
+
highestPinNumber = Math.max(highestPinNumber, desiredNumber);
|
|
1576
|
+
continue;
|
|
1577
|
+
}
|
|
1578
|
+
let existingAltsForPin = 0;
|
|
1579
|
+
for (const label of result[i]) {
|
|
1580
|
+
if (label.startsWith(`pin${desiredNumber}_alt`)) {
|
|
1581
|
+
existingAltsForPin++;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
result[i].push(`pin${desiredNumber}_alt${existingAltsForPin + 1}`);
|
|
1585
|
+
}
|
|
1586
|
+
for (let i = 0; i < result.length; i++) {
|
|
1587
|
+
const firstLabel = result[i][0];
|
|
1588
|
+
if (firstLabel?.includes("_alt")) {
|
|
1589
|
+
highestPinNumber++;
|
|
1590
|
+
result[i].unshift(`pin${highestPinNumber}`);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
for (let i = 0; i < result.length; i++) {
|
|
1594
|
+
if (result[i].length === 0) {
|
|
1595
|
+
highestPinNumber++;
|
|
1596
|
+
result[i].push(`pin${highestPinNumber}`);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
const totalLabelCounts = {};
|
|
1600
|
+
for (const inputLabels of unqInputPinLabels) {
|
|
1601
|
+
for (const label of inputLabels) {
|
|
1602
|
+
if (/^\d+$/.test(label)) {
|
|
1603
|
+
continue;
|
|
1604
|
+
}
|
|
1605
|
+
totalLabelCounts[label] = (totalLabelCounts[label] ?? 0) + 1;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
const incrementalLabelCounts = {};
|
|
1609
|
+
for (let i = 0; i < unqInputPinLabels.length; i++) {
|
|
1610
|
+
const inputLabels = unqInputPinLabels[i];
|
|
1611
|
+
for (const label of inputLabels) {
|
|
1612
|
+
if (/^\d+$/.test(label)) {
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
if (totalLabelCounts[label] === 1) {
|
|
1616
|
+
result[i].push(label);
|
|
1617
|
+
} else {
|
|
1618
|
+
incrementalLabelCounts[label] = (incrementalLabelCounts[label] ?? 0) + 1;
|
|
1619
|
+
result[i].push(`${label}${incrementalLabelCounts[label]}`);
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
return result;
|
|
1624
|
+
};
|
|
1625
|
+
|
|
1493
1626
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1494
1627
|
var mil2mm = (mil) => {
|
|
1495
1628
|
if (typeof mil === "number") return mm2(`${mil}mil`);
|
|
@@ -1572,13 +1705,30 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1572
1705
|
layer: "top"
|
|
1573
1706
|
});
|
|
1574
1707
|
soupElements.push(source_component, pcb_component2);
|
|
1575
|
-
easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
1576
|
-
|
|
1708
|
+
const pads = easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
1709
|
+
(shape) => shape.type === "PAD"
|
|
1710
|
+
);
|
|
1711
|
+
const pins = easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN");
|
|
1712
|
+
const pinLabelSets = pads.map((pad) => {
|
|
1713
|
+
const labels = [];
|
|
1714
|
+
if (pad.number) labels.push(pad.number.toString());
|
|
1715
|
+
const pin = pins.find((p) => p.pinNumber === pad.number);
|
|
1716
|
+
if (pin) labels.push(pin.label);
|
|
1717
|
+
return labels;
|
|
1718
|
+
});
|
|
1719
|
+
const normalizedPinLabels = normalizePinLabels(pinLabelSets);
|
|
1720
|
+
pads.forEach((pad, index) => {
|
|
1721
|
+
const portHints = normalizedPinLabels[index];
|
|
1722
|
+
const pinNumber = Number.parseInt(
|
|
1723
|
+
portHints.find((hint) => hint.match(/pin\d+/)).replace("pin", "")
|
|
1724
|
+
);
|
|
1577
1725
|
soupElements.push({
|
|
1578
1726
|
type: "source_port",
|
|
1579
1727
|
source_port_id: `source_port_${index + 1}`,
|
|
1580
1728
|
source_component_id: "source_component_1",
|
|
1581
|
-
name:
|
|
1729
|
+
name: `pin${pinNumber}`,
|
|
1730
|
+
pin_number: pinNumber,
|
|
1731
|
+
port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
|
|
1582
1732
|
});
|
|
1583
1733
|
if (pad.holeRadius !== void 0 && mil2mm(pad.holeRadius) !== 0) {
|
|
1584
1734
|
const commonPlatedHoleProps = {
|
|
@@ -1587,7 +1737,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1587
1737
|
x: mil2mm(pad.center.x),
|
|
1588
1738
|
y: mil2mm(pad.center.y),
|
|
1589
1739
|
layers: ["top"],
|
|
1590
|
-
port_hints: [
|
|
1740
|
+
port_hints: [`pin${pinNumber}`],
|
|
1591
1741
|
pcb_component_id: "pcb_component_1",
|
|
1592
1742
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
1593
1743
|
};
|
|
@@ -1640,15 +1790,20 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1640
1790
|
if (!soupShape) {
|
|
1641
1791
|
throw new Error(`unknown pad.shape: "${pad.shape}"`);
|
|
1642
1792
|
}
|
|
1793
|
+
const rectSize = { width: mil2mm(pad.width), height: mil2mm(pad.height) };
|
|
1794
|
+
if (pad.rotation === 90 || pad.rotation === 270) {
|
|
1795
|
+
rectSize.width = mil2mm(pad.height);
|
|
1796
|
+
rectSize.height = mil2mm(pad.width);
|
|
1797
|
+
}
|
|
1643
1798
|
const parsedPcbSmtpad = pcb_smtpad.parse({
|
|
1644
1799
|
type: "pcb_smtpad",
|
|
1645
1800
|
pcb_smtpad_id: `pcb_smtpad_${index + 1}`,
|
|
1646
1801
|
shape: soupShape,
|
|
1647
1802
|
x: mil2mm(pad.center.x),
|
|
1648
1803
|
y: mil2mm(pad.center.y),
|
|
1649
|
-
...soupShape === "rect" ?
|
|
1804
|
+
...soupShape === "rect" ? rectSize : { radius: Math.min(mil2mm(pad.width), mil2mm(pad.height)) / 2 },
|
|
1650
1805
|
layer: "top",
|
|
1651
|
-
port_hints: [
|
|
1806
|
+
port_hints: [`pin${pinNumber}`],
|
|
1652
1807
|
pcb_component_id: "pcb_component_1",
|
|
1653
1808
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
1654
1809
|
});
|
|
@@ -1751,14 +1906,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber) {
|
|
|
1751
1906
|
}
|
|
1752
1907
|
|
|
1753
1908
|
// lib/schemas/easy-eda-json-schema.ts
|
|
1754
|
-
import { z as
|
|
1909
|
+
import { z as z63 } from "zod";
|
|
1755
1910
|
|
|
1756
1911
|
// lib/schemas/package-detail-shape-schema.ts
|
|
1757
|
-
import { z as
|
|
1758
|
-
var tenthmil =
|
|
1912
|
+
import { z as z61 } from "zod";
|
|
1913
|
+
var tenthmil = z61.union([z61.number(), z61.string()]).optional().transform(
|
|
1759
1914
|
(n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
|
|
1760
|
-
).pipe(
|
|
1761
|
-
var PointSchema =
|
|
1915
|
+
).pipe(z61.string());
|
|
1916
|
+
var PointSchema = z61.any().transform((p) => {
|
|
1762
1917
|
if (Array.isArray(p)) {
|
|
1763
1918
|
const [x, y] = p;
|
|
1764
1919
|
return { x, y };
|
|
@@ -1767,87 +1922,87 @@ var PointSchema = z59.any().transform((p) => {
|
|
|
1767
1922
|
}
|
|
1768
1923
|
throw new Error(`Invalid point: ${p}`);
|
|
1769
1924
|
}).pipe(
|
|
1770
|
-
|
|
1771
|
-
x:
|
|
1772
|
-
y:
|
|
1925
|
+
z61.object({
|
|
1926
|
+
x: z61.number(),
|
|
1927
|
+
y: z61.number()
|
|
1773
1928
|
})
|
|
1774
1929
|
);
|
|
1775
|
-
var BaseShapeSchema =
|
|
1776
|
-
type:
|
|
1777
|
-
id:
|
|
1778
|
-
layer:
|
|
1930
|
+
var BaseShapeSchema = z61.object({
|
|
1931
|
+
type: z61.string(),
|
|
1932
|
+
id: z61.string().optional(),
|
|
1933
|
+
layer: z61.coerce.number().optional()
|
|
1779
1934
|
});
|
|
1780
1935
|
var TrackSchema = BaseShapeSchema.extend({
|
|
1781
|
-
type:
|
|
1782
|
-
width:
|
|
1783
|
-
points:
|
|
1936
|
+
type: z61.literal("TRACK"),
|
|
1937
|
+
width: z61.coerce.number(),
|
|
1938
|
+
points: z61.array(PointSchema)
|
|
1784
1939
|
});
|
|
1785
1940
|
var PadSchema = BaseShapeSchema.extend({
|
|
1786
|
-
type:
|
|
1787
|
-
shape:
|
|
1788
|
-
center:
|
|
1941
|
+
type: z61.literal("PAD"),
|
|
1942
|
+
shape: z61.enum(["RECT", "ELLIPSE", "OVAL"]),
|
|
1943
|
+
center: z61.object({
|
|
1789
1944
|
x: tenthmil,
|
|
1790
1945
|
y: tenthmil
|
|
1791
1946
|
}),
|
|
1792
1947
|
width: tenthmil,
|
|
1793
1948
|
height: tenthmil,
|
|
1794
|
-
layermask:
|
|
1795
|
-
net:
|
|
1796
|
-
number:
|
|
1949
|
+
layermask: z61.number(),
|
|
1950
|
+
net: z61.union([z61.string(), z61.number()]).optional(),
|
|
1951
|
+
number: z61.union([z61.string(), z61.number()]),
|
|
1797
1952
|
holeRadius: tenthmil,
|
|
1798
|
-
points:
|
|
1799
|
-
rotation:
|
|
1800
|
-
plated:
|
|
1953
|
+
points: z61.array(PointSchema).optional(),
|
|
1954
|
+
rotation: z61.number().optional(),
|
|
1955
|
+
plated: z61.boolean()
|
|
1801
1956
|
});
|
|
1802
1957
|
var ArcSchema = BaseShapeSchema.extend({
|
|
1803
|
-
type:
|
|
1804
|
-
width:
|
|
1958
|
+
type: z61.literal("ARC"),
|
|
1959
|
+
width: z61.number(),
|
|
1805
1960
|
start: PointSchema,
|
|
1806
1961
|
end: PointSchema,
|
|
1807
|
-
radiusX:
|
|
1808
|
-
radiusY:
|
|
1809
|
-
largeArc:
|
|
1810
|
-
sweepDirection:
|
|
1962
|
+
radiusX: z61.number(),
|
|
1963
|
+
radiusY: z61.number(),
|
|
1964
|
+
largeArc: z61.boolean(),
|
|
1965
|
+
sweepDirection: z61.enum(["CW", "CCW"])
|
|
1811
1966
|
});
|
|
1812
1967
|
var CircleSchema = BaseShapeSchema.extend({
|
|
1813
|
-
type:
|
|
1968
|
+
type: z61.literal("CIRCLE"),
|
|
1814
1969
|
center: PointSchema,
|
|
1815
|
-
radius:
|
|
1816
|
-
width:
|
|
1970
|
+
radius: z61.number(),
|
|
1971
|
+
width: z61.number()
|
|
1817
1972
|
});
|
|
1818
1973
|
var SolidRegionSchema = BaseShapeSchema.extend({
|
|
1819
|
-
type:
|
|
1820
|
-
layermask:
|
|
1821
|
-
points:
|
|
1822
|
-
fillStyle:
|
|
1974
|
+
type: z61.literal("SOLIDREGION"),
|
|
1975
|
+
layermask: z61.number(),
|
|
1976
|
+
points: z61.array(PointSchema),
|
|
1977
|
+
fillStyle: z61.string()
|
|
1823
1978
|
});
|
|
1824
1979
|
var SVGNodeSchema = BaseShapeSchema.extend({
|
|
1825
|
-
type:
|
|
1826
|
-
svgData:
|
|
1827
|
-
gId:
|
|
1828
|
-
nodeName:
|
|
1829
|
-
nodeType:
|
|
1830
|
-
layerid:
|
|
1831
|
-
attrs:
|
|
1832
|
-
childNodes:
|
|
1980
|
+
type: z61.literal("SVGNODE"),
|
|
1981
|
+
svgData: z61.object({
|
|
1982
|
+
gId: z61.string(),
|
|
1983
|
+
nodeName: z61.string(),
|
|
1984
|
+
nodeType: z61.number(),
|
|
1985
|
+
layerid: z61.string(),
|
|
1986
|
+
attrs: z61.record(z61.string(), z61.string()),
|
|
1987
|
+
childNodes: z61.array(z61.unknown())
|
|
1833
1988
|
})
|
|
1834
1989
|
});
|
|
1835
1990
|
var HoleSchema = BaseShapeSchema.extend({
|
|
1836
|
-
type:
|
|
1991
|
+
type: z61.literal("HOLE"),
|
|
1837
1992
|
center: PointSchema,
|
|
1838
|
-
radius:
|
|
1993
|
+
radius: z61.number()
|
|
1839
1994
|
});
|
|
1840
1995
|
var RectSchema = BaseShapeSchema.extend({
|
|
1841
|
-
type:
|
|
1996
|
+
type: z61.literal("RECT"),
|
|
1842
1997
|
x: tenthmil,
|
|
1843
1998
|
y: tenthmil,
|
|
1844
1999
|
width: tenthmil,
|
|
1845
2000
|
height: tenthmil,
|
|
1846
|
-
lineWidth:
|
|
1847
|
-
fillStyle:
|
|
1848
|
-
rotation:
|
|
2001
|
+
lineWidth: z61.number(),
|
|
2002
|
+
fillStyle: z61.string(),
|
|
2003
|
+
rotation: z61.number().optional()
|
|
1849
2004
|
});
|
|
1850
|
-
var PackageDetailShapeSchema =
|
|
2005
|
+
var PackageDetailShapeSchema = z61.discriminatedUnion("type", [
|
|
1851
2006
|
TrackSchema,
|
|
1852
2007
|
PadSchema,
|
|
1853
2008
|
ArcSchema,
|
|
@@ -1867,9 +2022,9 @@ var pairs = (arr) => {
|
|
|
1867
2022
|
var parsePoints = (pointsStr) => pairs(
|
|
1868
2023
|
pointsStr.trim().split(" ").map((n) => Number(n))
|
|
1869
2024
|
);
|
|
1870
|
-
var ShapeItemSchema =
|
|
1871
|
-
type:
|
|
1872
|
-
data:
|
|
2025
|
+
var ShapeItemSchema = z61.object({
|
|
2026
|
+
type: z61.string(),
|
|
2027
|
+
data: z61.string()
|
|
1873
2028
|
}).transform((shape) => {
|
|
1874
2029
|
const [firstParam, ...restParams] = shape.data.split("~");
|
|
1875
2030
|
const lastParam = restParams.pop();
|
|
@@ -2009,23 +2164,23 @@ var ShapeItemSchema = z59.object({
|
|
|
2009
2164
|
return BaseShapeSchema.parse({ type: shape.type });
|
|
2010
2165
|
}
|
|
2011
2166
|
}).pipe(PackageDetailShapeSchema);
|
|
2012
|
-
var ShapesArraySchema =
|
|
2167
|
+
var ShapesArraySchema = z61.array(ShapeItemSchema);
|
|
2013
2168
|
|
|
2014
2169
|
// lib/schemas/single-letter-shape-schema.ts
|
|
2015
|
-
import { z as
|
|
2170
|
+
import { z as z62 } from "zod";
|
|
2016
2171
|
import "@tscircuit/mm";
|
|
2017
|
-
var PointSchema2 =
|
|
2018
|
-
x:
|
|
2019
|
-
y:
|
|
2172
|
+
var PointSchema2 = z62.object({
|
|
2173
|
+
x: z62.number(),
|
|
2174
|
+
y: z62.number()
|
|
2020
2175
|
});
|
|
2021
|
-
var RectangleShapeOutputSchema =
|
|
2022
|
-
type:
|
|
2176
|
+
var RectangleShapeOutputSchema = z62.object({
|
|
2177
|
+
type: z62.literal("RECTANGLE"),
|
|
2023
2178
|
position: PointSchema2,
|
|
2024
|
-
width:
|
|
2025
|
-
height:
|
|
2026
|
-
color:
|
|
2027
|
-
lineWidth:
|
|
2028
|
-
id:
|
|
2179
|
+
width: z62.number(),
|
|
2180
|
+
height: z62.number(),
|
|
2181
|
+
color: z62.string(),
|
|
2182
|
+
lineWidth: z62.number(),
|
|
2183
|
+
id: z62.string()
|
|
2029
2184
|
});
|
|
2030
2185
|
var parseRectangle = (str) => {
|
|
2031
2186
|
const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
|
|
@@ -2039,15 +2194,15 @@ var parseRectangle = (str) => {
|
|
|
2039
2194
|
id
|
|
2040
2195
|
};
|
|
2041
2196
|
};
|
|
2042
|
-
var RectangleShapeSchema =
|
|
2043
|
-
var EllipseShapeOutputSchema =
|
|
2044
|
-
type:
|
|
2197
|
+
var RectangleShapeSchema = z62.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
|
|
2198
|
+
var EllipseShapeOutputSchema = z62.object({
|
|
2199
|
+
type: z62.literal("ELLIPSE"),
|
|
2045
2200
|
center: PointSchema2,
|
|
2046
|
-
radiusX:
|
|
2047
|
-
radiusY:
|
|
2048
|
-
color:
|
|
2049
|
-
lineWidth:
|
|
2050
|
-
id:
|
|
2201
|
+
radiusX: z62.number(),
|
|
2202
|
+
radiusY: z62.number(),
|
|
2203
|
+
color: z62.string(),
|
|
2204
|
+
lineWidth: z62.number(),
|
|
2205
|
+
id: z62.string()
|
|
2051
2206
|
});
|
|
2052
2207
|
var parseEllipse = (str) => {
|
|
2053
2208
|
const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
|
|
@@ -2061,19 +2216,19 @@ var parseEllipse = (str) => {
|
|
|
2061
2216
|
id
|
|
2062
2217
|
};
|
|
2063
2218
|
};
|
|
2064
|
-
var EllipseShapeSchema =
|
|
2065
|
-
var PinShapeOutputSchema =
|
|
2066
|
-
type:
|
|
2067
|
-
visibility:
|
|
2068
|
-
pinNumber:
|
|
2069
|
-
x:
|
|
2070
|
-
y:
|
|
2071
|
-
rotation:
|
|
2072
|
-
id:
|
|
2073
|
-
label:
|
|
2074
|
-
labelColor:
|
|
2075
|
-
path:
|
|
2076
|
-
arrow:
|
|
2219
|
+
var EllipseShapeSchema = z62.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
2220
|
+
var PinShapeOutputSchema = z62.object({
|
|
2221
|
+
type: z62.literal("PIN"),
|
|
2222
|
+
visibility: z62.enum(["show", "hide"]),
|
|
2223
|
+
pinNumber: z62.union([z62.string(), z62.number()]),
|
|
2224
|
+
x: z62.number(),
|
|
2225
|
+
y: z62.number(),
|
|
2226
|
+
rotation: z62.number(),
|
|
2227
|
+
id: z62.string(),
|
|
2228
|
+
label: z62.string(),
|
|
2229
|
+
labelColor: z62.string(),
|
|
2230
|
+
path: z62.string(),
|
|
2231
|
+
arrow: z62.string()
|
|
2077
2232
|
});
|
|
2078
2233
|
var parsePin = (pinString) => {
|
|
2079
2234
|
const parts = pinString.split("~");
|
|
@@ -2100,13 +2255,13 @@ var parsePin = (pinString) => {
|
|
|
2100
2255
|
arrow
|
|
2101
2256
|
};
|
|
2102
2257
|
};
|
|
2103
|
-
var PinShapeSchema =
|
|
2104
|
-
var PolylineShapeOutputSchema =
|
|
2105
|
-
type:
|
|
2106
|
-
points:
|
|
2107
|
-
color:
|
|
2108
|
-
lineWidth:
|
|
2109
|
-
id:
|
|
2258
|
+
var PinShapeSchema = z62.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
|
|
2259
|
+
var PolylineShapeOutputSchema = z62.object({
|
|
2260
|
+
type: z62.literal("POLYLINE"),
|
|
2261
|
+
points: z62.array(PointSchema2),
|
|
2262
|
+
color: z62.string(),
|
|
2263
|
+
lineWidth: z62.number(),
|
|
2264
|
+
id: z62.string()
|
|
2110
2265
|
});
|
|
2111
2266
|
var parsePoints2 = (pointsStr) => {
|
|
2112
2267
|
return pointsStr.split(" ").reduce((acc, value, index) => {
|
|
@@ -2129,14 +2284,14 @@ var parsePolyline = (str) => {
|
|
|
2129
2284
|
id
|
|
2130
2285
|
};
|
|
2131
2286
|
};
|
|
2132
|
-
var PolylineShapeSchema =
|
|
2133
|
-
var PolygonShapeOutputSchema =
|
|
2134
|
-
type:
|
|
2135
|
-
points:
|
|
2136
|
-
fillColor:
|
|
2137
|
-
lineWidth:
|
|
2138
|
-
lineColor:
|
|
2139
|
-
id:
|
|
2287
|
+
var PolylineShapeSchema = z62.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
|
|
2288
|
+
var PolygonShapeOutputSchema = z62.object({
|
|
2289
|
+
type: z62.literal("POLYGON"),
|
|
2290
|
+
points: z62.array(PointSchema2),
|
|
2291
|
+
fillColor: z62.string(),
|
|
2292
|
+
lineWidth: z62.number(),
|
|
2293
|
+
lineColor: z62.string(),
|
|
2294
|
+
id: z62.string()
|
|
2140
2295
|
});
|
|
2141
2296
|
var parsePolygon = (str) => {
|
|
2142
2297
|
const [, ...rest] = str.split("~");
|
|
@@ -2150,14 +2305,14 @@ var parsePolygon = (str) => {
|
|
|
2150
2305
|
id
|
|
2151
2306
|
};
|
|
2152
2307
|
};
|
|
2153
|
-
var PolygonShapeSchema =
|
|
2154
|
-
var PathShapeOutputSchema =
|
|
2155
|
-
type:
|
|
2156
|
-
pathData:
|
|
2157
|
-
fillColor:
|
|
2158
|
-
strokeWidth:
|
|
2159
|
-
strokeColor:
|
|
2160
|
-
id:
|
|
2308
|
+
var PolygonShapeSchema = z62.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
|
|
2309
|
+
var PathShapeOutputSchema = z62.object({
|
|
2310
|
+
type: z62.literal("PATH"),
|
|
2311
|
+
pathData: z62.string(),
|
|
2312
|
+
fillColor: z62.string(),
|
|
2313
|
+
strokeWidth: z62.number(),
|
|
2314
|
+
strokeColor: z62.string(),
|
|
2315
|
+
id: z62.string()
|
|
2161
2316
|
});
|
|
2162
2317
|
var parsePath = (str) => {
|
|
2163
2318
|
const [, pathData, fillColor, strokeWidth, strokeColor, , id] = str.split("~");
|
|
@@ -2170,24 +2325,24 @@ var parsePath = (str) => {
|
|
|
2170
2325
|
id
|
|
2171
2326
|
};
|
|
2172
2327
|
};
|
|
2173
|
-
var PathShapeSchema =
|
|
2174
|
-
var TextShapeOutputSchema =
|
|
2175
|
-
type:
|
|
2176
|
-
alignment:
|
|
2177
|
-
x:
|
|
2178
|
-
y:
|
|
2179
|
-
rotation:
|
|
2180
|
-
fontColor:
|
|
2181
|
-
backgroundColor:
|
|
2182
|
-
fontSize:
|
|
2183
|
-
fontWeight:
|
|
2184
|
-
fontStyle:
|
|
2185
|
-
fontDecoration:
|
|
2186
|
-
content:
|
|
2187
|
-
textType:
|
|
2188
|
-
visibility:
|
|
2189
|
-
mirror:
|
|
2190
|
-
id:
|
|
2328
|
+
var PathShapeSchema = z62.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
|
|
2329
|
+
var TextShapeOutputSchema = z62.object({
|
|
2330
|
+
type: z62.literal("TEXT"),
|
|
2331
|
+
alignment: z62.enum(["L", "C", "R"]),
|
|
2332
|
+
x: z62.number(),
|
|
2333
|
+
y: z62.number(),
|
|
2334
|
+
rotation: z62.number(),
|
|
2335
|
+
fontColor: z62.string(),
|
|
2336
|
+
backgroundColor: z62.string().optional(),
|
|
2337
|
+
fontSize: z62.string(),
|
|
2338
|
+
fontWeight: z62.enum(["normal", "bold"]).optional().default("normal"),
|
|
2339
|
+
fontStyle: z62.enum(["normal", "italic"]).optional().default("normal"),
|
|
2340
|
+
fontDecoration: z62.enum(["", "underline"]),
|
|
2341
|
+
content: z62.string(),
|
|
2342
|
+
textType: z62.string(),
|
|
2343
|
+
visibility: z62.enum(["0", "1"]),
|
|
2344
|
+
mirror: z62.string(),
|
|
2345
|
+
id: z62.string()
|
|
2191
2346
|
});
|
|
2192
2347
|
var parseText = (str) => {
|
|
2193
2348
|
const [
|
|
@@ -2227,8 +2382,8 @@ var parseText = (str) => {
|
|
|
2227
2382
|
id
|
|
2228
2383
|
};
|
|
2229
2384
|
};
|
|
2230
|
-
var TextShapeSchema =
|
|
2231
|
-
var SingleLetterShapeSchema =
|
|
2385
|
+
var TextShapeSchema = z62.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema);
|
|
2386
|
+
var SingleLetterShapeSchema = z62.string().transform((x) => {
|
|
2232
2387
|
if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
|
|
2233
2388
|
if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
|
|
2234
2389
|
if (x.startsWith("P~")) return PinShapeSchema.parse(x);
|
|
@@ -2238,7 +2393,7 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
|
|
|
2238
2393
|
if (x.startsWith("T~")) return TextShapeSchema.parse(x);
|
|
2239
2394
|
throw new Error(`Invalid shape type: ${x}`);
|
|
2240
2395
|
}).pipe(
|
|
2241
|
-
|
|
2396
|
+
z62.union([
|
|
2242
2397
|
RectangleShapeOutputSchema,
|
|
2243
2398
|
EllipseShapeOutputSchema,
|
|
2244
2399
|
PinShapeOutputSchema,
|
|
@@ -2250,81 +2405,81 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
|
|
|
2250
2405
|
);
|
|
2251
2406
|
|
|
2252
2407
|
// lib/schemas/easy-eda-json-schema.ts
|
|
2253
|
-
var maybeNumber =
|
|
2254
|
-
var SzlcscSchema =
|
|
2255
|
-
id:
|
|
2256
|
-
number:
|
|
2257
|
-
step:
|
|
2258
|
-
min:
|
|
2259
|
-
price:
|
|
2260
|
-
stock:
|
|
2261
|
-
url:
|
|
2262
|
-
image:
|
|
2263
|
-
});
|
|
2264
|
-
var LcscSchema =
|
|
2265
|
-
id:
|
|
2266
|
-
number:
|
|
2267
|
-
step:
|
|
2268
|
-
min:
|
|
2269
|
-
price:
|
|
2270
|
-
stock:
|
|
2271
|
-
url:
|
|
2272
|
-
});
|
|
2273
|
-
var OwnerSchema =
|
|
2274
|
-
uuid:
|
|
2275
|
-
username:
|
|
2276
|
-
nickname:
|
|
2277
|
-
avatar:
|
|
2278
|
-
});
|
|
2279
|
-
var HeadSchema =
|
|
2280
|
-
docType:
|
|
2281
|
-
editorVersion:
|
|
2282
|
-
c_para:
|
|
2283
|
-
x:
|
|
2284
|
-
y:
|
|
2285
|
-
puuid:
|
|
2286
|
-
uuid:
|
|
2287
|
-
utime:
|
|
2288
|
-
importFlag:
|
|
2289
|
-
c_spiceCmd:
|
|
2290
|
-
hasIdFlag:
|
|
2291
|
-
});
|
|
2292
|
-
var BBoxSchema =
|
|
2293
|
-
x:
|
|
2294
|
-
y:
|
|
2295
|
-
width:
|
|
2296
|
-
height:
|
|
2297
|
-
});
|
|
2298
|
-
var LayerItemSchema =
|
|
2299
|
-
name:
|
|
2300
|
-
color:
|
|
2301
|
-
visible:
|
|
2302
|
-
active:
|
|
2303
|
-
config:
|
|
2304
|
-
transparency:
|
|
2305
|
-
});
|
|
2306
|
-
var ObjectItemSchema =
|
|
2307
|
-
name:
|
|
2308
|
-
visible:
|
|
2309
|
-
locked:
|
|
2310
|
-
});
|
|
2311
|
-
var DataStrSchema =
|
|
2408
|
+
var maybeNumber = z63.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(z63.number().nullable().optional());
|
|
2409
|
+
var SzlcscSchema = z63.object({
|
|
2410
|
+
id: z63.number(),
|
|
2411
|
+
number: z63.string(),
|
|
2412
|
+
step: z63.number().optional(),
|
|
2413
|
+
min: z63.number().optional(),
|
|
2414
|
+
price: z63.number().optional(),
|
|
2415
|
+
stock: z63.number().optional(),
|
|
2416
|
+
url: z63.string().url().optional(),
|
|
2417
|
+
image: z63.string().optional().optional()
|
|
2418
|
+
});
|
|
2419
|
+
var LcscSchema = z63.object({
|
|
2420
|
+
id: z63.number(),
|
|
2421
|
+
number: z63.string(),
|
|
2422
|
+
step: z63.number().optional(),
|
|
2423
|
+
min: z63.number().optional(),
|
|
2424
|
+
price: z63.number().optional(),
|
|
2425
|
+
stock: z63.number().optional(),
|
|
2426
|
+
url: z63.string().url().optional()
|
|
2427
|
+
});
|
|
2428
|
+
var OwnerSchema = z63.object({
|
|
2429
|
+
uuid: z63.string(),
|
|
2430
|
+
username: z63.string(),
|
|
2431
|
+
nickname: z63.string(),
|
|
2432
|
+
avatar: z63.string()
|
|
2433
|
+
});
|
|
2434
|
+
var HeadSchema = z63.object({
|
|
2435
|
+
docType: z63.string(),
|
|
2436
|
+
editorVersion: z63.string(),
|
|
2437
|
+
c_para: z63.record(z63.string(), z63.string()),
|
|
2438
|
+
x: z63.number(),
|
|
2439
|
+
y: z63.number(),
|
|
2440
|
+
puuid: z63.string().optional(),
|
|
2441
|
+
uuid: z63.string(),
|
|
2442
|
+
utime: z63.number(),
|
|
2443
|
+
importFlag: z63.number().optional(),
|
|
2444
|
+
c_spiceCmd: z63.any().optional(),
|
|
2445
|
+
hasIdFlag: z63.boolean()
|
|
2446
|
+
});
|
|
2447
|
+
var BBoxSchema = z63.object({
|
|
2448
|
+
x: z63.number(),
|
|
2449
|
+
y: z63.number(),
|
|
2450
|
+
width: z63.number(),
|
|
2451
|
+
height: z63.number()
|
|
2452
|
+
});
|
|
2453
|
+
var LayerItemSchema = z63.object({
|
|
2454
|
+
name: z63.string(),
|
|
2455
|
+
color: z63.string(),
|
|
2456
|
+
visible: z63.boolean(),
|
|
2457
|
+
active: z63.boolean(),
|
|
2458
|
+
config: z63.boolean(),
|
|
2459
|
+
transparency: z63.boolean()
|
|
2460
|
+
});
|
|
2461
|
+
var ObjectItemSchema = z63.object({
|
|
2462
|
+
name: z63.string(),
|
|
2463
|
+
visible: z63.boolean(),
|
|
2464
|
+
locked: z63.boolean()
|
|
2465
|
+
});
|
|
2466
|
+
var DataStrSchema = z63.object({
|
|
2312
2467
|
head: HeadSchema,
|
|
2313
|
-
canvas:
|
|
2314
|
-
shape:
|
|
2468
|
+
canvas: z63.string(),
|
|
2469
|
+
shape: z63.array(SingleLetterShapeSchema),
|
|
2315
2470
|
BBox: BBoxSchema,
|
|
2316
|
-
colors:
|
|
2471
|
+
colors: z63.array(z63.unknown())
|
|
2317
2472
|
});
|
|
2318
|
-
var PackageDetailDataStrSchema =
|
|
2473
|
+
var PackageDetailDataStrSchema = z63.object({
|
|
2319
2474
|
head: HeadSchema,
|
|
2320
|
-
canvas:
|
|
2321
|
-
shape:
|
|
2475
|
+
canvas: z63.string(),
|
|
2476
|
+
shape: z63.array(z63.string()).transform(
|
|
2322
2477
|
(shapes) => shapes.map((shape) => {
|
|
2323
2478
|
const [type, ...data] = shape.split("~");
|
|
2324
2479
|
return ShapeItemSchema.parse({ type, data: data.join("~") });
|
|
2325
2480
|
})
|
|
2326
|
-
).pipe(
|
|
2327
|
-
layers:
|
|
2481
|
+
).pipe(z63.array(PackageDetailShapeSchema)),
|
|
2482
|
+
layers: z63.array(z63.string()).transform(
|
|
2328
2483
|
(layers) => layers.map((layer) => {
|
|
2329
2484
|
const [name, color, visible, active, config, transparency] = layer.split("~");
|
|
2330
2485
|
return LayerItemSchema.parse({
|
|
@@ -2337,7 +2492,7 @@ var PackageDetailDataStrSchema = z61.object({
|
|
|
2337
2492
|
});
|
|
2338
2493
|
})
|
|
2339
2494
|
),
|
|
2340
|
-
objects:
|
|
2495
|
+
objects: z63.array(z63.string()).transform(
|
|
2341
2496
|
(objects) => objects.map((obj) => {
|
|
2342
2497
|
const [name, visible, locked] = obj.split("~");
|
|
2343
2498
|
return ObjectItemSchema.parse({
|
|
@@ -2348,37 +2503,37 @@ var PackageDetailDataStrSchema = z61.object({
|
|
|
2348
2503
|
})
|
|
2349
2504
|
),
|
|
2350
2505
|
BBox: BBoxSchema,
|
|
2351
|
-
netColors:
|
|
2506
|
+
netColors: z63.array(z63.unknown()).optional()
|
|
2352
2507
|
});
|
|
2353
|
-
var PackageDetailSchema =
|
|
2354
|
-
uuid:
|
|
2355
|
-
title:
|
|
2356
|
-
docType:
|
|
2357
|
-
updateTime:
|
|
2508
|
+
var PackageDetailSchema = z63.object({
|
|
2509
|
+
uuid: z63.string(),
|
|
2510
|
+
title: z63.string(),
|
|
2511
|
+
docType: z63.number(),
|
|
2512
|
+
updateTime: z63.number(),
|
|
2358
2513
|
owner: OwnerSchema,
|
|
2359
|
-
datastrid:
|
|
2360
|
-
writable:
|
|
2514
|
+
datastrid: z63.string(),
|
|
2515
|
+
writable: z63.boolean(),
|
|
2361
2516
|
dataStr: PackageDetailDataStrSchema
|
|
2362
2517
|
});
|
|
2363
|
-
var EasyEdaJsonSchema =
|
|
2364
|
-
uuid:
|
|
2365
|
-
title:
|
|
2366
|
-
description:
|
|
2367
|
-
docType:
|
|
2368
|
-
type:
|
|
2518
|
+
var EasyEdaJsonSchema = z63.object({
|
|
2519
|
+
uuid: z63.string(),
|
|
2520
|
+
title: z63.string(),
|
|
2521
|
+
description: z63.string(),
|
|
2522
|
+
docType: z63.number(),
|
|
2523
|
+
type: z63.number(),
|
|
2369
2524
|
szlcsc: SzlcscSchema,
|
|
2370
2525
|
lcsc: LcscSchema,
|
|
2371
2526
|
owner: OwnerSchema,
|
|
2372
|
-
tags:
|
|
2373
|
-
updateTime:
|
|
2374
|
-
updated_at:
|
|
2527
|
+
tags: z63.array(z63.string()),
|
|
2528
|
+
updateTime: z63.number(),
|
|
2529
|
+
updated_at: z63.string(),
|
|
2375
2530
|
dataStr: DataStrSchema,
|
|
2376
|
-
verify:
|
|
2377
|
-
SMT:
|
|
2378
|
-
datastrid:
|
|
2379
|
-
jlcOnSale:
|
|
2380
|
-
writable:
|
|
2381
|
-
isFavorite:
|
|
2531
|
+
verify: z63.boolean(),
|
|
2532
|
+
SMT: z63.boolean().optional(),
|
|
2533
|
+
datastrid: z63.string(),
|
|
2534
|
+
jlcOnSale: z63.number().optional(),
|
|
2535
|
+
writable: z63.boolean(),
|
|
2536
|
+
isFavorite: z63.boolean(),
|
|
2382
2537
|
packageDetail: PackageDetailSchema
|
|
2383
2538
|
});
|
|
2384
2539
|
|
|
@@ -2438,7 +2593,6 @@ var generateFootprintTsx = (circuitJson) => {
|
|
|
2438
2593
|
var soupTypescriptComponentTemplate = ({
|
|
2439
2594
|
pinLabels,
|
|
2440
2595
|
componentName,
|
|
2441
|
-
schPinArrangement,
|
|
2442
2596
|
objUrl,
|
|
2443
2597
|
circuitJson,
|
|
2444
2598
|
supplierPartNumbers
|
|
@@ -2449,7 +2603,6 @@ import { createUseComponent } from "@tscircuit/core"
|
|
|
2449
2603
|
import type { CommonLayoutProps } from "@tscircuit/props"
|
|
2450
2604
|
|
|
2451
2605
|
const pinLabels = ${JSON.stringify(pinLabels, null, " ")} as const
|
|
2452
|
-
const pinNames = Object.values(pinLabels)
|
|
2453
2606
|
|
|
2454
2607
|
interface Props extends CommonLayoutProps {
|
|
2455
2608
|
name: string
|
|
@@ -2466,14 +2619,13 @@ export const ${componentName} = (props: Props) => {
|
|
|
2466
2619
|
}}` : ""}
|
|
2467
2620
|
pinLabels={pinLabels}
|
|
2468
2621
|
schPinSpacing={0.75}
|
|
2469
|
-
schPortArrangement={${JSON.stringify(schPinArrangement, null, " ")}}
|
|
2470
2622
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
2471
2623
|
footprint={${footprintTsx}}
|
|
2472
2624
|
/>
|
|
2473
2625
|
)
|
|
2474
2626
|
}
|
|
2475
2627
|
|
|
2476
|
-
export const use${componentName} = createUseComponent(${componentName},
|
|
2628
|
+
export const use${componentName} = createUseComponent(${componentName}, pinLabels)
|
|
2477
2629
|
|
|
2478
2630
|
`.trim();
|
|
2479
2631
|
};
|
|
@@ -2505,39 +2657,13 @@ var convertBetterEasyToTsx = async ({
|
|
|
2505
2657
|
const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
|
|
2506
2658
|
const pn = normalizeManufacturerPartNumber(rawPn);
|
|
2507
2659
|
const [cad_component2] = su_default(circuitJson).cad_component.list();
|
|
2508
|
-
const
|
|
2509
|
-
const hasStringPinNumbers = pins.some(
|
|
2510
|
-
(pin) => typeof pin.pinNumber === "string"
|
|
2511
|
-
);
|
|
2512
|
-
let modifiedPins = pins;
|
|
2513
|
-
if (hasStringPinNumbers) {
|
|
2514
|
-
modifiedPins = pins.map((pin, idx) => {
|
|
2515
|
-
const originalPinNumber = pin.pinNumber.toString();
|
|
2516
|
-
const newPinNumber = idx + 1;
|
|
2517
|
-
return {
|
|
2518
|
-
...pin,
|
|
2519
|
-
pinNumber: newPinNumber,
|
|
2520
|
-
label: pin.label
|
|
2521
|
-
};
|
|
2522
|
-
});
|
|
2523
|
-
}
|
|
2524
|
-
const leftPins = modifiedPins.filter((pin) => pin.rotation === 180);
|
|
2525
|
-
const rightPins = modifiedPins.filter((pin) => pin.rotation === 0);
|
|
2526
|
-
const schPinArrangement = {
|
|
2527
|
-
leftSide: {
|
|
2528
|
-
direction: "top-to-bottom",
|
|
2529
|
-
pins: leftPins.map((pin) => Number(pin.pinNumber))
|
|
2530
|
-
},
|
|
2531
|
-
rightSide: {
|
|
2532
|
-
direction: "bottom-to-top",
|
|
2533
|
-
pins: rightPins.map((pin) => Number(pin.pinNumber)).reverse()
|
|
2534
|
-
}
|
|
2535
|
-
};
|
|
2660
|
+
const sourcePorts = su_default(circuitJson).source_port.list();
|
|
2536
2661
|
const pinLabels = {};
|
|
2537
|
-
for (const
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2662
|
+
for (const sourcePort of sourcePorts) {
|
|
2663
|
+
pinLabels[sourcePort.name] = [
|
|
2664
|
+
sourcePort.name,
|
|
2665
|
+
...sourcePort.port_hints ?? []
|
|
2666
|
+
];
|
|
2541
2667
|
}
|
|
2542
2668
|
let modelObjUrl;
|
|
2543
2669
|
if (cad_component2.model_obj_url) {
|
|
@@ -2554,7 +2680,6 @@ var convertBetterEasyToTsx = async ({
|
|
|
2554
2680
|
return soupTypescriptComponentTemplate({
|
|
2555
2681
|
componentName: pn,
|
|
2556
2682
|
pinLabels,
|
|
2557
|
-
schPinArrangement,
|
|
2558
2683
|
objUrl: modelObjUrl,
|
|
2559
2684
|
circuitJson,
|
|
2560
2685
|
supplierPartNumbers
|
|
@@ -2661,4 +2786,4 @@ export {
|
|
|
2661
2786
|
convertRawEasyToTsx,
|
|
2662
2787
|
convertEasyEdaJsonToVariousFormats
|
|
2663
2788
|
};
|
|
2664
|
-
//# sourceMappingURL=chunk-
|
|
2789
|
+
//# sourceMappingURL=chunk-P73EQY2M.js.map
|