easyeda 0.0.271 → 0.0.273
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/browser/index.js +281 -36
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +1885 -1636
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +1883 -1633
- package/dist/main.cjs.map +1 -1
- package/package.json +3 -2
package/dist/browser/index.js
CHANGED
|
@@ -178,19 +178,18 @@ __export(dist_exports, {
|
|
|
178
178
|
simulation_ac_current_source: () => simulation_ac_current_source,
|
|
179
179
|
simulation_ac_voltage_source: () => simulation_ac_voltage_source,
|
|
180
180
|
simulation_current_probe: () => simulation_current_probe,
|
|
181
|
-
simulation_current_probe_display_options: () => simulation_current_probe_display_options,
|
|
182
181
|
simulation_current_source: () => simulation_current_source,
|
|
183
182
|
simulation_dc_current_source: () => simulation_dc_current_source,
|
|
184
183
|
simulation_dc_voltage_source: () => simulation_dc_voltage_source,
|
|
185
184
|
simulation_experiment: () => simulation_experiment,
|
|
186
185
|
simulation_op_amp: () => simulation_op_amp,
|
|
186
|
+
simulation_oscilloscope_trace: () => simulation_oscilloscope_trace,
|
|
187
187
|
simulation_spice_subcircuit: () => simulation_spice_subcircuit,
|
|
188
188
|
simulation_switch: () => simulation_switch,
|
|
189
189
|
simulation_transient_current_graph: () => simulation_transient_current_graph,
|
|
190
190
|
simulation_transient_voltage_graph: () => simulation_transient_voltage_graph,
|
|
191
191
|
simulation_unknown_experiment_error: () => simulation_unknown_experiment_error,
|
|
192
192
|
simulation_voltage_probe: () => simulation_voltage_probe,
|
|
193
|
-
simulation_voltage_probe_display_options: () => simulation_voltage_probe_display_options,
|
|
194
193
|
simulation_voltage_source: () => simulation_voltage_source,
|
|
195
194
|
size: () => size,
|
|
196
195
|
source_ambiguous_port_reference: () => source_ambiguous_port_reference,
|
|
@@ -210,6 +209,7 @@ __export(dist_exports, {
|
|
|
210
209
|
source_net: () => source_net,
|
|
211
210
|
source_no_ground_pin_defined_warning: () => source_no_ground_pin_defined_warning,
|
|
212
211
|
source_no_power_pin_defined_warning: () => source_no_power_pin_defined_warning,
|
|
212
|
+
source_part_not_found_warning: () => source_part_not_found_warning,
|
|
213
213
|
source_pcb_ground_plane: () => source_pcb_ground_plane,
|
|
214
214
|
source_pin_attributes: () => source_pin_attributes,
|
|
215
215
|
source_pin_missing_trace_warning: () => source_pin_missing_trace_warning,
|
|
@@ -217,6 +217,7 @@ __export(dist_exports, {
|
|
|
217
217
|
source_port: () => source_port,
|
|
218
218
|
source_project_metadata: () => source_project_metadata,
|
|
219
219
|
source_property_ignored_warning: () => source_property_ignored_warning,
|
|
220
|
+
source_refdes_convention_warning: () => source_refdes_convention_warning,
|
|
220
221
|
source_simple_ammeter: () => source_simple_ammeter,
|
|
221
222
|
source_simple_battery: () => source_simple_battery,
|
|
222
223
|
source_simple_capacitor: () => source_simple_capacitor,
|
|
@@ -226,6 +227,7 @@ __export(dist_exports, {
|
|
|
226
227
|
source_simple_current_source: () => source_simple_current_source,
|
|
227
228
|
source_simple_diode: () => source_simple_diode,
|
|
228
229
|
source_simple_fiducial: () => source_simple_fiducial,
|
|
230
|
+
source_simple_fuse: () => source_simple_fuse,
|
|
229
231
|
source_simple_ground: () => source_simple_ground,
|
|
230
232
|
source_simple_inductor: () => source_simple_inductor,
|
|
231
233
|
source_simple_led: () => source_simple_led,
|
|
@@ -245,6 +247,7 @@ __export(dist_exports, {
|
|
|
245
247
|
source_simple_voltage_source: () => source_simple_voltage_source,
|
|
246
248
|
source_trace: () => source_trace,
|
|
247
249
|
source_trace_not_connected_error: () => source_trace_not_connected_error,
|
|
250
|
+
source_unnamed_trace_warning: () => source_unnamed_trace_warning,
|
|
248
251
|
spice_simulation_options: () => spice_simulation_options,
|
|
249
252
|
supplier_footprint_mismatch_warning: () => supplier_footprint_mismatch_warning,
|
|
250
253
|
supplier_name: () => supplier_name,
|
|
@@ -4887,6 +4890,12 @@ var source_simple_current_source = source_component_base.extend({
|
|
|
4887
4890
|
expectTypesMatch(
|
|
4888
4891
|
true
|
|
4889
4892
|
);
|
|
4893
|
+
var source_simple_fuse = source_component_base.extend({
|
|
4894
|
+
ftype: external_exports.literal("simple_fuse"),
|
|
4895
|
+
current_rating_amps: external_exports.number().describe("Nominal current in amps the fuse is rated for"),
|
|
4896
|
+
voltage_rating_volts: external_exports.number().describe("Voltage rating in volts, e.g. \xB15V would be 5")
|
|
4897
|
+
});
|
|
4898
|
+
expectTypesMatch(true);
|
|
4890
4899
|
var source_simple_ammeter = source_component_base.extend({
|
|
4891
4900
|
ftype: external_exports.literal("simple_ammeter")
|
|
4892
4901
|
});
|
|
@@ -4931,12 +4940,6 @@ var source_pin_attributes = external_exports.object({
|
|
|
4931
4940
|
supports_uart_rx: external_exports.boolean().optional()
|
|
4932
4941
|
});
|
|
4933
4942
|
expectTypesMatch(true);
|
|
4934
|
-
var source_simple_fuse = source_component_base.extend({
|
|
4935
|
-
ftype: external_exports.literal("simple_fuse"),
|
|
4936
|
-
current_rating_amps: external_exports.number().describe("Nominal current in amps the fuse is rated for"),
|
|
4937
|
-
voltage_rating_volts: external_exports.number().describe("Voltage rating in volts, e.g. \xB15V would be 5")
|
|
4938
|
-
});
|
|
4939
|
-
expectTypesMatch(true);
|
|
4940
4943
|
var source_simple_battery = source_component_base.extend({
|
|
4941
4944
|
ftype: external_exports.literal("simple_battery"),
|
|
4942
4945
|
capacity: battery_capacity
|
|
@@ -5123,6 +5126,23 @@ var source_missing_manufacturer_part_number_warning = external_exports.object({
|
|
|
5123
5126
|
"Warning emitted when a standard connector is missing manufacturer part number"
|
|
5124
5127
|
);
|
|
5125
5128
|
expectTypesMatch(true);
|
|
5129
|
+
var source_refdes_convention_warning = external_exports.object({
|
|
5130
|
+
type: external_exports.literal("source_refdes_convention_warning"),
|
|
5131
|
+
source_refdes_convention_warning_id: getZodPrefixedIdWithDefault(
|
|
5132
|
+
"source_refdes_convention_warning"
|
|
5133
|
+
),
|
|
5134
|
+
warning_type: external_exports.literal("source_refdes_convention_warning").default("source_refdes_convention_warning"),
|
|
5135
|
+
message: external_exports.string(),
|
|
5136
|
+
source_component_id: external_exports.string(),
|
|
5137
|
+
refdes: external_exports.string(),
|
|
5138
|
+
source_component_ftype: external_exports.string(),
|
|
5139
|
+
expected_prefixes: external_exports.array(external_exports.string()),
|
|
5140
|
+
actual_prefix: external_exports.string().optional(),
|
|
5141
|
+
subcircuit_id: external_exports.string().optional()
|
|
5142
|
+
}).describe(
|
|
5143
|
+
"Warning emitted when a source component reference designator does not match the component type convention"
|
|
5144
|
+
);
|
|
5145
|
+
expectTypesMatch(true);
|
|
5126
5146
|
var source_simple_voltage_probe = source_component_base.extend({
|
|
5127
5147
|
ftype: external_exports.literal("simple_voltage_probe")
|
|
5128
5148
|
});
|
|
@@ -5210,6 +5230,7 @@ var any_source_component = external_exports.union([
|
|
|
5210
5230
|
source_property_ignored_warning,
|
|
5211
5231
|
source_pin_missing_trace_warning,
|
|
5212
5232
|
source_missing_manufacturer_part_number_warning,
|
|
5233
|
+
source_refdes_convention_warning,
|
|
5213
5234
|
source_i2c_misconfigured_error,
|
|
5214
5235
|
source_component_misconfigured_error
|
|
5215
5236
|
]);
|
|
@@ -5243,6 +5264,7 @@ var source_trace = external_exports.object({
|
|
|
5243
5264
|
subcircuit_id: external_exports.string().optional(),
|
|
5244
5265
|
subcircuit_connectivity_map_key: external_exports.string().optional(),
|
|
5245
5266
|
max_length: external_exports.number().optional(),
|
|
5267
|
+
name: external_exports.string().optional(),
|
|
5246
5268
|
min_trace_thickness: external_exports.number().optional(),
|
|
5247
5269
|
display_name: external_exports.string().optional()
|
|
5248
5270
|
});
|
|
@@ -5333,6 +5355,19 @@ var source_manually_placed_via = external_exports.object({
|
|
|
5333
5355
|
source_trace_id: external_exports.string().optional()
|
|
5334
5356
|
}).describe("Defines a via that is manually placed in the source domain");
|
|
5335
5357
|
expectTypesMatch(true);
|
|
5358
|
+
var source_unnamed_trace_warning = external_exports.object({
|
|
5359
|
+
type: external_exports.literal("source_unnamed_trace_warning"),
|
|
5360
|
+
source_unnamed_trace_warning_id: getZodPrefixedIdWithDefault(
|
|
5361
|
+
"source_unnamed_trace_warning"
|
|
5362
|
+
),
|
|
5363
|
+
warning_type: external_exports.literal("source_unnamed_trace_warning").default("source_unnamed_trace_warning"),
|
|
5364
|
+
message: external_exports.string(),
|
|
5365
|
+
source_trace_id: external_exports.string(),
|
|
5366
|
+
subcircuit_id: external_exports.string().optional()
|
|
5367
|
+
}).describe("Warning emitted when a source trace is missing a name");
|
|
5368
|
+
expectTypesMatch(
|
|
5369
|
+
true
|
|
5370
|
+
);
|
|
5336
5371
|
var source_no_power_pin_defined_warning = external_exports.object({
|
|
5337
5372
|
type: external_exports.literal("source_no_power_pin_defined_warning"),
|
|
5338
5373
|
source_no_power_pin_defined_warning_id: getZodPrefixedIdWithDefault(
|
|
@@ -5400,8 +5435,26 @@ var unknown_error_finding_part = base_circuit_json_error.extend({
|
|
|
5400
5435
|
"Error emitted when an unexpected error occurs while finding a part"
|
|
5401
5436
|
);
|
|
5402
5437
|
expectTypesMatch(true);
|
|
5438
|
+
var source_part_not_found_warning = external_exports.object({
|
|
5439
|
+
type: external_exports.literal("source_part_not_found_warning"),
|
|
5440
|
+
source_part_not_found_warning_id: getZodPrefixedIdWithDefault(
|
|
5441
|
+
"source_part_not_found_warning"
|
|
5442
|
+
),
|
|
5443
|
+
warning_type: external_exports.literal("source_part_not_found_warning").default("source_part_not_found_warning"),
|
|
5444
|
+
message: external_exports.string(),
|
|
5445
|
+
source_component_id: external_exports.string().optional(),
|
|
5446
|
+
subcircuit_id: external_exports.string().optional(),
|
|
5447
|
+
supplier_name: supplier_name.optional(),
|
|
5448
|
+
manufacturer_part_number: external_exports.string().optional(),
|
|
5449
|
+
supplier_part_number: external_exports.string().optional(),
|
|
5450
|
+
part_name: external_exports.string().optional()
|
|
5451
|
+
}).describe("Warning emitted when a requested part can not be found");
|
|
5452
|
+
expectTypesMatch(
|
|
5453
|
+
true
|
|
5454
|
+
);
|
|
5403
5455
|
var schematic_box = external_exports.object({
|
|
5404
5456
|
type: external_exports.literal("schematic_box"),
|
|
5457
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5405
5458
|
schematic_component_id: external_exports.string().optional(),
|
|
5406
5459
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5407
5460
|
width: distance,
|
|
@@ -5415,6 +5468,7 @@ expectTypesMatch(true);
|
|
|
5415
5468
|
var schematic_path = external_exports.object({
|
|
5416
5469
|
type: external_exports.literal("schematic_path"),
|
|
5417
5470
|
schematic_path_id: getZodPrefixedIdWithDefault("schematic_path"),
|
|
5471
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5418
5472
|
schematic_component_id: external_exports.string().optional(),
|
|
5419
5473
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5420
5474
|
fill_color: external_exports.string().optional(),
|
|
@@ -5476,6 +5530,7 @@ var schematic_component = external_exports.object({
|
|
|
5476
5530
|
center: point,
|
|
5477
5531
|
source_component_id: external_exports.string().optional(),
|
|
5478
5532
|
schematic_component_id: external_exports.string(),
|
|
5533
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5479
5534
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5480
5535
|
pin_spacing: length.optional(),
|
|
5481
5536
|
pin_styles: schematic_pin_styles.optional(),
|
|
@@ -5506,6 +5561,7 @@ expectTypesMatch(true);
|
|
|
5506
5561
|
var schematic_line = external_exports.object({
|
|
5507
5562
|
type: external_exports.literal("schematic_line"),
|
|
5508
5563
|
schematic_line_id: getZodPrefixedIdWithDefault("schematic_line"),
|
|
5564
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5509
5565
|
schematic_component_id: external_exports.string().optional(),
|
|
5510
5566
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5511
5567
|
x1: distance,
|
|
@@ -5523,6 +5579,7 @@ expectTypesMatch(true);
|
|
|
5523
5579
|
var schematic_rect = external_exports.object({
|
|
5524
5580
|
type: external_exports.literal("schematic_rect"),
|
|
5525
5581
|
schematic_rect_id: getZodPrefixedIdWithDefault("schematic_rect"),
|
|
5582
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5526
5583
|
schematic_component_id: external_exports.string().optional(),
|
|
5527
5584
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5528
5585
|
center: point,
|
|
@@ -5540,6 +5597,7 @@ expectTypesMatch(true);
|
|
|
5540
5597
|
var schematic_circle = external_exports.object({
|
|
5541
5598
|
type: external_exports.literal("schematic_circle"),
|
|
5542
5599
|
schematic_circle_id: getZodPrefixedIdWithDefault("schematic_circle"),
|
|
5600
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5543
5601
|
schematic_component_id: external_exports.string().optional(),
|
|
5544
5602
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5545
5603
|
center: point,
|
|
@@ -5555,6 +5613,7 @@ expectTypesMatch(true);
|
|
|
5555
5613
|
var schematic_arc = external_exports.object({
|
|
5556
5614
|
type: external_exports.literal("schematic_arc"),
|
|
5557
5615
|
schematic_arc_id: getZodPrefixedIdWithDefault("schematic_arc"),
|
|
5616
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5558
5617
|
schematic_component_id: external_exports.string().optional(),
|
|
5559
5618
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5560
5619
|
center: point,
|
|
@@ -5571,6 +5630,7 @@ expectTypesMatch(true);
|
|
|
5571
5630
|
var schematic_trace = external_exports.object({
|
|
5572
5631
|
type: external_exports.literal("schematic_trace"),
|
|
5573
5632
|
schematic_trace_id: external_exports.string(),
|
|
5633
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5574
5634
|
source_trace_id: external_exports.string().optional(),
|
|
5575
5635
|
junctions: external_exports.array(
|
|
5576
5636
|
external_exports.object({
|
|
@@ -5608,6 +5668,7 @@ var fivePointAnchor = external_exports.enum([
|
|
|
5608
5668
|
expectTypesMatch(true);
|
|
5609
5669
|
var schematic_text = external_exports.object({
|
|
5610
5670
|
type: external_exports.literal("schematic_text"),
|
|
5671
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5611
5672
|
schematic_component_id: external_exports.string().optional(),
|
|
5612
5673
|
schematic_symbol_id: external_exports.string().optional(),
|
|
5613
5674
|
schematic_text_id: external_exports.string(),
|
|
@@ -5627,6 +5688,7 @@ var schematic_port = external_exports.object({
|
|
|
5627
5688
|
type: external_exports.literal("schematic_port"),
|
|
5628
5689
|
schematic_port_id: external_exports.string(),
|
|
5629
5690
|
source_port_id: external_exports.string(),
|
|
5691
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5630
5692
|
schematic_component_id: external_exports.string().optional(),
|
|
5631
5693
|
center: point,
|
|
5632
5694
|
facing_direction: external_exports.enum(["up", "down", "left", "right"]).optional(),
|
|
@@ -5645,6 +5707,7 @@ expectTypesMatch(true);
|
|
|
5645
5707
|
var schematic_net_label = external_exports.object({
|
|
5646
5708
|
type: external_exports.literal("schematic_net_label"),
|
|
5647
5709
|
schematic_net_label_id: getZodPrefixedIdWithDefault("schematic_net_label"),
|
|
5710
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5648
5711
|
schematic_trace_id: external_exports.string().optional(),
|
|
5649
5712
|
source_trace_id: external_exports.string().optional(),
|
|
5650
5713
|
source_net_id: external_exports.string(),
|
|
@@ -5704,6 +5767,7 @@ expectTypesMatch(true);
|
|
|
5704
5767
|
var schematic_voltage_probe = external_exports.object({
|
|
5705
5768
|
type: external_exports.literal("schematic_voltage_probe"),
|
|
5706
5769
|
schematic_voltage_probe_id: external_exports.string(),
|
|
5770
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5707
5771
|
source_component_id: external_exports.string().optional(),
|
|
5708
5772
|
name: external_exports.string().optional(),
|
|
5709
5773
|
position: point,
|
|
@@ -5732,6 +5796,7 @@ expectTypesMatch(true);
|
|
|
5732
5796
|
var schematic_group = external_exports.object({
|
|
5733
5797
|
type: external_exports.literal("schematic_group"),
|
|
5734
5798
|
schematic_group_id: getZodPrefixedIdWithDefault("schematic_group"),
|
|
5799
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5735
5800
|
source_group_id: external_exports.string(),
|
|
5736
5801
|
is_subcircuit: external_exports.boolean().optional(),
|
|
5737
5802
|
subcircuit_id: external_exports.string().optional(),
|
|
@@ -5747,6 +5812,7 @@ expectTypesMatch(true);
|
|
|
5747
5812
|
var schematic_table = external_exports.object({
|
|
5748
5813
|
type: external_exports.literal("schematic_table"),
|
|
5749
5814
|
schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
|
|
5815
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5750
5816
|
anchor_position: point,
|
|
5751
5817
|
column_widths: external_exports.array(distance),
|
|
5752
5818
|
row_heights: external_exports.array(distance),
|
|
@@ -5762,6 +5828,7 @@ var schematic_table_cell = external_exports.object({
|
|
|
5762
5828
|
schematic_table_cell_id: getZodPrefixedIdWithDefault(
|
|
5763
5829
|
"schematic_table_cell"
|
|
5764
5830
|
),
|
|
5831
|
+
schematic_sheet_id: external_exports.string().optional(),
|
|
5765
5832
|
schematic_table_id: external_exports.string(),
|
|
5766
5833
|
start_row_index: external_exports.number(),
|
|
5767
5834
|
end_row_index: external_exports.number(),
|
|
@@ -5781,7 +5848,9 @@ var schematic_sheet = external_exports.object({
|
|
|
5781
5848
|
type: external_exports.literal("schematic_sheet"),
|
|
5782
5849
|
schematic_sheet_id: getZodPrefixedIdWithDefault("schematic_sheet"),
|
|
5783
5850
|
name: external_exports.string().optional(),
|
|
5784
|
-
|
|
5851
|
+
sheet_index: external_exports.number().optional(),
|
|
5852
|
+
subcircuit_id: external_exports.string().optional(),
|
|
5853
|
+
outline_color: external_exports.string().optional()
|
|
5785
5854
|
}).describe(
|
|
5786
5855
|
"Defines a schematic sheet or page that components can be placed on"
|
|
5787
5856
|
);
|
|
@@ -7644,12 +7713,6 @@ var simulation_switch = external_exports.object({
|
|
|
7644
7713
|
switching_frequency: frequency.optional()
|
|
7645
7714
|
}).describe("Defines a switch for simulation timing control");
|
|
7646
7715
|
expectTypesMatch(true);
|
|
7647
|
-
var simulation_voltage_probe_display_options = external_exports.object({
|
|
7648
|
-
label: external_exports.string().optional(),
|
|
7649
|
-
center: external_exports.number().optional(),
|
|
7650
|
-
offset_divs: external_exports.number().optional(),
|
|
7651
|
-
units_per_div: external_exports.number().optional()
|
|
7652
|
-
});
|
|
7653
7716
|
var simulation_voltage_probe = external_exports.object({
|
|
7654
7717
|
type: external_exports.literal("simulation_voltage_probe"),
|
|
7655
7718
|
simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
|
|
@@ -7662,8 +7725,7 @@ var simulation_voltage_probe = external_exports.object({
|
|
|
7662
7725
|
reference_input_source_port_id: external_exports.string().optional(),
|
|
7663
7726
|
reference_input_source_net_id: external_exports.string().optional(),
|
|
7664
7727
|
subcircuit_id: external_exports.string().optional(),
|
|
7665
|
-
color: external_exports.string().optional()
|
|
7666
|
-
display_options: simulation_voltage_probe_display_options.optional()
|
|
7728
|
+
color: external_exports.string().optional()
|
|
7667
7729
|
}).describe(
|
|
7668
7730
|
"Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points."
|
|
7669
7731
|
).superRefine((data, ctx) => {
|
|
@@ -7701,13 +7763,6 @@ var simulation_voltage_probe = external_exports.object({
|
|
|
7701
7763
|
}
|
|
7702
7764
|
});
|
|
7703
7765
|
expectTypesMatch(true);
|
|
7704
|
-
expectTypesMatch(true);
|
|
7705
|
-
var simulation_current_probe_display_options = external_exports.object({
|
|
7706
|
-
label: external_exports.string().optional(),
|
|
7707
|
-
center: external_exports.number().optional(),
|
|
7708
|
-
offset_divs: external_exports.number().optional(),
|
|
7709
|
-
units_per_div: external_exports.number().optional()
|
|
7710
|
-
});
|
|
7711
7766
|
var simulation_current_probe = external_exports.object({
|
|
7712
7767
|
type: external_exports.literal("simulation_current_probe"),
|
|
7713
7768
|
simulation_current_probe_id: getZodPrefixedIdWithDefault(
|
|
@@ -7720,8 +7775,7 @@ var simulation_current_probe = external_exports.object({
|
|
|
7720
7775
|
positive_source_net_id: external_exports.string().optional(),
|
|
7721
7776
|
negative_source_net_id: external_exports.string().optional(),
|
|
7722
7777
|
subcircuit_id: external_exports.string().optional(),
|
|
7723
|
-
color: external_exports.string().optional()
|
|
7724
|
-
display_options: simulation_current_probe_display_options.optional()
|
|
7778
|
+
color: external_exports.string().optional()
|
|
7725
7779
|
}).describe(
|
|
7726
7780
|
"Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint."
|
|
7727
7781
|
).superRefine((data, ctx) => {
|
|
@@ -7762,7 +7816,6 @@ var simulation_current_probe = external_exports.object({
|
|
|
7762
7816
|
});
|
|
7763
7817
|
});
|
|
7764
7818
|
expectTypesMatch(true);
|
|
7765
|
-
expectTypesMatch(true);
|
|
7766
7819
|
var simulation_unknown_experiment_error = base_circuit_json_error.extend({
|
|
7767
7820
|
type: external_exports.literal("simulation_unknown_experiment_error"),
|
|
7768
7821
|
simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
|
|
@@ -7796,6 +7849,53 @@ var simulation_spice_subcircuit = external_exports.object({
|
|
|
7796
7849
|
expectTypesMatch(
|
|
7797
7850
|
true
|
|
7798
7851
|
);
|
|
7852
|
+
var hasValue = (value) => value !== void 0;
|
|
7853
|
+
var simulation_oscilloscope_trace = external_exports.object({
|
|
7854
|
+
type: external_exports.literal("simulation_oscilloscope_trace"),
|
|
7855
|
+
simulation_oscilloscope_trace_id: getZodPrefixedIdWithDefault(
|
|
7856
|
+
"simulation_oscilloscope_trace"
|
|
7857
|
+
),
|
|
7858
|
+
simulation_transient_voltage_graph_id: external_exports.string().optional(),
|
|
7859
|
+
simulation_transient_current_graph_id: external_exports.string().optional(),
|
|
7860
|
+
simulation_voltage_probe_id: external_exports.string().optional(),
|
|
7861
|
+
simulation_current_probe_id: external_exports.string().optional(),
|
|
7862
|
+
display_name: external_exports.string().optional(),
|
|
7863
|
+
color: external_exports.string().optional(),
|
|
7864
|
+
display_center_value: external_exports.number().optional(),
|
|
7865
|
+
display_center_offset_divs: external_exports.number().optional(),
|
|
7866
|
+
volts_per_div: external_exports.number().positive().optional(),
|
|
7867
|
+
amps_per_div: external_exports.number().positive().optional()
|
|
7868
|
+
}).describe(
|
|
7869
|
+
"Defines how a simulation measurement is rendered as an oscilloscope-style trace."
|
|
7870
|
+
).superRefine((data, ctx) => {
|
|
7871
|
+
const voltageReferences = [
|
|
7872
|
+
data.simulation_transient_voltage_graph_id,
|
|
7873
|
+
data.simulation_voltage_probe_id
|
|
7874
|
+
].filter(hasValue).length;
|
|
7875
|
+
const currentReferences = [
|
|
7876
|
+
data.simulation_transient_current_graph_id,
|
|
7877
|
+
data.simulation_current_probe_id
|
|
7878
|
+
].filter(hasValue).length;
|
|
7879
|
+
if (voltageReferences + currentReferences !== 1) {
|
|
7880
|
+
ctx.addIssue({
|
|
7881
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7882
|
+
message: "An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe."
|
|
7883
|
+
});
|
|
7884
|
+
}
|
|
7885
|
+
if (voltageReferences > 0 && data.amps_per_div !== void 0) {
|
|
7886
|
+
ctx.addIssue({
|
|
7887
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7888
|
+
message: "Voltage oscilloscope traces must use volts_per_div, not amps_per_div."
|
|
7889
|
+
});
|
|
7890
|
+
}
|
|
7891
|
+
if (currentReferences > 0 && data.volts_per_div !== void 0) {
|
|
7892
|
+
ctx.addIssue({
|
|
7893
|
+
code: external_exports.ZodIssueCode.custom,
|
|
7894
|
+
message: "Current oscilloscope traces must use amps_per_div, not volts_per_div."
|
|
7895
|
+
});
|
|
7896
|
+
}
|
|
7897
|
+
});
|
|
7898
|
+
expectTypesMatch(true);
|
|
7799
7899
|
var any_circuit_element = external_exports.union([
|
|
7800
7900
|
source_trace,
|
|
7801
7901
|
source_port,
|
|
@@ -7828,12 +7928,15 @@ var any_circuit_element = external_exports.union([
|
|
|
7828
7928
|
source_invalid_component_property_error,
|
|
7829
7929
|
source_trace_not_connected_error,
|
|
7830
7930
|
source_pin_missing_trace_warning,
|
|
7931
|
+
source_unnamed_trace_warning,
|
|
7831
7932
|
source_missing_manufacturer_part_number_warning,
|
|
7933
|
+
source_refdes_convention_warning,
|
|
7832
7934
|
source_no_power_pin_defined_warning,
|
|
7833
7935
|
source_no_ground_pin_defined_warning,
|
|
7834
7936
|
source_component_pins_underspecified_warning,
|
|
7835
7937
|
source_pin_must_be_connected_error,
|
|
7836
7938
|
unknown_error_finding_part,
|
|
7939
|
+
source_part_not_found_warning,
|
|
7837
7940
|
source_i2c_misconfigured_error,
|
|
7838
7941
|
source_component_misconfigured_error,
|
|
7839
7942
|
source_ambiguous_port_reference,
|
|
@@ -7934,6 +8037,7 @@ var any_circuit_element = external_exports.union([
|
|
|
7934
8037
|
simulation_switch,
|
|
7935
8038
|
simulation_voltage_probe,
|
|
7936
8039
|
simulation_current_probe,
|
|
8040
|
+
simulation_oscilloscope_trace,
|
|
7937
8041
|
simulation_unknown_experiment_error,
|
|
7938
8042
|
simulation_op_amp,
|
|
7939
8043
|
simulation_spice_subcircuit
|
|
@@ -11181,11 +11285,11 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
11181
11285
|
const cornerRadius = smtPad.corner_radius ?? smtPad.rect_border_radius ?? void 0;
|
|
11182
11286
|
const cornerRadiusAttr = cornerRadius !== void 0 ? ` cornerRadius="${mmStr(cornerRadius)}"` : "";
|
|
11183
11287
|
elementStrings.push(
|
|
11184
|
-
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}"${cornerRadiusAttr} shape="rect" />`
|
|
11288
|
+
`<smtpad portHints={${JSON.stringify(mapPortHints(smtPad.port_hints, options.portHintsMap))}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}"${cornerRadiusAttr} shape="rect" />`
|
|
11185
11289
|
);
|
|
11186
11290
|
} else if (smtPad.shape === "pill") {
|
|
11187
11291
|
elementStrings.push(
|
|
11188
|
-
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" radius="${mmStr(smtPad.radius)}" shape="pill" />`
|
|
11292
|
+
`<smtpad portHints={${JSON.stringify(mapPortHints(smtPad.port_hints, options.portHintsMap))}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" radius="${mmStr(smtPad.radius)}" shape="pill" />`
|
|
11189
11293
|
);
|
|
11190
11294
|
} else if (smtPad.shape === "polygon") {
|
|
11191
11295
|
const pointsStr = smtPad.points.map((p) => `{x: "${mmStr(p.x)}", y: "${mmStr(p.y)}"}`).join(", ");
|
|
@@ -11228,7 +11332,11 @@ var getPinLabelValues = (labels) => {
|
|
|
11228
11332
|
if (typeof labels === "string") return [labels];
|
|
11229
11333
|
return [...labels];
|
|
11230
11334
|
};
|
|
11231
|
-
var
|
|
11335
|
+
var getPinKeySortValue = (pinKey) => {
|
|
11336
|
+
const match = /^pin(\d+)$/i.exec(pinKey);
|
|
11337
|
+
return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER;
|
|
11338
|
+
};
|
|
11339
|
+
var getPolarizedPinMetadata = (pinLabels) => {
|
|
11232
11340
|
const labelsByPin = Object.entries(pinLabels ?? {}).map(([pin, labels]) => ({
|
|
11233
11341
|
pin,
|
|
11234
11342
|
labels: getPinLabelValues(labels).map((label) => label.toLowerCase())
|
|
@@ -11240,9 +11348,17 @@ var getPolarizedPortHintsMap = (pinLabels) => {
|
|
|
11240
11348
|
({ labels }) => labels.some((label) => ["c", "k", "cathode", "neg", "-"].includes(label))
|
|
11241
11349
|
)?.pin;
|
|
11242
11350
|
if (!anodePin || !cathodePin) return void 0;
|
|
11351
|
+
const polarizedPinEntries = [
|
|
11352
|
+
[anodePin, ["anode", "pos"]],
|
|
11353
|
+
[cathodePin, ["cathode", "neg"]]
|
|
11354
|
+
].sort(
|
|
11355
|
+
([pinA], [pinB]) => getPinKeySortValue(pinA) - getPinKeySortValue(pinB)
|
|
11356
|
+
);
|
|
11243
11357
|
return {
|
|
11244
|
-
|
|
11245
|
-
|
|
11358
|
+
portHintsMap: Object.fromEntries(
|
|
11359
|
+
polarizedPinEntries.map(([pin, labels]) => [pin, [pin, ...labels]])
|
|
11360
|
+
),
|
|
11361
|
+
pinLabels: Object.fromEntries(polarizedPinEntries)
|
|
11246
11362
|
};
|
|
11247
11363
|
};
|
|
11248
11364
|
var generateTypescriptComponent = ({
|
|
@@ -11256,10 +11372,13 @@ var generateTypescriptComponent = ({
|
|
|
11256
11372
|
componentType = "chip"
|
|
11257
11373
|
}) => {
|
|
11258
11374
|
const safePinLabels = pinLabels ?? {};
|
|
11375
|
+
const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
|
|
11376
|
+
const polarizedPortHintsMap = polarizedPinMetadata?.portHintsMap;
|
|
11377
|
+
const polarizedPinLabels = polarizedPinMetadata?.pinLabels;
|
|
11259
11378
|
const cadComponent = circuitJson.find((item) => item.type === "cad_component");
|
|
11260
11379
|
const footprintTsx = generateFootprintTsx(
|
|
11261
11380
|
circuitJson,
|
|
11262
|
-
componentType === "diode" || componentType === "led" ? { portHintsMap:
|
|
11381
|
+
componentType === "diode" || componentType === "led" ? { portHintsMap: polarizedPortHintsMap } : void 0
|
|
11263
11382
|
);
|
|
11264
11383
|
const simplifiedPinLabels = Object.fromEntries(
|
|
11265
11384
|
Object.entries(safePinLabels).map(([pin, labels]) => {
|
|
@@ -11270,6 +11389,14 @@ var generateTypescriptComponent = ({
|
|
|
11270
11389
|
})
|
|
11271
11390
|
);
|
|
11272
11391
|
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
11392
|
+
const polarizedPinLabelsString = Object.entries(polarizedPinLabels ?? {}).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
11393
|
+
const polarizedPinLabelsBlock = polarizedPinLabels ? `const pinLabels = {
|
|
11394
|
+
${polarizedPinLabelsString}
|
|
11395
|
+
} as const
|
|
11396
|
+
|
|
11397
|
+
` : "";
|
|
11398
|
+
const polarizedPinLabelsProp = polarizedPinLabels ? ` pinLabels={pinLabels}
|
|
11399
|
+
` : "";
|
|
11273
11400
|
const cadModelLines = [
|
|
11274
11401
|
objUrl ? `objUrl: "${objUrl}",` : "",
|
|
11275
11402
|
stepUrl ? `stepUrl: "${stepUrl}",` : "",
|
|
@@ -11280,13 +11407,13 @@ var generateTypescriptComponent = ({
|
|
|
11280
11407
|
return `
|
|
11281
11408
|
import type { DiodeProps } from "@tscircuit/props"
|
|
11282
11409
|
|
|
11283
|
-
export const ${componentName} = (props: DiodeProps) => {
|
|
11410
|
+
${polarizedPinLabelsBlock}export const ${componentName} = (props: DiodeProps) => {
|
|
11284
11411
|
const { name = "D1", ...restProps } = props
|
|
11285
11412
|
|
|
11286
11413
|
return (
|
|
11287
11414
|
<diode
|
|
11288
11415
|
name={name}
|
|
11289
|
-
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11416
|
+
${polarizedPinLabelsProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11290
11417
|
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
11291
11418
|
footprint={${footprintTsx}}
|
|
11292
11419
|
${objUrl || stepUrl ? `cadModel={{
|
|
@@ -11302,12 +11429,66 @@ ${cadModelLines}
|
|
|
11302
11429
|
return `
|
|
11303
11430
|
import type { LedProps } from "@tscircuit/props"
|
|
11304
11431
|
|
|
11305
|
-
export const ${componentName} = (props: LedProps) => {
|
|
11432
|
+
${polarizedPinLabelsBlock}export const ${componentName} = (props: LedProps) => {
|
|
11306
11433
|
const { name = "LED1", ...restProps } = props
|
|
11307
11434
|
|
|
11308
11435
|
return (
|
|
11309
11436
|
<led
|
|
11310
11437
|
name={name}
|
|
11438
|
+
${polarizedPinLabelsProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11439
|
+
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
11440
|
+
footprint={${footprintTsx}}
|
|
11441
|
+
${objUrl || stepUrl ? `cadModel={{
|
|
11442
|
+
${cadModelLines}
|
|
11443
|
+
}}` : ""}
|
|
11444
|
+
{...restProps}
|
|
11445
|
+
/>
|
|
11446
|
+
)
|
|
11447
|
+
}
|
|
11448
|
+
`.trim();
|
|
11449
|
+
}
|
|
11450
|
+
if (componentType === "pushbutton") {
|
|
11451
|
+
return `
|
|
11452
|
+
import type { PushButtonProps } from "@tscircuit/props"
|
|
11453
|
+
|
|
11454
|
+
const pinLabels = {
|
|
11455
|
+
${pinLabelsString}
|
|
11456
|
+
} as const
|
|
11457
|
+
|
|
11458
|
+
export const ${componentName} = (props: PushButtonProps<typeof pinLabels>) => {
|
|
11459
|
+
const { name = "SW1", ...restProps } = props
|
|
11460
|
+
|
|
11461
|
+
return (
|
|
11462
|
+
<pushbutton
|
|
11463
|
+
name={name}
|
|
11464
|
+
pinLabels={pinLabels}
|
|
11465
|
+
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11466
|
+
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
11467
|
+
footprint={${footprintTsx}}
|
|
11468
|
+
${objUrl || stepUrl ? `cadModel={{
|
|
11469
|
+
${cadModelLines}
|
|
11470
|
+
}}` : ""}
|
|
11471
|
+
{...restProps}
|
|
11472
|
+
/>
|
|
11473
|
+
)
|
|
11474
|
+
}
|
|
11475
|
+
`.trim();
|
|
11476
|
+
}
|
|
11477
|
+
if (componentType === "switch") {
|
|
11478
|
+
return `
|
|
11479
|
+
import type { SwitchProps } from "@tscircuit/props"
|
|
11480
|
+
|
|
11481
|
+
const pinLabels = {
|
|
11482
|
+
${pinLabelsString}
|
|
11483
|
+
} as const
|
|
11484
|
+
|
|
11485
|
+
export const ${componentName} = (props: SwitchProps) => {
|
|
11486
|
+
const { name = "SW1", ...restProps } = props
|
|
11487
|
+
|
|
11488
|
+
return (
|
|
11489
|
+
<switch
|
|
11490
|
+
name={name}
|
|
11491
|
+
pinLabels={pinLabels}
|
|
11311
11492
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11312
11493
|
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
11313
11494
|
footprint={${footprintTsx}}
|
|
@@ -11398,10 +11579,74 @@ var isLedCategoryComponent = (betterEasy) => {
|
|
|
11398
11579
|
].some(categoryValueContainsLed);
|
|
11399
11580
|
};
|
|
11400
11581
|
|
|
11582
|
+
// lib/websafe/convert-to-typescript-component/category-value-contains-pushbutton.ts
|
|
11583
|
+
var categoryValueContainsPushbutton = (value) => {
|
|
11584
|
+
if (typeof value === "string") {
|
|
11585
|
+
const normalized = value.toLowerCase();
|
|
11586
|
+
if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
|
|
11587
|
+
return false;
|
|
11588
|
+
}
|
|
11589
|
+
return /push\s*buttons?/.test(normalized) || /pushbuttons?/.test(normalized) || /tact(?:ile)?\s+switch(?:es)?/.test(normalized) || /keyboard\s+(?:switch(?:es)?|shaft)/.test(normalized) || /mechanical\s+keyboard\s+shaft/.test(normalized);
|
|
11590
|
+
}
|
|
11591
|
+
if (Array.isArray(value)) {
|
|
11592
|
+
return value.some(categoryValueContainsPushbutton);
|
|
11593
|
+
}
|
|
11594
|
+
if (value && typeof value === "object") {
|
|
11595
|
+
return Object.values(value).some(categoryValueContainsPushbutton);
|
|
11596
|
+
}
|
|
11597
|
+
return false;
|
|
11598
|
+
};
|
|
11599
|
+
|
|
11600
|
+
// lib/websafe/convert-to-typescript-component/is-pushbutton-category-component.ts
|
|
11601
|
+
var isPushbuttonCategoryComponent = (betterEasy) => {
|
|
11602
|
+
const cPara = betterEasy.dataStr.head.c_para;
|
|
11603
|
+
return [
|
|
11604
|
+
betterEasy.tags,
|
|
11605
|
+
cPara.category,
|
|
11606
|
+
cPara.Category,
|
|
11607
|
+
cPara["LCSC Category"],
|
|
11608
|
+
cPara["JLCPCB Category"],
|
|
11609
|
+
betterEasy.category
|
|
11610
|
+
].some(categoryValueContainsPushbutton);
|
|
11611
|
+
};
|
|
11612
|
+
|
|
11613
|
+
// lib/websafe/convert-to-typescript-component/category-value-contains-switch.ts
|
|
11614
|
+
var categoryValueContainsSwitch = (value) => {
|
|
11615
|
+
if (typeof value === "string") {
|
|
11616
|
+
const normalized = value.toLowerCase();
|
|
11617
|
+
if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
|
|
11618
|
+
return false;
|
|
11619
|
+
}
|
|
11620
|
+
return /(?:slide|toggle|dip|key|micro|limit)\s+switch(?:es)?/.test(normalized) || /(^|[^a-z])switch(?:es)?([^a-z]|$)/.test(normalized);
|
|
11621
|
+
}
|
|
11622
|
+
if (Array.isArray(value)) {
|
|
11623
|
+
return value.some(categoryValueContainsSwitch);
|
|
11624
|
+
}
|
|
11625
|
+
if (value && typeof value === "object") {
|
|
11626
|
+
return Object.values(value).some(categoryValueContainsSwitch);
|
|
11627
|
+
}
|
|
11628
|
+
return false;
|
|
11629
|
+
};
|
|
11630
|
+
|
|
11631
|
+
// lib/websafe/convert-to-typescript-component/is-switch-category-component.ts
|
|
11632
|
+
var isSwitchCategoryComponent = (betterEasy) => {
|
|
11633
|
+
const cPara = betterEasy.dataStr.head.c_para;
|
|
11634
|
+
return [
|
|
11635
|
+
betterEasy.tags,
|
|
11636
|
+
cPara.category,
|
|
11637
|
+
cPara.Category,
|
|
11638
|
+
cPara["LCSC Category"],
|
|
11639
|
+
cPara["JLCPCB Category"],
|
|
11640
|
+
betterEasy.category
|
|
11641
|
+
].some(categoryValueContainsSwitch);
|
|
11642
|
+
};
|
|
11643
|
+
|
|
11401
11644
|
// lib/websafe/convert-to-typescript-component/index.tsx
|
|
11402
11645
|
var getGeneratedComponentType = (betterEasy) => {
|
|
11403
11646
|
if (isLedCategoryComponent(betterEasy)) return "led";
|
|
11404
11647
|
if (isDiodeCategoryComponent(betterEasy)) return "diode";
|
|
11648
|
+
if (isPushbuttonCategoryComponent(betterEasy)) return "pushbutton";
|
|
11649
|
+
if (isSwitchCategoryComponent(betterEasy)) return "switch";
|
|
11405
11650
|
return "chip";
|
|
11406
11651
|
};
|
|
11407
11652
|
var convertRawEasyToTsx = async ({ rawEasy }) => {
|