easyeda 0.0.250 → 0.0.252
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.d.ts +6 -2
- package/dist/browser/index.js +1590 -1560
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +193 -167
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +2580 -2554
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -4,6 +4,238 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// node_modules/circuit-json/dist/index.mjs
|
|
8
|
+
var dist_exports = {};
|
|
9
|
+
__export(dist_exports, {
|
|
10
|
+
all_layers: () => all_layers,
|
|
11
|
+
any_circuit_element: () => any_circuit_element,
|
|
12
|
+
any_soup_element: () => any_soup_element,
|
|
13
|
+
any_source_component: () => any_source_component,
|
|
14
|
+
asset: () => asset,
|
|
15
|
+
base_circuit_json_error: () => base_circuit_json_error,
|
|
16
|
+
battery_capacity: () => battery_capacity,
|
|
17
|
+
brep_shape: () => brep_shape,
|
|
18
|
+
cadModelDefaultDirectionMap: () => cadModelDefaultDirectionMap,
|
|
19
|
+
cad_component: () => cad_component,
|
|
20
|
+
cad_model_axis_directions: () => cad_model_axis_directions,
|
|
21
|
+
cad_model_formats: () => cad_model_formats,
|
|
22
|
+
capacitance: () => capacitance,
|
|
23
|
+
circuit_json_footprint_load_error: () => circuit_json_footprint_load_error,
|
|
24
|
+
current: () => current,
|
|
25
|
+
distance: () => distance,
|
|
26
|
+
duration_ms: () => duration_ms,
|
|
27
|
+
experiment_type: () => experiment_type,
|
|
28
|
+
external_footprint_load_error: () => external_footprint_load_error,
|
|
29
|
+
frequency: () => frequency,
|
|
30
|
+
getZodPrefixedIdWithDefault: () => getZodPrefixedIdWithDefault,
|
|
31
|
+
inductance: () => inductance,
|
|
32
|
+
kicadAt: () => kicadAt,
|
|
33
|
+
kicadEffects: () => kicadEffects,
|
|
34
|
+
kicadFont: () => kicadFont,
|
|
35
|
+
kicadFootprintAttributes: () => kicadFootprintAttributes,
|
|
36
|
+
kicadFootprintMetadata: () => kicadFootprintMetadata,
|
|
37
|
+
kicadFootprintModel: () => kicadFootprintModel,
|
|
38
|
+
kicadFootprintPad: () => kicadFootprintPad,
|
|
39
|
+
kicadFootprintProperties: () => kicadFootprintProperties,
|
|
40
|
+
kicadProperty: () => kicadProperty,
|
|
41
|
+
kicadSymbolEffects: () => kicadSymbolEffects,
|
|
42
|
+
kicadSymbolMetadata: () => kicadSymbolMetadata,
|
|
43
|
+
kicadSymbolPinNames: () => kicadSymbolPinNames,
|
|
44
|
+
kicadSymbolPinNumbers: () => kicadSymbolPinNumbers,
|
|
45
|
+
kicadSymbolProperties: () => kicadSymbolProperties,
|
|
46
|
+
kicadSymbolProperty: () => kicadSymbolProperty,
|
|
47
|
+
layer_ref: () => layer_ref,
|
|
48
|
+
layer_string: () => layer_string,
|
|
49
|
+
length: () => length,
|
|
50
|
+
ms: () => ms,
|
|
51
|
+
ninePointAnchor: () => ninePointAnchor,
|
|
52
|
+
pcbRenderLayer: () => pcbRenderLayer,
|
|
53
|
+
pcb_autorouting_error: () => pcb_autorouting_error,
|
|
54
|
+
pcb_board: () => pcb_board,
|
|
55
|
+
pcb_breakout_point: () => pcb_breakout_point,
|
|
56
|
+
pcb_component: () => pcb_component,
|
|
57
|
+
pcb_component_invalid_layer_error: () => pcb_component_invalid_layer_error,
|
|
58
|
+
pcb_component_not_on_board_edge_error: () => pcb_component_not_on_board_edge_error,
|
|
59
|
+
pcb_component_outside_board_error: () => pcb_component_outside_board_error,
|
|
60
|
+
pcb_connector_not_in_accessible_orientation_warning: () => pcb_connector_not_in_accessible_orientation_warning,
|
|
61
|
+
pcb_copper_pour: () => pcb_copper_pour,
|
|
62
|
+
pcb_copper_pour_brep: () => pcb_copper_pour_brep,
|
|
63
|
+
pcb_copper_pour_polygon: () => pcb_copper_pour_polygon,
|
|
64
|
+
pcb_copper_pour_rect: () => pcb_copper_pour_rect,
|
|
65
|
+
pcb_copper_text: () => pcb_copper_text,
|
|
66
|
+
pcb_courtyard_circle: () => pcb_courtyard_circle,
|
|
67
|
+
pcb_courtyard_outline: () => pcb_courtyard_outline,
|
|
68
|
+
pcb_courtyard_overlap_error: () => pcb_courtyard_overlap_error,
|
|
69
|
+
pcb_courtyard_polygon: () => pcb_courtyard_polygon,
|
|
70
|
+
pcb_courtyard_rect: () => pcb_courtyard_rect,
|
|
71
|
+
pcb_cutout: () => pcb_cutout,
|
|
72
|
+
pcb_cutout_circle: () => pcb_cutout_circle,
|
|
73
|
+
pcb_cutout_path: () => pcb_cutout_path,
|
|
74
|
+
pcb_cutout_polygon: () => pcb_cutout_polygon,
|
|
75
|
+
pcb_cutout_rect: () => pcb_cutout_rect,
|
|
76
|
+
pcb_fabrication_note_dimension: () => pcb_fabrication_note_dimension,
|
|
77
|
+
pcb_fabrication_note_path: () => pcb_fabrication_note_path,
|
|
78
|
+
pcb_fabrication_note_rect: () => pcb_fabrication_note_rect,
|
|
79
|
+
pcb_fabrication_note_text: () => pcb_fabrication_note_text,
|
|
80
|
+
pcb_footprint_overlap_error: () => pcb_footprint_overlap_error,
|
|
81
|
+
pcb_ground_plane: () => pcb_ground_plane,
|
|
82
|
+
pcb_ground_plane_region: () => pcb_ground_plane_region,
|
|
83
|
+
pcb_group: () => pcb_group,
|
|
84
|
+
pcb_hole: () => pcb_hole,
|
|
85
|
+
pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
|
|
86
|
+
pcb_hole_circle_shape: () => pcb_hole_circle_shape,
|
|
87
|
+
pcb_hole_oval_shape: () => pcb_hole_oval_shape,
|
|
88
|
+
pcb_hole_pill_shape: () => pcb_hole_pill_shape,
|
|
89
|
+
pcb_hole_rect_shape: () => pcb_hole_rect_shape,
|
|
90
|
+
pcb_hole_rotated_pill_shape: () => pcb_hole_rotated_pill_shape,
|
|
91
|
+
pcb_keepout: () => pcb_keepout,
|
|
92
|
+
pcb_manual_edit_conflict_warning: () => pcb_manual_edit_conflict_warning,
|
|
93
|
+
pcb_missing_footprint_error: () => pcb_missing_footprint_error,
|
|
94
|
+
pcb_net: () => pcb_net,
|
|
95
|
+
pcb_note_dimension: () => pcb_note_dimension,
|
|
96
|
+
pcb_note_line: () => pcb_note_line,
|
|
97
|
+
pcb_note_path: () => pcb_note_path,
|
|
98
|
+
pcb_note_rect: () => pcb_note_rect,
|
|
99
|
+
pcb_note_text: () => pcb_note_text,
|
|
100
|
+
pcb_panel: () => pcb_panel,
|
|
101
|
+
pcb_panelization_placement_error: () => pcb_panelization_placement_error,
|
|
102
|
+
pcb_placement_error: () => pcb_placement_error,
|
|
103
|
+
pcb_plated_hole: () => pcb_plated_hole,
|
|
104
|
+
pcb_port: () => pcb_port,
|
|
105
|
+
pcb_port_not_connected_error: () => pcb_port_not_connected_error,
|
|
106
|
+
pcb_port_not_matched_error: () => pcb_port_not_matched_error,
|
|
107
|
+
pcb_route_hint: () => pcb_route_hint,
|
|
108
|
+
pcb_route_hints: () => pcb_route_hints,
|
|
109
|
+
pcb_silkscreen_circle: () => pcb_silkscreen_circle,
|
|
110
|
+
pcb_silkscreen_line: () => pcb_silkscreen_line,
|
|
111
|
+
pcb_silkscreen_oval: () => pcb_silkscreen_oval,
|
|
112
|
+
pcb_silkscreen_path: () => pcb_silkscreen_path,
|
|
113
|
+
pcb_silkscreen_pill: () => pcb_silkscreen_pill,
|
|
114
|
+
pcb_silkscreen_rect: () => pcb_silkscreen_rect,
|
|
115
|
+
pcb_silkscreen_text: () => pcb_silkscreen_text,
|
|
116
|
+
pcb_smtpad: () => pcb_smtpad,
|
|
117
|
+
pcb_smtpad_pill: () => pcb_smtpad_pill,
|
|
118
|
+
pcb_solder_paste: () => pcb_solder_paste,
|
|
119
|
+
pcb_text: () => pcb_text,
|
|
120
|
+
pcb_thermal_spoke: () => pcb_thermal_spoke,
|
|
121
|
+
pcb_trace: () => pcb_trace,
|
|
122
|
+
pcb_trace_error: () => pcb_trace_error,
|
|
123
|
+
pcb_trace_hint: () => pcb_trace_hint,
|
|
124
|
+
pcb_trace_missing_error: () => pcb_trace_missing_error,
|
|
125
|
+
pcb_trace_route_point: () => pcb_trace_route_point,
|
|
126
|
+
pcb_trace_route_point_via: () => pcb_trace_route_point_via,
|
|
127
|
+
pcb_trace_route_point_wire: () => pcb_trace_route_point_wire,
|
|
128
|
+
pcb_via: () => pcb_via,
|
|
129
|
+
pcb_via_clearance_error: () => pcb_via_clearance_error,
|
|
130
|
+
point: () => point,
|
|
131
|
+
point3: () => point3,
|
|
132
|
+
point_with_bulge: () => point_with_bulge,
|
|
133
|
+
port_arrangement: () => port_arrangement,
|
|
134
|
+
position: () => position,
|
|
135
|
+
position3: () => position3,
|
|
136
|
+
resistance: () => resistance,
|
|
137
|
+
ring: () => ring,
|
|
138
|
+
rotation: () => rotation,
|
|
139
|
+
route_hint_point: () => route_hint_point,
|
|
140
|
+
schematic_arc: () => schematic_arc,
|
|
141
|
+
schematic_box: () => schematic_box,
|
|
142
|
+
schematic_circle: () => schematic_circle,
|
|
143
|
+
schematic_component: () => schematic_component,
|
|
144
|
+
schematic_component_port_arrangement_by_sides: () => schematic_component_port_arrangement_by_sides,
|
|
145
|
+
schematic_component_port_arrangement_by_size: () => schematic_component_port_arrangement_by_size,
|
|
146
|
+
schematic_debug_line: () => schematic_debug_line,
|
|
147
|
+
schematic_debug_object: () => schematic_debug_object,
|
|
148
|
+
schematic_debug_object_base: () => schematic_debug_object_base,
|
|
149
|
+
schematic_debug_point: () => schematic_debug_point,
|
|
150
|
+
schematic_debug_rect: () => schematic_debug_rect,
|
|
151
|
+
schematic_error: () => schematic_error,
|
|
152
|
+
schematic_group: () => schematic_group,
|
|
153
|
+
schematic_layout_error: () => schematic_layout_error,
|
|
154
|
+
schematic_line: () => schematic_line,
|
|
155
|
+
schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
|
|
156
|
+
schematic_net_label: () => schematic_net_label,
|
|
157
|
+
schematic_path: () => schematic_path,
|
|
158
|
+
schematic_pin_styles: () => schematic_pin_styles,
|
|
159
|
+
schematic_port: () => schematic_port,
|
|
160
|
+
schematic_rect: () => schematic_rect,
|
|
161
|
+
schematic_sheet: () => schematic_sheet,
|
|
162
|
+
schematic_symbol: () => schematic_symbol,
|
|
163
|
+
schematic_table: () => schematic_table,
|
|
164
|
+
schematic_table_cell: () => schematic_table_cell,
|
|
165
|
+
schematic_text: () => schematic_text,
|
|
166
|
+
schematic_trace: () => schematic_trace,
|
|
167
|
+
schematic_voltage_probe: () => schematic_voltage_probe,
|
|
168
|
+
simulation_ac_current_source: () => simulation_ac_current_source,
|
|
169
|
+
simulation_ac_voltage_source: () => simulation_ac_voltage_source,
|
|
170
|
+
simulation_current_source: () => simulation_current_source,
|
|
171
|
+
simulation_dc_current_source: () => simulation_dc_current_source,
|
|
172
|
+
simulation_dc_voltage_source: () => simulation_dc_voltage_source,
|
|
173
|
+
simulation_experiment: () => simulation_experiment,
|
|
174
|
+
simulation_op_amp: () => simulation_op_amp,
|
|
175
|
+
simulation_switch: () => simulation_switch,
|
|
176
|
+
simulation_transient_voltage_graph: () => simulation_transient_voltage_graph,
|
|
177
|
+
simulation_unknown_experiment_error: () => simulation_unknown_experiment_error,
|
|
178
|
+
simulation_voltage_probe: () => simulation_voltage_probe,
|
|
179
|
+
simulation_voltage_source: () => simulation_voltage_source,
|
|
180
|
+
size: () => size,
|
|
181
|
+
source_ambiguous_port_reference: () => source_ambiguous_port_reference,
|
|
182
|
+
source_board: () => source_board,
|
|
183
|
+
source_component_base: () => source_component_base,
|
|
184
|
+
source_component_internal_connection: () => source_component_internal_connection,
|
|
185
|
+
source_component_pins_underspecified_warning: () => source_component_pins_underspecified_warning,
|
|
186
|
+
source_failed_to_create_component_error: () => source_failed_to_create_component_error,
|
|
187
|
+
source_group: () => source_group,
|
|
188
|
+
source_i2c_misconfigured_error: () => source_i2c_misconfigured_error,
|
|
189
|
+
source_interconnect: () => source_interconnect,
|
|
190
|
+
source_invalid_component_property_error: () => source_invalid_component_property_error,
|
|
191
|
+
source_manually_placed_via: () => source_manually_placed_via,
|
|
192
|
+
source_missing_property_error: () => source_missing_property_error,
|
|
193
|
+
source_net: () => source_net,
|
|
194
|
+
source_no_ground_pin_defined_warning: () => source_no_ground_pin_defined_warning,
|
|
195
|
+
source_no_power_pin_defined_warning: () => source_no_power_pin_defined_warning,
|
|
196
|
+
source_pcb_ground_plane: () => source_pcb_ground_plane,
|
|
197
|
+
source_pin_attributes: () => source_pin_attributes,
|
|
198
|
+
source_pin_missing_trace_warning: () => source_pin_missing_trace_warning,
|
|
199
|
+
source_pin_must_be_connected_error: () => source_pin_must_be_connected_error,
|
|
200
|
+
source_port: () => source_port,
|
|
201
|
+
source_project_metadata: () => source_project_metadata,
|
|
202
|
+
source_property_ignored_warning: () => source_property_ignored_warning,
|
|
203
|
+
source_simple_battery: () => source_simple_battery,
|
|
204
|
+
source_simple_capacitor: () => source_simple_capacitor,
|
|
205
|
+
source_simple_chip: () => source_simple_chip,
|
|
206
|
+
source_simple_connector: () => source_simple_connector,
|
|
207
|
+
source_simple_crystal: () => source_simple_crystal,
|
|
208
|
+
source_simple_current_source: () => source_simple_current_source,
|
|
209
|
+
source_simple_diode: () => source_simple_diode,
|
|
210
|
+
source_simple_fiducial: () => source_simple_fiducial,
|
|
211
|
+
source_simple_ground: () => source_simple_ground,
|
|
212
|
+
source_simple_inductor: () => source_simple_inductor,
|
|
213
|
+
source_simple_led: () => source_simple_led,
|
|
214
|
+
source_simple_mosfet: () => source_simple_mosfet,
|
|
215
|
+
source_simple_op_amp: () => source_simple_op_amp,
|
|
216
|
+
source_simple_pin_header: () => source_simple_pin_header,
|
|
217
|
+
source_simple_pinout: () => source_simple_pinout,
|
|
218
|
+
source_simple_potentiometer: () => source_simple_potentiometer,
|
|
219
|
+
source_simple_power_source: () => source_simple_power_source,
|
|
220
|
+
source_simple_push_button: () => source_simple_push_button,
|
|
221
|
+
source_simple_resistor: () => source_simple_resistor,
|
|
222
|
+
source_simple_resonator: () => source_simple_resonator,
|
|
223
|
+
source_simple_switch: () => source_simple_switch,
|
|
224
|
+
source_simple_test_point: () => source_simple_test_point,
|
|
225
|
+
source_simple_transistor: () => source_simple_transistor,
|
|
226
|
+
source_simple_voltage_probe: () => source_simple_voltage_probe,
|
|
227
|
+
source_simple_voltage_source: () => source_simple_voltage_source,
|
|
228
|
+
source_trace: () => source_trace,
|
|
229
|
+
source_trace_not_connected_error: () => source_trace_not_connected_error,
|
|
230
|
+
supplier_name: () => supplier_name,
|
|
231
|
+
time: () => time,
|
|
232
|
+
timestamp: () => timestamp,
|
|
233
|
+
unknown_error_finding_part: () => unknown_error_finding_part,
|
|
234
|
+
visible_layer: () => visible_layer,
|
|
235
|
+
voltage: () => voltage,
|
|
236
|
+
wave_shape: () => wave_shape
|
|
237
|
+
});
|
|
238
|
+
|
|
7
239
|
// node_modules/zod/v3/external.js
|
|
8
240
|
var external_exports = {};
|
|
9
241
|
__export(external_exports, {
|
|
@@ -4045,1380 +4277,408 @@ var coerce = {
|
|
|
4045
4277
|
};
|
|
4046
4278
|
var NEVER = INVALID;
|
|
4047
4279
|
|
|
4048
|
-
//
|
|
4049
|
-
var
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
var PointSchema = external_exports.any().transform((p) => {
|
|
4057
|
-
if (Array.isArray(p)) {
|
|
4058
|
-
const [x, y] = p;
|
|
4059
|
-
return { x, y };
|
|
4060
|
-
}
|
|
4061
|
-
if (typeof p === "object") {
|
|
4062
|
-
return p;
|
|
4063
|
-
}
|
|
4064
|
-
throw new Error(`Invalid point: ${p}`);
|
|
4065
|
-
}).pipe(
|
|
4066
|
-
external_exports.object({
|
|
4067
|
-
x: external_exports.number(),
|
|
4068
|
-
y: external_exports.number()
|
|
4069
|
-
})
|
|
4070
|
-
);
|
|
4071
|
-
var BaseShapeSchema = external_exports.object({
|
|
4072
|
-
type: external_exports.string(),
|
|
4073
|
-
id: external_exports.string().optional(),
|
|
4074
|
-
layer: external_exports.coerce.number().optional()
|
|
4075
|
-
});
|
|
4076
|
-
var TrackSchema = BaseShapeSchema.extend({
|
|
4077
|
-
type: external_exports.literal("TRACK"),
|
|
4078
|
-
width: external_exports.coerce.number(),
|
|
4079
|
-
points: external_exports.array(PointSchema)
|
|
4080
|
-
});
|
|
4081
|
-
var PadSchema = BaseShapeSchema.extend({
|
|
4082
|
-
type: external_exports.literal("PAD"),
|
|
4083
|
-
shape: external_exports.enum(["RECT", "ELLIPSE", "OVAL", "POLYGON"]),
|
|
4084
|
-
center: external_exports.object({
|
|
4085
|
-
x: tenthmil,
|
|
4086
|
-
y: tenthmil
|
|
4087
|
-
}),
|
|
4088
|
-
width: tenthmil,
|
|
4089
|
-
height: tenthmil,
|
|
4090
|
-
layermask: external_exports.number(),
|
|
4091
|
-
net: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
|
|
4092
|
-
number: external_exports.union([external_exports.string(), external_exports.number()]),
|
|
4093
|
-
holeRadius: tenthmil,
|
|
4094
|
-
points: external_exports.array(PointSchema).optional(),
|
|
4095
|
-
rotation: safeNumber(0),
|
|
4096
|
-
// Will default to 0 if NaN or missing
|
|
4097
|
-
plated: external_exports.boolean()
|
|
4098
|
-
});
|
|
4099
|
-
var ArcSchema = BaseShapeSchema.extend({
|
|
4100
|
-
type: external_exports.literal("ARC"),
|
|
4101
|
-
width: external_exports.number(),
|
|
4102
|
-
start: PointSchema,
|
|
4103
|
-
end: PointSchema,
|
|
4104
|
-
radiusX: external_exports.number(),
|
|
4105
|
-
radiusY: external_exports.number(),
|
|
4106
|
-
largeArc: external_exports.boolean(),
|
|
4107
|
-
sweepDirection: external_exports.enum(["CW", "CCW"])
|
|
4108
|
-
});
|
|
4109
|
-
var CircleSchema = BaseShapeSchema.extend({
|
|
4110
|
-
type: external_exports.literal("CIRCLE"),
|
|
4111
|
-
center: PointSchema,
|
|
4112
|
-
radius: external_exports.number(),
|
|
4113
|
-
width: external_exports.number()
|
|
4114
|
-
});
|
|
4115
|
-
var SolidRegionSchema = BaseShapeSchema.extend({
|
|
4116
|
-
type: external_exports.literal("SOLIDREGION"),
|
|
4117
|
-
layermask: external_exports.number(),
|
|
4118
|
-
points: external_exports.array(PointSchema),
|
|
4119
|
-
fillStyle: external_exports.string()
|
|
4120
|
-
});
|
|
4121
|
-
var SVGNodeSchema = BaseShapeSchema.extend({
|
|
4122
|
-
type: external_exports.literal("SVGNODE"),
|
|
4123
|
-
svgData: external_exports.object({
|
|
4124
|
-
gId: external_exports.string(),
|
|
4125
|
-
nodeName: external_exports.string(),
|
|
4126
|
-
nodeType: external_exports.number(),
|
|
4127
|
-
layerid: external_exports.string(),
|
|
4128
|
-
attrs: external_exports.record(external_exports.string(), external_exports.string()),
|
|
4129
|
-
childNodes: external_exports.array(external_exports.unknown())
|
|
4130
|
-
})
|
|
4131
|
-
});
|
|
4132
|
-
var HoleSchema = BaseShapeSchema.extend({
|
|
4133
|
-
type: external_exports.literal("HOLE"),
|
|
4134
|
-
center: PointSchema,
|
|
4135
|
-
radius: external_exports.number()
|
|
4136
|
-
});
|
|
4137
|
-
var ViaSchema = BaseShapeSchema.extend({
|
|
4138
|
-
type: external_exports.literal("VIA"),
|
|
4139
|
-
center: PointSchema,
|
|
4140
|
-
outerDiameter: external_exports.number(),
|
|
4141
|
-
holeDiameter: external_exports.number()
|
|
4142
|
-
});
|
|
4143
|
-
var RectSchema = BaseShapeSchema.extend({
|
|
4144
|
-
type: external_exports.literal("RECT"),
|
|
4145
|
-
x: tenthmil,
|
|
4146
|
-
y: tenthmil,
|
|
4147
|
-
width: tenthmil,
|
|
4148
|
-
height: tenthmil,
|
|
4149
|
-
lineWidth: external_exports.number(),
|
|
4150
|
-
fillStyle: external_exports.string(),
|
|
4151
|
-
rotation: external_exports.number().optional()
|
|
4152
|
-
});
|
|
4153
|
-
var TextSchema = BaseShapeSchema.extend({
|
|
4154
|
-
type: external_exports.literal("TEXT"),
|
|
4155
|
-
text: external_exports.string(),
|
|
4156
|
-
x: tenthmil,
|
|
4157
|
-
y: tenthmil,
|
|
4158
|
-
size_mm: external_exports.number(),
|
|
4159
|
-
rotation: external_exports.number().optional(),
|
|
4160
|
-
layer: external_exports.number().optional(),
|
|
4161
|
-
textAnchor: external_exports.enum(["L", "C", "R", ""]).optional().transform((val) => val === "" ? void 0 : val),
|
|
4162
|
-
font: external_exports.string().optional()
|
|
4163
|
-
});
|
|
4164
|
-
var PackageDetailShapeSchema = external_exports.discriminatedUnion("type", [
|
|
4165
|
-
TrackSchema,
|
|
4166
|
-
PadSchema,
|
|
4167
|
-
ArcSchema,
|
|
4168
|
-
CircleSchema,
|
|
4169
|
-
SolidRegionSchema,
|
|
4170
|
-
SVGNodeSchema,
|
|
4171
|
-
HoleSchema,
|
|
4172
|
-
ViaSchema,
|
|
4173
|
-
RectSchema,
|
|
4174
|
-
TextSchema
|
|
4175
|
-
]);
|
|
4176
|
-
var pairs = (arr) => {
|
|
4177
|
-
const pairs2 = [];
|
|
4178
|
-
for (let i = 0; i < arr.length; i += 2) {
|
|
4179
|
-
pairs2.push([arr[i], arr[i + 1]]);
|
|
4180
|
-
}
|
|
4181
|
-
return pairs2;
|
|
4182
|
-
};
|
|
4183
|
-
var parsePoints = (pointsStr) => pairs(
|
|
4184
|
-
pointsStr.trim().split(" ").map((n) => Number(n))
|
|
4185
|
-
);
|
|
4186
|
-
var ShapeItemSchema = external_exports.object({
|
|
4187
|
-
type: external_exports.string(),
|
|
4188
|
-
data: external_exports.string()
|
|
4189
|
-
}).transform((shape) => {
|
|
4190
|
-
switch (shape.type) {
|
|
4191
|
-
case "TRACK": {
|
|
4192
|
-
const [width, layer, _, pointsStr, id, _n] = shape.data.split("~");
|
|
4193
|
-
const points = parsePoints(pointsStr);
|
|
4194
|
-
return TrackSchema.parse({ type: "TRACK", width, layer, points, id });
|
|
4195
|
-
}
|
|
4196
|
-
case "PAD": {
|
|
4197
|
-
const [padShape, ...params] = shape.data.split("~");
|
|
4198
|
-
const [
|
|
4199
|
-
centerX,
|
|
4200
|
-
centerY,
|
|
4201
|
-
width,
|
|
4202
|
-
height,
|
|
4203
|
-
layermask,
|
|
4204
|
-
net,
|
|
4205
|
-
number,
|
|
4206
|
-
holeRadius,
|
|
4207
|
-
...rest
|
|
4208
|
-
] = params.map((p) => Number.isNaN(Number(p)) ? p : Number(p));
|
|
4209
|
-
const center = { x: centerX, y: centerY };
|
|
4210
|
-
let points;
|
|
4211
|
-
if (padShape === "RECT" || padShape === "POLYGON") {
|
|
4212
|
-
points = parsePoints(rest[0]);
|
|
4213
|
-
}
|
|
4214
|
-
const r = Number(rest[1]);
|
|
4215
|
-
const rotation2 = Number.isNaN(r) ? void 0 : r;
|
|
4216
|
-
const padInputParams = {
|
|
4217
|
-
type: "PAD",
|
|
4218
|
-
shape: padShape,
|
|
4219
|
-
center,
|
|
4220
|
-
width,
|
|
4221
|
-
height,
|
|
4222
|
-
layermask,
|
|
4223
|
-
net,
|
|
4224
|
-
number,
|
|
4225
|
-
holeRadius,
|
|
4226
|
-
points,
|
|
4227
|
-
rotation: rotation2,
|
|
4228
|
-
plated: rest.includes("Y")
|
|
4229
|
-
};
|
|
4230
|
-
const pad = PadSchema.parse(padInputParams);
|
|
4231
|
-
return pad;
|
|
4280
|
+
// node_modules/circuit-json/dist/index.mjs
|
|
4281
|
+
var unitMappings = {
|
|
4282
|
+
Hz: {
|
|
4283
|
+
baseUnit: "Hz",
|
|
4284
|
+
variants: {
|
|
4285
|
+
MHz: 1e6,
|
|
4286
|
+
kHz: 1e3,
|
|
4287
|
+
Hz: 1
|
|
4232
4288
|
}
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
throw new Error(`Invalid arc data: ${arcData}`);
|
|
4240
|
-
}
|
|
4241
|
-
const [
|
|
4242
|
-
,
|
|
4243
|
-
startX,
|
|
4244
|
-
startY,
|
|
4245
|
-
radiusX,
|
|
4246
|
-
radiusY,
|
|
4247
|
-
xAxisRotation,
|
|
4248
|
-
largeArcFlag,
|
|
4249
|
-
sweepFlag,
|
|
4250
|
-
endX,
|
|
4251
|
-
endY
|
|
4252
|
-
] = match;
|
|
4253
|
-
const start = [Number(startX), Number(startY)];
|
|
4254
|
-
const end = [Number(endX), Number(endY)];
|
|
4255
|
-
return ArcSchema.parse({
|
|
4256
|
-
type: "ARC",
|
|
4257
|
-
width: Number(width),
|
|
4258
|
-
layer: Number(layer),
|
|
4259
|
-
start,
|
|
4260
|
-
end,
|
|
4261
|
-
radiusX: Number(radiusX),
|
|
4262
|
-
radiusY: Number(radiusY),
|
|
4263
|
-
largeArc: largeArcFlag === "1",
|
|
4264
|
-
// sweepFlag=1 means clockwise (CW), sweepFlag=0 means counter-clockwise (CCW)
|
|
4265
|
-
sweepDirection: sweepFlag === "1" ? "CW" : "CCW"
|
|
4266
|
-
});
|
|
4289
|
+
},
|
|
4290
|
+
g: {
|
|
4291
|
+
baseUnit: "g",
|
|
4292
|
+
variants: {
|
|
4293
|
+
kg: 1e3,
|
|
4294
|
+
g: 1
|
|
4267
4295
|
}
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4296
|
+
},
|
|
4297
|
+
\u03A9: {
|
|
4298
|
+
baseUnit: "\u03A9",
|
|
4299
|
+
variants: {
|
|
4300
|
+
m\u03A9: 1e-3,
|
|
4301
|
+
\u03A9: 1,
|
|
4302
|
+
k\u03A9: 1e3,
|
|
4303
|
+
K\u03A9: 1e3,
|
|
4304
|
+
kohm: 1e3,
|
|
4305
|
+
M\u03A9: 1e6,
|
|
4306
|
+
G\u03A9: 1e9,
|
|
4307
|
+
T\u03A9: 1e12
|
|
4279
4308
|
}
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4309
|
+
},
|
|
4310
|
+
V: {
|
|
4311
|
+
baseUnit: "V",
|
|
4312
|
+
variants: {
|
|
4313
|
+
mV: 1e-3,
|
|
4314
|
+
V: 1,
|
|
4315
|
+
kV: 1e3,
|
|
4316
|
+
KV: 1e3,
|
|
4317
|
+
MV: 1e6,
|
|
4318
|
+
GV: 1e9,
|
|
4319
|
+
TV: 1e12
|
|
4289
4320
|
}
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4321
|
+
},
|
|
4322
|
+
A: {
|
|
4323
|
+
baseUnit: "A",
|
|
4324
|
+
variants: {
|
|
4325
|
+
\u00B5A: 1e-6,
|
|
4326
|
+
mA: 1e-3,
|
|
4327
|
+
ma: 1e-3,
|
|
4328
|
+
A: 1,
|
|
4329
|
+
kA: 1e3,
|
|
4330
|
+
MA: 1e6
|
|
4300
4331
|
}
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
fillStyle,
|
|
4312
|
-
id
|
|
4313
|
-
});
|
|
4332
|
+
},
|
|
4333
|
+
F: {
|
|
4334
|
+
baseUnit: "F",
|
|
4335
|
+
variants: {
|
|
4336
|
+
pF: 1e-12,
|
|
4337
|
+
nF: 1e-9,
|
|
4338
|
+
\u00B5F: 1e-6,
|
|
4339
|
+
uF: 1e-6,
|
|
4340
|
+
mF: 1e-3,
|
|
4341
|
+
F: 1
|
|
4314
4342
|
}
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4343
|
+
},
|
|
4344
|
+
ml: {
|
|
4345
|
+
baseUnit: "ml",
|
|
4346
|
+
variants: {
|
|
4347
|
+
ml: 1,
|
|
4348
|
+
mL: 1,
|
|
4349
|
+
l: 1e3,
|
|
4350
|
+
L: 1e3
|
|
4318
4351
|
}
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
x,
|
|
4325
|
-
y,
|
|
4326
|
-
width,
|
|
4327
|
-
height,
|
|
4328
|
-
lineWidth: Number(lineWidth),
|
|
4329
|
-
id,
|
|
4330
|
-
rotation: Number.isNaN(r) ? void 0 : r,
|
|
4331
|
-
layer: layer ? Number(layer) : void 0,
|
|
4332
|
-
fillStyle: fillStyle || void 0
|
|
4333
|
-
});
|
|
4352
|
+
},
|
|
4353
|
+
deg: {
|
|
4354
|
+
baseUnit: "deg",
|
|
4355
|
+
variants: {
|
|
4356
|
+
rad: 180 / Math.PI
|
|
4334
4357
|
}
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4358
|
+
},
|
|
4359
|
+
ms: {
|
|
4360
|
+
baseUnit: "ms",
|
|
4361
|
+
variants: {
|
|
4362
|
+
fs: 1e-12,
|
|
4363
|
+
ps: 1e-9,
|
|
4364
|
+
ns: 1e-6,
|
|
4365
|
+
us: 1e-3,
|
|
4366
|
+
\u00B5s: 1e-3,
|
|
4367
|
+
ms: 1,
|
|
4368
|
+
s: 1e3
|
|
4369
|
+
}
|
|
4370
|
+
},
|
|
4371
|
+
mm: {
|
|
4372
|
+
baseUnit: "mm",
|
|
4373
|
+
variants: {
|
|
4374
|
+
nm: 1e-6,
|
|
4375
|
+
\u00B5m: 1e-3,
|
|
4376
|
+
um: 1e-3,
|
|
4377
|
+
mm: 1,
|
|
4378
|
+
cm: 10,
|
|
4379
|
+
dm: 100,
|
|
4380
|
+
m: 1e3,
|
|
4381
|
+
km: 1e6,
|
|
4382
|
+
in: 25.4,
|
|
4383
|
+
ft: 304.8,
|
|
4384
|
+
IN: 25.4,
|
|
4385
|
+
FT: 304.8,
|
|
4386
|
+
yd: 914.4,
|
|
4387
|
+
mi: 1609344,
|
|
4388
|
+
mil: 0.0254
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
};
|
|
4392
|
+
var unitMappingAndVariantSuffixes = /* @__PURE__ */ new Set();
|
|
4393
|
+
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
4394
|
+
unitMappingAndVariantSuffixes.add(baseUnit);
|
|
4395
|
+
for (const variant of Object.keys(info.variants)) {
|
|
4396
|
+
unitMappingAndVariantSuffixes.add(variant);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
function getBaseTscircuitUnit(unit) {
|
|
4400
|
+
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
4401
|
+
if (unit in info.variants) {
|
|
4402
|
+
return {
|
|
4403
|
+
baseUnit: info.baseUnit,
|
|
4404
|
+
conversionFactor: info.variants[unit]
|
|
4405
|
+
};
|
|
4351
4406
|
}
|
|
4352
|
-
default:
|
|
4353
|
-
throw new Error(`Unknown shape type: ${shape.type}`);
|
|
4354
4407
|
}
|
|
4355
|
-
}).pipe(PackageDetailShapeSchema);
|
|
4356
|
-
var ShapesArraySchema = external_exports.array(ShapeItemSchema);
|
|
4357
|
-
|
|
4358
|
-
// lib/utils/easyeda-unit-to-mm.ts
|
|
4359
|
-
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
4360
|
-
|
|
4361
|
-
// lib/schemas/single-letter-shape-schema.ts
|
|
4362
|
-
var PointSchema2 = external_exports.object({
|
|
4363
|
-
x: external_exports.number(),
|
|
4364
|
-
y: external_exports.number()
|
|
4365
|
-
});
|
|
4366
|
-
var RectangleShapeOutputSchema = external_exports.object({
|
|
4367
|
-
type: external_exports.literal("RECTANGLE"),
|
|
4368
|
-
position: PointSchema2,
|
|
4369
|
-
width: external_exports.number(),
|
|
4370
|
-
height: external_exports.number(),
|
|
4371
|
-
color: external_exports.string(),
|
|
4372
|
-
lineWidth: external_exports.number(),
|
|
4373
|
-
id: external_exports.string()
|
|
4374
|
-
});
|
|
4375
|
-
var parseRectangle = (str) => {
|
|
4376
|
-
const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
|
|
4377
4408
|
return {
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
width: Number(width),
|
|
4381
|
-
height: Number(height),
|
|
4382
|
-
color,
|
|
4383
|
-
lineWidth: Number(lineWidth),
|
|
4384
|
-
id
|
|
4409
|
+
baseUnit: unit,
|
|
4410
|
+
conversionFactor: 1
|
|
4385
4411
|
};
|
|
4412
|
+
}
|
|
4413
|
+
var si_prefix_multiplier = {
|
|
4414
|
+
tera: 1e12,
|
|
4415
|
+
T: 1e12,
|
|
4416
|
+
giga: 1e9,
|
|
4417
|
+
G: 1e9,
|
|
4418
|
+
mega: 1e6,
|
|
4419
|
+
M: 1e6,
|
|
4420
|
+
kilo: 1e3,
|
|
4421
|
+
k: 1e3,
|
|
4422
|
+
deci: 0.1,
|
|
4423
|
+
d: 0.1,
|
|
4424
|
+
centi: 0.01,
|
|
4425
|
+
c: 0.01,
|
|
4426
|
+
milli: 1e-3,
|
|
4427
|
+
m: 1e-3,
|
|
4428
|
+
micro: 1e-6,
|
|
4429
|
+
u: 1e-6,
|
|
4430
|
+
\u00B5: 1e-6,
|
|
4431
|
+
nano: 1e-9,
|
|
4432
|
+
n: 1e-9,
|
|
4433
|
+
pico: 1e-12,
|
|
4434
|
+
p: 1e-12
|
|
4386
4435
|
};
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4436
|
+
function parseAndConvertSiUnit(v) {
|
|
4437
|
+
if (v === void 0 || v === null)
|
|
4438
|
+
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
4439
|
+
if (typeof v === "string" && v.match(/^-?[\d\.]+$/))
|
|
4440
|
+
return {
|
|
4441
|
+
value: Number.parseFloat(v),
|
|
4442
|
+
parsedUnit: null,
|
|
4443
|
+
unitOfValue: null
|
|
4444
|
+
};
|
|
4445
|
+
if (typeof v === "number")
|
|
4446
|
+
return { value: v, parsedUnit: null, unitOfValue: null };
|
|
4447
|
+
if (typeof v === "object" && "x" in v && "y" in v) {
|
|
4448
|
+
const { parsedUnit, unitOfValue } = parseAndConvertSiUnit(v.x);
|
|
4449
|
+
const xResult = parseAndConvertSiUnit(v.x);
|
|
4450
|
+
const yResult = parseAndConvertSiUnit(v.y);
|
|
4451
|
+
if (xResult.value === null || yResult.value === null) {
|
|
4452
|
+
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
4453
|
+
}
|
|
4454
|
+
return {
|
|
4455
|
+
parsedUnit,
|
|
4456
|
+
unitOfValue,
|
|
4457
|
+
value: {
|
|
4458
|
+
x: xResult.value,
|
|
4459
|
+
y: yResult.value
|
|
4460
|
+
}
|
|
4461
|
+
};
|
|
4462
|
+
}
|
|
4463
|
+
const reversed_input_string = v.toString().split("").reverse().join("");
|
|
4464
|
+
const unit_reversed = reversed_input_string.match(/[^\d\s]+/)?.[0];
|
|
4465
|
+
if (!unit_reversed) {
|
|
4466
|
+
throw new Error(`Could not determine unit: "${v}"`);
|
|
4467
|
+
}
|
|
4468
|
+
const unit = unit_reversed.split("").reverse().join("");
|
|
4469
|
+
const numberPart = v.slice(0, -unit.length);
|
|
4470
|
+
if (unit in si_prefix_multiplier && !unitMappingAndVariantSuffixes.has(unit)) {
|
|
4471
|
+
const siMultiplier = si_prefix_multiplier[unit];
|
|
4472
|
+
return {
|
|
4473
|
+
parsedUnit: null,
|
|
4474
|
+
unitOfValue: null,
|
|
4475
|
+
value: Number.parseFloat(numberPart) * siMultiplier
|
|
4476
|
+
};
|
|
4477
|
+
}
|
|
4478
|
+
const { baseUnit, conversionFactor } = getBaseTscircuitUnit(unit);
|
|
4399
4479
|
return {
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
radiusY: Number(radiusY),
|
|
4404
|
-
color,
|
|
4405
|
-
lineWidth: Number(lineWidth),
|
|
4406
|
-
id
|
|
4480
|
+
parsedUnit: unit,
|
|
4481
|
+
unitOfValue: baseUnit,
|
|
4482
|
+
value: conversionFactor * Number.parseFloat(numberPart)
|
|
4407
4483
|
};
|
|
4408
|
-
}
|
|
4409
|
-
var
|
|
4410
|
-
var
|
|
4411
|
-
|
|
4412
|
-
start: PointSchema2,
|
|
4413
|
-
end: PointSchema2,
|
|
4414
|
-
radius: external_exports.number(),
|
|
4415
|
-
sweepFlag: external_exports.boolean(),
|
|
4416
|
-
color: external_exports.string(),
|
|
4417
|
-
lineWidth: external_exports.number(),
|
|
4418
|
-
id: external_exports.string()
|
|
4419
|
-
});
|
|
4420
|
-
var parseArc = (str) => {
|
|
4421
|
-
const [, pathData, color, lineWidth, , , id] = str.split("~");
|
|
4422
|
-
const parts = pathData.split(" ");
|
|
4423
|
-
const x1 = Number(parts[1]) || 0;
|
|
4424
|
-
const y1 = Number(parts[2]) || 0;
|
|
4425
|
-
const radius = Number(parts[4]) || 0;
|
|
4426
|
-
const sweepFlag = parts[7] === "1";
|
|
4427
|
-
const x2 = Number(parts[8]) || 0;
|
|
4428
|
-
const y2 = Number(parts[9]) || 0;
|
|
4429
|
-
const parsedLineWidth = Number(lineWidth);
|
|
4430
|
-
const finalLineWidth = Number.isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
4431
|
-
return {
|
|
4432
|
-
type: "ARC",
|
|
4433
|
-
start: { x: x1, y: y1 },
|
|
4434
|
-
end: { x: x2, y: y2 },
|
|
4435
|
-
radius,
|
|
4436
|
-
sweepFlag,
|
|
4437
|
-
color: color || "#880000",
|
|
4438
|
-
// Default color
|
|
4439
|
-
lineWidth: finalLineWidth,
|
|
4440
|
-
id: id || "gge1"
|
|
4441
|
-
};
|
|
4442
|
-
};
|
|
4443
|
-
var ArcShapeSchema = external_exports.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema);
|
|
4444
|
-
var PinShapeOutputSchema = external_exports.object({
|
|
4445
|
-
type: external_exports.literal("PIN"),
|
|
4446
|
-
visibility: external_exports.enum(["show", "hide", "none"]),
|
|
4447
|
-
pinNumber: external_exports.union([external_exports.string(), external_exports.number()]),
|
|
4448
|
-
x: external_exports.number(),
|
|
4449
|
-
y: external_exports.number(),
|
|
4450
|
-
rotation: external_exports.number(),
|
|
4451
|
-
id: external_exports.string(),
|
|
4452
|
-
label: external_exports.string(),
|
|
4453
|
-
labelColor: external_exports.string(),
|
|
4454
|
-
path: external_exports.string(),
|
|
4455
|
-
arrow: external_exports.string()
|
|
4484
|
+
}
|
|
4485
|
+
var resistance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4486
|
+
var capacitance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value).transform((value) => {
|
|
4487
|
+
return Number.parseFloat(value.toPrecision(12));
|
|
4456
4488
|
});
|
|
4457
|
-
var
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
id,
|
|
4477
|
-
pinNumber: Number.isNaN(Number(pinNumber)) ? pinNumber : Number(pinNumber),
|
|
4478
|
-
x: Number.parseFloat(x),
|
|
4479
|
-
y: Number.parseFloat(y),
|
|
4480
|
-
rotation: Number.isNaN(r) ? 0 : r,
|
|
4481
|
-
label,
|
|
4482
|
-
labelColor,
|
|
4483
|
-
path,
|
|
4484
|
-
arrow
|
|
4485
|
-
};
|
|
4486
|
-
};
|
|
4487
|
-
var PinShapeSchema = external_exports.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
|
|
4488
|
-
var PolylineShapeOutputSchema = external_exports.object({
|
|
4489
|
-
type: external_exports.literal("POLYLINE"),
|
|
4490
|
-
points: external_exports.array(PointSchema2),
|
|
4491
|
-
color: external_exports.string(),
|
|
4492
|
-
lineWidth: external_exports.number(),
|
|
4493
|
-
id: external_exports.string()
|
|
4489
|
+
var inductance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4490
|
+
var voltage = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4491
|
+
var length = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4492
|
+
var frequency = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4493
|
+
var distance = length;
|
|
4494
|
+
var current = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4495
|
+
var duration_ms = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
4496
|
+
var time = duration_ms;
|
|
4497
|
+
var ms = duration_ms;
|
|
4498
|
+
var timestamp = external_exports.string().datetime();
|
|
4499
|
+
var rotation = external_exports.string().or(external_exports.number()).transform((arg) => {
|
|
4500
|
+
if (typeof arg === "number") return arg;
|
|
4501
|
+
if (arg.endsWith("deg")) {
|
|
4502
|
+
return Number.parseFloat(arg.split("deg")[0]);
|
|
4503
|
+
}
|
|
4504
|
+
if (arg.endsWith("rad")) {
|
|
4505
|
+
return Number.parseFloat(arg.split("rad")[0]) * 180 / Math.PI;
|
|
4506
|
+
}
|
|
4507
|
+
return Number.parseFloat(arg);
|
|
4494
4508
|
});
|
|
4495
|
-
var
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4509
|
+
var battery_capacity = external_exports.number().or(external_exports.string().endsWith("mAh")).transform((v) => {
|
|
4510
|
+
if (typeof v === "string") {
|
|
4511
|
+
const valString = v.replace("mAh", "");
|
|
4512
|
+
const num = Number.parseFloat(valString);
|
|
4513
|
+
if (Number.isNaN(num)) {
|
|
4514
|
+
throw new Error("Invalid capacity");
|
|
4501
4515
|
}
|
|
4502
|
-
return
|
|
4503
|
-
}
|
|
4516
|
+
return num;
|
|
4517
|
+
}
|
|
4518
|
+
return v;
|
|
4519
|
+
}).describe("Battery capacity in mAh");
|
|
4520
|
+
var expectTypesMatch = (shouldBe) => {
|
|
4504
4521
|
};
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
points: parsePoints2(pointsStr),
|
|
4511
|
-
color,
|
|
4512
|
-
lineWidth: Number(lineWidth),
|
|
4513
|
-
id
|
|
4514
|
-
};
|
|
4522
|
+
expectTypesMatch("extra props b");
|
|
4523
|
+
expectTypesMatch("missing props b");
|
|
4524
|
+
expectTypesMatch(true);
|
|
4525
|
+
expectTypesMatch("mismatched prop types: a");
|
|
4526
|
+
var expectStringUnionsMatch = (shouldBe) => {
|
|
4515
4527
|
};
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4528
|
+
expectStringUnionsMatch(true);
|
|
4529
|
+
expectStringUnionsMatch(
|
|
4530
|
+
'T1 has extra: "c", T2 has extra: "d"'
|
|
4531
|
+
);
|
|
4532
|
+
expectStringUnionsMatch('T1 has extra: "c"');
|
|
4533
|
+
expectStringUnionsMatch('T2 has extra: "c"');
|
|
4534
|
+
expectStringUnionsMatch(
|
|
4535
|
+
'T1 has extra: "d", T2 has extra: "c"'
|
|
4536
|
+
);
|
|
4537
|
+
expectStringUnionsMatch(true);
|
|
4538
|
+
var point = external_exports.object({
|
|
4539
|
+
x: distance,
|
|
4540
|
+
y: distance
|
|
4524
4541
|
});
|
|
4525
|
-
var
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
lineWidth: Number(lineWidth),
|
|
4533
|
-
lineColor,
|
|
4534
|
-
id
|
|
4535
|
-
};
|
|
4536
|
-
};
|
|
4537
|
-
var PolygonShapeSchema = external_exports.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
|
|
4538
|
-
var PathShapeOutputSchema = external_exports.object({
|
|
4539
|
-
type: external_exports.literal("PATH"),
|
|
4540
|
-
pathData: external_exports.string(),
|
|
4541
|
-
fillColor: external_exports.string(),
|
|
4542
|
-
strokeWidth: external_exports.number(),
|
|
4543
|
-
strokeColor: external_exports.string(),
|
|
4544
|
-
id: external_exports.string()
|
|
4542
|
+
var position = point;
|
|
4543
|
+
expectTypesMatch(true);
|
|
4544
|
+
expectTypesMatch(true);
|
|
4545
|
+
var point3 = external_exports.object({
|
|
4546
|
+
x: distance,
|
|
4547
|
+
y: distance,
|
|
4548
|
+
z: distance
|
|
4545
4549
|
});
|
|
4546
|
-
var
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
fillColor,
|
|
4552
|
-
strokeWidth: mil10ToMm(Number(strokeWidth)),
|
|
4553
|
-
strokeColor,
|
|
4554
|
-
id
|
|
4555
|
-
};
|
|
4556
|
-
};
|
|
4557
|
-
var PathShapeSchema = external_exports.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
|
|
4558
|
-
var TextShapeOutputSchema = external_exports.object({
|
|
4559
|
-
type: external_exports.literal("TEXT"),
|
|
4560
|
-
alignment: external_exports.enum(["L", "C", "R"]),
|
|
4561
|
-
x: external_exports.number(),
|
|
4562
|
-
y: external_exports.number(),
|
|
4563
|
-
rotation: external_exports.number(),
|
|
4564
|
-
fontColor: external_exports.string(),
|
|
4565
|
-
backgroundColor: external_exports.string().optional(),
|
|
4566
|
-
fontSize: external_exports.string(),
|
|
4567
|
-
fontWeight: external_exports.string().optional().default("normal"),
|
|
4568
|
-
fontStyle: external_exports.enum(["normal", "italic"]).optional().default("normal"),
|
|
4569
|
-
fontDecoration: external_exports.string().optional().default(""),
|
|
4570
|
-
content: external_exports.string(),
|
|
4571
|
-
textType: external_exports.string(),
|
|
4572
|
-
visibility: external_exports.enum(["0", "1"]),
|
|
4573
|
-
mirror: external_exports.string(),
|
|
4574
|
-
id: external_exports.string()
|
|
4550
|
+
var position3 = point3;
|
|
4551
|
+
expectTypesMatch(true);
|
|
4552
|
+
var size = external_exports.object({
|
|
4553
|
+
width: external_exports.number(),
|
|
4554
|
+
height: external_exports.number()
|
|
4575
4555
|
});
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
fontColor,
|
|
4584
|
-
backgroundColor,
|
|
4585
|
-
fontSize,
|
|
4586
|
-
fontWeight,
|
|
4587
|
-
fontStyle,
|
|
4588
|
-
fontDecoration,
|
|
4589
|
-
content,
|
|
4590
|
-
textType,
|
|
4591
|
-
visibility,
|
|
4592
|
-
mirror,
|
|
4593
|
-
id
|
|
4594
|
-
] = str.split("~");
|
|
4595
|
-
return {
|
|
4596
|
-
type: "TEXT",
|
|
4597
|
-
alignment,
|
|
4598
|
-
x: Number(x),
|
|
4599
|
-
y: Number(y),
|
|
4600
|
-
rotation: Number(rotation2),
|
|
4601
|
-
fontColor,
|
|
4602
|
-
backgroundColor: backgroundColor || void 0,
|
|
4603
|
-
fontSize,
|
|
4604
|
-
fontWeight: fontWeight || "normal",
|
|
4605
|
-
fontStyle: fontStyle || "normal",
|
|
4606
|
-
fontDecoration: fontDecoration || "",
|
|
4607
|
-
content,
|
|
4608
|
-
textType,
|
|
4609
|
-
visibility,
|
|
4610
|
-
mirror,
|
|
4611
|
-
id
|
|
4612
|
-
};
|
|
4556
|
+
expectTypesMatch(true);
|
|
4557
|
+
var randomId = (length4) => {
|
|
4558
|
+
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
4559
|
+
return Array.from(
|
|
4560
|
+
{ length: length4 },
|
|
4561
|
+
() => chars[Math.floor(Math.random() * chars.length)]
|
|
4562
|
+
).join("");
|
|
4613
4563
|
};
|
|
4614
|
-
var
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4564
|
+
var getZodPrefixedIdWithDefault = (prefix) => {
|
|
4565
|
+
return external_exports.string().optional().default(() => `${prefix}_${randomId(10)}`);
|
|
4566
|
+
};
|
|
4567
|
+
var ninePointAnchor = external_exports.enum([
|
|
4568
|
+
"top_left",
|
|
4569
|
+
"top_center",
|
|
4570
|
+
"top_right",
|
|
4571
|
+
"center_left",
|
|
4572
|
+
"center",
|
|
4573
|
+
"center_right",
|
|
4574
|
+
"bottom_left",
|
|
4575
|
+
"bottom_center",
|
|
4576
|
+
"bottom_right"
|
|
4577
|
+
]);
|
|
4578
|
+
expectTypesMatch(true);
|
|
4579
|
+
var pcbRenderLayer = external_exports.enum([
|
|
4580
|
+
"top_silkscreen",
|
|
4581
|
+
"bottom_silkscreen",
|
|
4582
|
+
"top_copper",
|
|
4583
|
+
"bottom_copper",
|
|
4584
|
+
"top_soldermask",
|
|
4585
|
+
"bottom_soldermask",
|
|
4586
|
+
"top_fabrication_note",
|
|
4587
|
+
"bottom_fabrication_note",
|
|
4588
|
+
"top_user_note",
|
|
4589
|
+
"bottom_user_note",
|
|
4590
|
+
"top_courtyard",
|
|
4591
|
+
"bottom_courtyard",
|
|
4592
|
+
"inner1_copper",
|
|
4593
|
+
"inner2_copper",
|
|
4594
|
+
"inner3_copper",
|
|
4595
|
+
"inner4_copper",
|
|
4596
|
+
"inner5_copper",
|
|
4597
|
+
"inner6_copper",
|
|
4598
|
+
"edge_cuts",
|
|
4599
|
+
"drill"
|
|
4600
|
+
]);
|
|
4601
|
+
expectTypesMatch(true);
|
|
4602
|
+
var asset = external_exports.object({
|
|
4603
|
+
project_relative_path: external_exports.string(),
|
|
4604
|
+
url: external_exports.string(),
|
|
4605
|
+
mimetype: external_exports.string()
|
|
4649
4606
|
});
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
step: external_exports.number().optional(),
|
|
4654
|
-
min: external_exports.number().optional(),
|
|
4655
|
-
price: external_exports.number().optional(),
|
|
4656
|
-
stock: external_exports.number().optional(),
|
|
4657
|
-
url: external_exports.string().url().optional()
|
|
4607
|
+
expectTypesMatch(true);
|
|
4608
|
+
var kicadAt = point.extend({
|
|
4609
|
+
rotation: rotation.optional()
|
|
4658
4610
|
});
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
avatar: external_exports.string()
|
|
4611
|
+
expectTypesMatch(true);
|
|
4612
|
+
var kicadFont = external_exports.object({
|
|
4613
|
+
size: point.optional(),
|
|
4614
|
+
thickness: distance.optional()
|
|
4664
4615
|
});
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
c_para: external_exports.record(external_exports.string(), external_exports.string().nullable()),
|
|
4669
|
-
x: external_exports.number(),
|
|
4670
|
-
y: external_exports.number(),
|
|
4671
|
-
puuid: external_exports.string().optional(),
|
|
4672
|
-
uuid: external_exports.string(),
|
|
4673
|
-
utime: external_exports.preprocess((val) => {
|
|
4674
|
-
if (val === "") return 0;
|
|
4675
|
-
if (typeof val === "string") return Number(val);
|
|
4676
|
-
return val;
|
|
4677
|
-
}, external_exports.number()),
|
|
4678
|
-
importFlag: external_exports.number().optional(),
|
|
4679
|
-
c_spiceCmd: external_exports.any().optional(),
|
|
4680
|
-
hasIdFlag: external_exports.boolean()
|
|
4616
|
+
expectTypesMatch(true);
|
|
4617
|
+
var kicadEffects = external_exports.object({
|
|
4618
|
+
font: kicadFont.optional()
|
|
4681
4619
|
});
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4620
|
+
expectTypesMatch(true);
|
|
4621
|
+
var kicadProperty = external_exports.object({
|
|
4622
|
+
value: external_exports.string(),
|
|
4623
|
+
at: kicadAt.optional(),
|
|
4624
|
+
layer: external_exports.string().optional(),
|
|
4625
|
+
uuid: external_exports.string().optional(),
|
|
4626
|
+
hide: external_exports.boolean().optional(),
|
|
4627
|
+
effects: kicadEffects.optional()
|
|
4687
4628
|
});
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
transparency: external_exports.boolean()
|
|
4629
|
+
expectTypesMatch(true);
|
|
4630
|
+
var kicadFootprintProperties = external_exports.object({
|
|
4631
|
+
Reference: kicadProperty.optional(),
|
|
4632
|
+
Value: kicadProperty.optional(),
|
|
4633
|
+
Datasheet: kicadProperty.optional(),
|
|
4634
|
+
Description: kicadProperty.optional()
|
|
4695
4635
|
});
|
|
4696
|
-
|
|
4636
|
+
expectTypesMatch(
|
|
4637
|
+
true
|
|
4638
|
+
);
|
|
4639
|
+
var kicadFootprintAttributes = external_exports.object({
|
|
4640
|
+
through_hole: external_exports.boolean().optional(),
|
|
4641
|
+
smd: external_exports.boolean().optional(),
|
|
4642
|
+
exclude_from_pos_files: external_exports.boolean().optional(),
|
|
4643
|
+
exclude_from_bom: external_exports.boolean().optional()
|
|
4644
|
+
});
|
|
4645
|
+
expectTypesMatch(
|
|
4646
|
+
true
|
|
4647
|
+
);
|
|
4648
|
+
var kicadFootprintPad = external_exports.object({
|
|
4697
4649
|
name: external_exports.string(),
|
|
4698
|
-
|
|
4699
|
-
|
|
4650
|
+
type: external_exports.string(),
|
|
4651
|
+
shape: external_exports.string().optional(),
|
|
4652
|
+
at: kicadAt.optional(),
|
|
4653
|
+
size: point.optional(),
|
|
4654
|
+
drill: distance.optional(),
|
|
4655
|
+
layers: external_exports.array(external_exports.string()).optional(),
|
|
4656
|
+
removeUnusedLayers: external_exports.boolean().optional(),
|
|
4657
|
+
uuid: external_exports.string().optional()
|
|
4700
4658
|
});
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4659
|
+
expectTypesMatch(true);
|
|
4660
|
+
var kicadFootprintModel = external_exports.object({
|
|
4661
|
+
path: external_exports.string(),
|
|
4662
|
+
offset: point3.optional(),
|
|
4663
|
+
scale: point3.optional(),
|
|
4664
|
+
rotate: point3.optional()
|
|
4707
4665
|
});
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
return LayerItemSchema.parse({
|
|
4721
|
-
name,
|
|
4722
|
-
color,
|
|
4723
|
-
visible: visible === "true",
|
|
4724
|
-
active: active === "true",
|
|
4725
|
-
config: config === "true",
|
|
4726
|
-
transparency: transparency === "true"
|
|
4727
|
-
});
|
|
4728
|
-
})
|
|
4729
|
-
),
|
|
4730
|
-
objects: external_exports.array(external_exports.string()).transform(
|
|
4731
|
-
(objects) => objects.map((obj) => {
|
|
4732
|
-
const [name, visible, locked] = obj.split("~");
|
|
4733
|
-
return ObjectItemSchema.parse({
|
|
4734
|
-
name,
|
|
4735
|
-
visible: visible === "true",
|
|
4736
|
-
locked: locked === "true"
|
|
4737
|
-
});
|
|
4738
|
-
})
|
|
4739
|
-
),
|
|
4740
|
-
BBox: BBoxSchema,
|
|
4741
|
-
netColors: external_exports.array(external_exports.unknown()).optional()
|
|
4666
|
+
expectTypesMatch(true);
|
|
4667
|
+
var kicadFootprintMetadata = external_exports.object({
|
|
4668
|
+
footprintName: external_exports.string().optional(),
|
|
4669
|
+
version: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
4670
|
+
generator: external_exports.string().optional(),
|
|
4671
|
+
generatorVersion: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
4672
|
+
layer: external_exports.string().optional(),
|
|
4673
|
+
properties: kicadFootprintProperties.optional(),
|
|
4674
|
+
attributes: kicadFootprintAttributes.optional(),
|
|
4675
|
+
pads: external_exports.array(kicadFootprintPad).optional(),
|
|
4676
|
+
embeddedFonts: external_exports.boolean().optional(),
|
|
4677
|
+
model: kicadFootprintModel.optional()
|
|
4742
4678
|
});
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
docType: external_exports.number(),
|
|
4747
|
-
updateTime: external_exports.number(),
|
|
4748
|
-
owner: OwnerSchema,
|
|
4749
|
-
datastrid: external_exports.string(),
|
|
4750
|
-
writable: external_exports.boolean(),
|
|
4751
|
-
dataStr: PackageDetailDataStrSchema
|
|
4752
|
-
});
|
|
4753
|
-
var ModelBoundsSchema = external_exports.object({
|
|
4754
|
-
min: external_exports.object({
|
|
4755
|
-
x: external_exports.number(),
|
|
4756
|
-
y: external_exports.number(),
|
|
4757
|
-
z: external_exports.number()
|
|
4758
|
-
}),
|
|
4759
|
-
max: external_exports.object({
|
|
4760
|
-
x: external_exports.number(),
|
|
4761
|
-
y: external_exports.number(),
|
|
4762
|
-
z: external_exports.number()
|
|
4763
|
-
})
|
|
4764
|
-
});
|
|
4765
|
-
var EasyEdaJsonSchema = external_exports.object({
|
|
4766
|
-
uuid: external_exports.string(),
|
|
4767
|
-
title: external_exports.string(),
|
|
4768
|
-
description: external_exports.string(),
|
|
4769
|
-
docType: external_exports.number(),
|
|
4770
|
-
type: external_exports.number(),
|
|
4771
|
-
szlcsc: SzlcscSchema,
|
|
4772
|
-
lcsc: LcscSchema,
|
|
4773
|
-
owner: OwnerSchema,
|
|
4774
|
-
tags: external_exports.array(external_exports.string()),
|
|
4775
|
-
updateTime: external_exports.number(),
|
|
4776
|
-
updated_at: external_exports.string(),
|
|
4777
|
-
dataStr: DataStrSchema,
|
|
4778
|
-
verify: external_exports.boolean(),
|
|
4779
|
-
SMT: external_exports.boolean().optional(),
|
|
4780
|
-
datastrid: external_exports.string(),
|
|
4781
|
-
jlcOnSale: external_exports.number().optional(),
|
|
4782
|
-
writable: external_exports.boolean(),
|
|
4783
|
-
isFavorite: external_exports.boolean(),
|
|
4784
|
-
packageDetail: PackageDetailSchema,
|
|
4785
|
-
_objMetadata: external_exports.object({
|
|
4786
|
-
bounds: ModelBoundsSchema
|
|
4787
|
-
}).optional()
|
|
4788
|
-
});
|
|
4789
|
-
|
|
4790
|
-
// node_modules/circuit-json/dist/index.mjs
|
|
4791
|
-
var dist_exports = {};
|
|
4792
|
-
__export(dist_exports, {
|
|
4793
|
-
all_layers: () => all_layers,
|
|
4794
|
-
any_circuit_element: () => any_circuit_element,
|
|
4795
|
-
any_soup_element: () => any_soup_element,
|
|
4796
|
-
any_source_component: () => any_source_component,
|
|
4797
|
-
asset: () => asset,
|
|
4798
|
-
base_circuit_json_error: () => base_circuit_json_error,
|
|
4799
|
-
battery_capacity: () => battery_capacity,
|
|
4800
|
-
brep_shape: () => brep_shape,
|
|
4801
|
-
cadModelDefaultDirectionMap: () => cadModelDefaultDirectionMap,
|
|
4802
|
-
cad_component: () => cad_component,
|
|
4803
|
-
cad_model_axis_directions: () => cad_model_axis_directions,
|
|
4804
|
-
cad_model_formats: () => cad_model_formats,
|
|
4805
|
-
capacitance: () => capacitance,
|
|
4806
|
-
circuit_json_footprint_load_error: () => circuit_json_footprint_load_error,
|
|
4807
|
-
current: () => current,
|
|
4808
|
-
distance: () => distance,
|
|
4809
|
-
duration_ms: () => duration_ms,
|
|
4810
|
-
experiment_type: () => experiment_type,
|
|
4811
|
-
external_footprint_load_error: () => external_footprint_load_error,
|
|
4812
|
-
frequency: () => frequency,
|
|
4813
|
-
getZodPrefixedIdWithDefault: () => getZodPrefixedIdWithDefault,
|
|
4814
|
-
inductance: () => inductance,
|
|
4815
|
-
kicadAt: () => kicadAt,
|
|
4816
|
-
kicadEffects: () => kicadEffects,
|
|
4817
|
-
kicadFont: () => kicadFont,
|
|
4818
|
-
kicadFootprintAttributes: () => kicadFootprintAttributes,
|
|
4819
|
-
kicadFootprintMetadata: () => kicadFootprintMetadata,
|
|
4820
|
-
kicadFootprintModel: () => kicadFootprintModel,
|
|
4821
|
-
kicadFootprintPad: () => kicadFootprintPad,
|
|
4822
|
-
kicadFootprintProperties: () => kicadFootprintProperties,
|
|
4823
|
-
kicadProperty: () => kicadProperty,
|
|
4824
|
-
kicadSymbolEffects: () => kicadSymbolEffects,
|
|
4825
|
-
kicadSymbolMetadata: () => kicadSymbolMetadata,
|
|
4826
|
-
kicadSymbolPinNames: () => kicadSymbolPinNames,
|
|
4827
|
-
kicadSymbolPinNumbers: () => kicadSymbolPinNumbers,
|
|
4828
|
-
kicadSymbolProperties: () => kicadSymbolProperties,
|
|
4829
|
-
kicadSymbolProperty: () => kicadSymbolProperty,
|
|
4830
|
-
layer_ref: () => layer_ref,
|
|
4831
|
-
layer_string: () => layer_string,
|
|
4832
|
-
length: () => length,
|
|
4833
|
-
ms: () => ms,
|
|
4834
|
-
ninePointAnchor: () => ninePointAnchor,
|
|
4835
|
-
pcbRenderLayer: () => pcbRenderLayer,
|
|
4836
|
-
pcb_autorouting_error: () => pcb_autorouting_error,
|
|
4837
|
-
pcb_board: () => pcb_board,
|
|
4838
|
-
pcb_breakout_point: () => pcb_breakout_point,
|
|
4839
|
-
pcb_component: () => pcb_component,
|
|
4840
|
-
pcb_component_invalid_layer_error: () => pcb_component_invalid_layer_error,
|
|
4841
|
-
pcb_component_not_on_board_edge_error: () => pcb_component_not_on_board_edge_error,
|
|
4842
|
-
pcb_component_outside_board_error: () => pcb_component_outside_board_error,
|
|
4843
|
-
pcb_connector_not_in_accessible_orientation_warning: () => pcb_connector_not_in_accessible_orientation_warning,
|
|
4844
|
-
pcb_copper_pour: () => pcb_copper_pour,
|
|
4845
|
-
pcb_copper_pour_brep: () => pcb_copper_pour_brep,
|
|
4846
|
-
pcb_copper_pour_polygon: () => pcb_copper_pour_polygon,
|
|
4847
|
-
pcb_copper_pour_rect: () => pcb_copper_pour_rect,
|
|
4848
|
-
pcb_copper_text: () => pcb_copper_text,
|
|
4849
|
-
pcb_courtyard_circle: () => pcb_courtyard_circle,
|
|
4850
|
-
pcb_courtyard_outline: () => pcb_courtyard_outline,
|
|
4851
|
-
pcb_courtyard_overlap_error: () => pcb_courtyard_overlap_error,
|
|
4852
|
-
pcb_courtyard_polygon: () => pcb_courtyard_polygon,
|
|
4853
|
-
pcb_courtyard_rect: () => pcb_courtyard_rect,
|
|
4854
|
-
pcb_cutout: () => pcb_cutout,
|
|
4855
|
-
pcb_cutout_circle: () => pcb_cutout_circle,
|
|
4856
|
-
pcb_cutout_path: () => pcb_cutout_path,
|
|
4857
|
-
pcb_cutout_polygon: () => pcb_cutout_polygon,
|
|
4858
|
-
pcb_cutout_rect: () => pcb_cutout_rect,
|
|
4859
|
-
pcb_fabrication_note_dimension: () => pcb_fabrication_note_dimension,
|
|
4860
|
-
pcb_fabrication_note_path: () => pcb_fabrication_note_path,
|
|
4861
|
-
pcb_fabrication_note_rect: () => pcb_fabrication_note_rect,
|
|
4862
|
-
pcb_fabrication_note_text: () => pcb_fabrication_note_text,
|
|
4863
|
-
pcb_footprint_overlap_error: () => pcb_footprint_overlap_error,
|
|
4864
|
-
pcb_ground_plane: () => pcb_ground_plane,
|
|
4865
|
-
pcb_ground_plane_region: () => pcb_ground_plane_region,
|
|
4866
|
-
pcb_group: () => pcb_group,
|
|
4867
|
-
pcb_hole: () => pcb_hole,
|
|
4868
|
-
pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
|
|
4869
|
-
pcb_hole_circle_shape: () => pcb_hole_circle_shape,
|
|
4870
|
-
pcb_hole_oval_shape: () => pcb_hole_oval_shape,
|
|
4871
|
-
pcb_hole_pill_shape: () => pcb_hole_pill_shape,
|
|
4872
|
-
pcb_hole_rect_shape: () => pcb_hole_rect_shape,
|
|
4873
|
-
pcb_hole_rotated_pill_shape: () => pcb_hole_rotated_pill_shape,
|
|
4874
|
-
pcb_keepout: () => pcb_keepout,
|
|
4875
|
-
pcb_manual_edit_conflict_warning: () => pcb_manual_edit_conflict_warning,
|
|
4876
|
-
pcb_missing_footprint_error: () => pcb_missing_footprint_error,
|
|
4877
|
-
pcb_net: () => pcb_net,
|
|
4878
|
-
pcb_note_dimension: () => pcb_note_dimension,
|
|
4879
|
-
pcb_note_line: () => pcb_note_line,
|
|
4880
|
-
pcb_note_path: () => pcb_note_path,
|
|
4881
|
-
pcb_note_rect: () => pcb_note_rect,
|
|
4882
|
-
pcb_note_text: () => pcb_note_text,
|
|
4883
|
-
pcb_panel: () => pcb_panel,
|
|
4884
|
-
pcb_panelization_placement_error: () => pcb_panelization_placement_error,
|
|
4885
|
-
pcb_placement_error: () => pcb_placement_error,
|
|
4886
|
-
pcb_plated_hole: () => pcb_plated_hole,
|
|
4887
|
-
pcb_port: () => pcb_port,
|
|
4888
|
-
pcb_port_not_connected_error: () => pcb_port_not_connected_error,
|
|
4889
|
-
pcb_port_not_matched_error: () => pcb_port_not_matched_error,
|
|
4890
|
-
pcb_route_hint: () => pcb_route_hint,
|
|
4891
|
-
pcb_route_hints: () => pcb_route_hints,
|
|
4892
|
-
pcb_silkscreen_circle: () => pcb_silkscreen_circle,
|
|
4893
|
-
pcb_silkscreen_line: () => pcb_silkscreen_line,
|
|
4894
|
-
pcb_silkscreen_oval: () => pcb_silkscreen_oval,
|
|
4895
|
-
pcb_silkscreen_path: () => pcb_silkscreen_path,
|
|
4896
|
-
pcb_silkscreen_pill: () => pcb_silkscreen_pill,
|
|
4897
|
-
pcb_silkscreen_rect: () => pcb_silkscreen_rect,
|
|
4898
|
-
pcb_silkscreen_text: () => pcb_silkscreen_text,
|
|
4899
|
-
pcb_smtpad: () => pcb_smtpad,
|
|
4900
|
-
pcb_smtpad_pill: () => pcb_smtpad_pill,
|
|
4901
|
-
pcb_solder_paste: () => pcb_solder_paste,
|
|
4902
|
-
pcb_text: () => pcb_text,
|
|
4903
|
-
pcb_thermal_spoke: () => pcb_thermal_spoke,
|
|
4904
|
-
pcb_trace: () => pcb_trace,
|
|
4905
|
-
pcb_trace_error: () => pcb_trace_error,
|
|
4906
|
-
pcb_trace_hint: () => pcb_trace_hint,
|
|
4907
|
-
pcb_trace_missing_error: () => pcb_trace_missing_error,
|
|
4908
|
-
pcb_trace_route_point: () => pcb_trace_route_point,
|
|
4909
|
-
pcb_trace_route_point_via: () => pcb_trace_route_point_via,
|
|
4910
|
-
pcb_trace_route_point_wire: () => pcb_trace_route_point_wire,
|
|
4911
|
-
pcb_via: () => pcb_via,
|
|
4912
|
-
pcb_via_clearance_error: () => pcb_via_clearance_error,
|
|
4913
|
-
point: () => point,
|
|
4914
|
-
point3: () => point3,
|
|
4915
|
-
point_with_bulge: () => point_with_bulge,
|
|
4916
|
-
port_arrangement: () => port_arrangement,
|
|
4917
|
-
position: () => position,
|
|
4918
|
-
position3: () => position3,
|
|
4919
|
-
resistance: () => resistance,
|
|
4920
|
-
ring: () => ring,
|
|
4921
|
-
rotation: () => rotation,
|
|
4922
|
-
route_hint_point: () => route_hint_point,
|
|
4923
|
-
schematic_arc: () => schematic_arc,
|
|
4924
|
-
schematic_box: () => schematic_box,
|
|
4925
|
-
schematic_circle: () => schematic_circle,
|
|
4926
|
-
schematic_component: () => schematic_component,
|
|
4927
|
-
schematic_component_port_arrangement_by_sides: () => schematic_component_port_arrangement_by_sides,
|
|
4928
|
-
schematic_component_port_arrangement_by_size: () => schematic_component_port_arrangement_by_size,
|
|
4929
|
-
schematic_debug_line: () => schematic_debug_line,
|
|
4930
|
-
schematic_debug_object: () => schematic_debug_object,
|
|
4931
|
-
schematic_debug_object_base: () => schematic_debug_object_base,
|
|
4932
|
-
schematic_debug_point: () => schematic_debug_point,
|
|
4933
|
-
schematic_debug_rect: () => schematic_debug_rect,
|
|
4934
|
-
schematic_error: () => schematic_error,
|
|
4935
|
-
schematic_group: () => schematic_group,
|
|
4936
|
-
schematic_layout_error: () => schematic_layout_error,
|
|
4937
|
-
schematic_line: () => schematic_line,
|
|
4938
|
-
schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
|
|
4939
|
-
schematic_net_label: () => schematic_net_label,
|
|
4940
|
-
schematic_path: () => schematic_path,
|
|
4941
|
-
schematic_pin_styles: () => schematic_pin_styles,
|
|
4942
|
-
schematic_port: () => schematic_port,
|
|
4943
|
-
schematic_rect: () => schematic_rect,
|
|
4944
|
-
schematic_sheet: () => schematic_sheet,
|
|
4945
|
-
schematic_symbol: () => schematic_symbol,
|
|
4946
|
-
schematic_table: () => schematic_table,
|
|
4947
|
-
schematic_table_cell: () => schematic_table_cell,
|
|
4948
|
-
schematic_text: () => schematic_text,
|
|
4949
|
-
schematic_trace: () => schematic_trace,
|
|
4950
|
-
schematic_voltage_probe: () => schematic_voltage_probe,
|
|
4951
|
-
simulation_ac_current_source: () => simulation_ac_current_source,
|
|
4952
|
-
simulation_ac_voltage_source: () => simulation_ac_voltage_source,
|
|
4953
|
-
simulation_current_source: () => simulation_current_source,
|
|
4954
|
-
simulation_dc_current_source: () => simulation_dc_current_source,
|
|
4955
|
-
simulation_dc_voltage_source: () => simulation_dc_voltage_source,
|
|
4956
|
-
simulation_experiment: () => simulation_experiment,
|
|
4957
|
-
simulation_op_amp: () => simulation_op_amp,
|
|
4958
|
-
simulation_switch: () => simulation_switch,
|
|
4959
|
-
simulation_transient_voltage_graph: () => simulation_transient_voltage_graph,
|
|
4960
|
-
simulation_unknown_experiment_error: () => simulation_unknown_experiment_error,
|
|
4961
|
-
simulation_voltage_probe: () => simulation_voltage_probe,
|
|
4962
|
-
simulation_voltage_source: () => simulation_voltage_source,
|
|
4963
|
-
size: () => size,
|
|
4964
|
-
source_ambiguous_port_reference: () => source_ambiguous_port_reference,
|
|
4965
|
-
source_board: () => source_board,
|
|
4966
|
-
source_component_base: () => source_component_base,
|
|
4967
|
-
source_component_internal_connection: () => source_component_internal_connection,
|
|
4968
|
-
source_component_pins_underspecified_warning: () => source_component_pins_underspecified_warning,
|
|
4969
|
-
source_failed_to_create_component_error: () => source_failed_to_create_component_error,
|
|
4970
|
-
source_group: () => source_group,
|
|
4971
|
-
source_i2c_misconfigured_error: () => source_i2c_misconfigured_error,
|
|
4972
|
-
source_interconnect: () => source_interconnect,
|
|
4973
|
-
source_invalid_component_property_error: () => source_invalid_component_property_error,
|
|
4974
|
-
source_manually_placed_via: () => source_manually_placed_via,
|
|
4975
|
-
source_missing_property_error: () => source_missing_property_error,
|
|
4976
|
-
source_net: () => source_net,
|
|
4977
|
-
source_no_ground_pin_defined_warning: () => source_no_ground_pin_defined_warning,
|
|
4978
|
-
source_no_power_pin_defined_warning: () => source_no_power_pin_defined_warning,
|
|
4979
|
-
source_pcb_ground_plane: () => source_pcb_ground_plane,
|
|
4980
|
-
source_pin_attributes: () => source_pin_attributes,
|
|
4981
|
-
source_pin_missing_trace_warning: () => source_pin_missing_trace_warning,
|
|
4982
|
-
source_pin_must_be_connected_error: () => source_pin_must_be_connected_error,
|
|
4983
|
-
source_port: () => source_port,
|
|
4984
|
-
source_project_metadata: () => source_project_metadata,
|
|
4985
|
-
source_property_ignored_warning: () => source_property_ignored_warning,
|
|
4986
|
-
source_simple_battery: () => source_simple_battery,
|
|
4987
|
-
source_simple_capacitor: () => source_simple_capacitor,
|
|
4988
|
-
source_simple_chip: () => source_simple_chip,
|
|
4989
|
-
source_simple_connector: () => source_simple_connector,
|
|
4990
|
-
source_simple_crystal: () => source_simple_crystal,
|
|
4991
|
-
source_simple_current_source: () => source_simple_current_source,
|
|
4992
|
-
source_simple_diode: () => source_simple_diode,
|
|
4993
|
-
source_simple_fiducial: () => source_simple_fiducial,
|
|
4994
|
-
source_simple_ground: () => source_simple_ground,
|
|
4995
|
-
source_simple_inductor: () => source_simple_inductor,
|
|
4996
|
-
source_simple_led: () => source_simple_led,
|
|
4997
|
-
source_simple_mosfet: () => source_simple_mosfet,
|
|
4998
|
-
source_simple_op_amp: () => source_simple_op_amp,
|
|
4999
|
-
source_simple_pin_header: () => source_simple_pin_header,
|
|
5000
|
-
source_simple_pinout: () => source_simple_pinout,
|
|
5001
|
-
source_simple_potentiometer: () => source_simple_potentiometer,
|
|
5002
|
-
source_simple_power_source: () => source_simple_power_source,
|
|
5003
|
-
source_simple_push_button: () => source_simple_push_button,
|
|
5004
|
-
source_simple_resistor: () => source_simple_resistor,
|
|
5005
|
-
source_simple_resonator: () => source_simple_resonator,
|
|
5006
|
-
source_simple_switch: () => source_simple_switch,
|
|
5007
|
-
source_simple_test_point: () => source_simple_test_point,
|
|
5008
|
-
source_simple_transistor: () => source_simple_transistor,
|
|
5009
|
-
source_simple_voltage_probe: () => source_simple_voltage_probe,
|
|
5010
|
-
source_simple_voltage_source: () => source_simple_voltage_source,
|
|
5011
|
-
source_trace: () => source_trace,
|
|
5012
|
-
source_trace_not_connected_error: () => source_trace_not_connected_error,
|
|
5013
|
-
supplier_name: () => supplier_name,
|
|
5014
|
-
time: () => time,
|
|
5015
|
-
timestamp: () => timestamp,
|
|
5016
|
-
unknown_error_finding_part: () => unknown_error_finding_part,
|
|
5017
|
-
visible_layer: () => visible_layer,
|
|
5018
|
-
voltage: () => voltage,
|
|
5019
|
-
wave_shape: () => wave_shape
|
|
5020
|
-
});
|
|
5021
|
-
var unitMappings = {
|
|
5022
|
-
Hz: {
|
|
5023
|
-
baseUnit: "Hz",
|
|
5024
|
-
variants: {
|
|
5025
|
-
MHz: 1e6,
|
|
5026
|
-
kHz: 1e3,
|
|
5027
|
-
Hz: 1
|
|
5028
|
-
}
|
|
5029
|
-
},
|
|
5030
|
-
g: {
|
|
5031
|
-
baseUnit: "g",
|
|
5032
|
-
variants: {
|
|
5033
|
-
kg: 1e3,
|
|
5034
|
-
g: 1
|
|
5035
|
-
}
|
|
5036
|
-
},
|
|
5037
|
-
\u03A9: {
|
|
5038
|
-
baseUnit: "\u03A9",
|
|
5039
|
-
variants: {
|
|
5040
|
-
m\u03A9: 1e-3,
|
|
5041
|
-
\u03A9: 1,
|
|
5042
|
-
k\u03A9: 1e3,
|
|
5043
|
-
K\u03A9: 1e3,
|
|
5044
|
-
kohm: 1e3,
|
|
5045
|
-
M\u03A9: 1e6,
|
|
5046
|
-
G\u03A9: 1e9,
|
|
5047
|
-
T\u03A9: 1e12
|
|
5048
|
-
}
|
|
5049
|
-
},
|
|
5050
|
-
V: {
|
|
5051
|
-
baseUnit: "V",
|
|
5052
|
-
variants: {
|
|
5053
|
-
mV: 1e-3,
|
|
5054
|
-
V: 1,
|
|
5055
|
-
kV: 1e3,
|
|
5056
|
-
KV: 1e3,
|
|
5057
|
-
MV: 1e6,
|
|
5058
|
-
GV: 1e9,
|
|
5059
|
-
TV: 1e12
|
|
5060
|
-
}
|
|
5061
|
-
},
|
|
5062
|
-
A: {
|
|
5063
|
-
baseUnit: "A",
|
|
5064
|
-
variants: {
|
|
5065
|
-
\u00B5A: 1e-6,
|
|
5066
|
-
mA: 1e-3,
|
|
5067
|
-
ma: 1e-3,
|
|
5068
|
-
A: 1,
|
|
5069
|
-
kA: 1e3,
|
|
5070
|
-
MA: 1e6
|
|
5071
|
-
}
|
|
5072
|
-
},
|
|
5073
|
-
F: {
|
|
5074
|
-
baseUnit: "F",
|
|
5075
|
-
variants: {
|
|
5076
|
-
pF: 1e-12,
|
|
5077
|
-
nF: 1e-9,
|
|
5078
|
-
\u00B5F: 1e-6,
|
|
5079
|
-
uF: 1e-6,
|
|
5080
|
-
mF: 1e-3,
|
|
5081
|
-
F: 1
|
|
5082
|
-
}
|
|
5083
|
-
},
|
|
5084
|
-
ml: {
|
|
5085
|
-
baseUnit: "ml",
|
|
5086
|
-
variants: {
|
|
5087
|
-
ml: 1,
|
|
5088
|
-
mL: 1,
|
|
5089
|
-
l: 1e3,
|
|
5090
|
-
L: 1e3
|
|
5091
|
-
}
|
|
5092
|
-
},
|
|
5093
|
-
deg: {
|
|
5094
|
-
baseUnit: "deg",
|
|
5095
|
-
variants: {
|
|
5096
|
-
rad: 180 / Math.PI
|
|
5097
|
-
}
|
|
5098
|
-
},
|
|
5099
|
-
ms: {
|
|
5100
|
-
baseUnit: "ms",
|
|
5101
|
-
variants: {
|
|
5102
|
-
fs: 1e-12,
|
|
5103
|
-
ps: 1e-9,
|
|
5104
|
-
ns: 1e-6,
|
|
5105
|
-
us: 1e-3,
|
|
5106
|
-
\u00B5s: 1e-3,
|
|
5107
|
-
ms: 1,
|
|
5108
|
-
s: 1e3
|
|
5109
|
-
}
|
|
5110
|
-
},
|
|
5111
|
-
mm: {
|
|
5112
|
-
baseUnit: "mm",
|
|
5113
|
-
variants: {
|
|
5114
|
-
nm: 1e-6,
|
|
5115
|
-
\u00B5m: 1e-3,
|
|
5116
|
-
um: 1e-3,
|
|
5117
|
-
mm: 1,
|
|
5118
|
-
cm: 10,
|
|
5119
|
-
dm: 100,
|
|
5120
|
-
m: 1e3,
|
|
5121
|
-
km: 1e6,
|
|
5122
|
-
in: 25.4,
|
|
5123
|
-
ft: 304.8,
|
|
5124
|
-
IN: 25.4,
|
|
5125
|
-
FT: 304.8,
|
|
5126
|
-
yd: 914.4,
|
|
5127
|
-
mi: 1609344,
|
|
5128
|
-
mil: 0.0254
|
|
5129
|
-
}
|
|
5130
|
-
}
|
|
5131
|
-
};
|
|
5132
|
-
var unitMappingAndVariantSuffixes = /* @__PURE__ */ new Set();
|
|
5133
|
-
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
5134
|
-
unitMappingAndVariantSuffixes.add(baseUnit);
|
|
5135
|
-
for (const variant of Object.keys(info.variants)) {
|
|
5136
|
-
unitMappingAndVariantSuffixes.add(variant);
|
|
5137
|
-
}
|
|
5138
|
-
}
|
|
5139
|
-
function getBaseTscircuitUnit(unit) {
|
|
5140
|
-
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
5141
|
-
if (unit in info.variants) {
|
|
5142
|
-
return {
|
|
5143
|
-
baseUnit: info.baseUnit,
|
|
5144
|
-
conversionFactor: info.variants[unit]
|
|
5145
|
-
};
|
|
5146
|
-
}
|
|
5147
|
-
}
|
|
5148
|
-
return {
|
|
5149
|
-
baseUnit: unit,
|
|
5150
|
-
conversionFactor: 1
|
|
5151
|
-
};
|
|
5152
|
-
}
|
|
5153
|
-
var si_prefix_multiplier = {
|
|
5154
|
-
tera: 1e12,
|
|
5155
|
-
T: 1e12,
|
|
5156
|
-
giga: 1e9,
|
|
5157
|
-
G: 1e9,
|
|
5158
|
-
mega: 1e6,
|
|
5159
|
-
M: 1e6,
|
|
5160
|
-
kilo: 1e3,
|
|
5161
|
-
k: 1e3,
|
|
5162
|
-
deci: 0.1,
|
|
5163
|
-
d: 0.1,
|
|
5164
|
-
centi: 0.01,
|
|
5165
|
-
c: 0.01,
|
|
5166
|
-
milli: 1e-3,
|
|
5167
|
-
m: 1e-3,
|
|
5168
|
-
micro: 1e-6,
|
|
5169
|
-
u: 1e-6,
|
|
5170
|
-
\u00B5: 1e-6,
|
|
5171
|
-
nano: 1e-9,
|
|
5172
|
-
n: 1e-9,
|
|
5173
|
-
pico: 1e-12,
|
|
5174
|
-
p: 1e-12
|
|
5175
|
-
};
|
|
5176
|
-
function parseAndConvertSiUnit(v) {
|
|
5177
|
-
if (v === void 0 || v === null)
|
|
5178
|
-
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
5179
|
-
if (typeof v === "string" && v.match(/^-?[\d\.]+$/))
|
|
5180
|
-
return {
|
|
5181
|
-
value: Number.parseFloat(v),
|
|
5182
|
-
parsedUnit: null,
|
|
5183
|
-
unitOfValue: null
|
|
5184
|
-
};
|
|
5185
|
-
if (typeof v === "number")
|
|
5186
|
-
return { value: v, parsedUnit: null, unitOfValue: null };
|
|
5187
|
-
if (typeof v === "object" && "x" in v && "y" in v) {
|
|
5188
|
-
const { parsedUnit, unitOfValue } = parseAndConvertSiUnit(v.x);
|
|
5189
|
-
const xResult = parseAndConvertSiUnit(v.x);
|
|
5190
|
-
const yResult = parseAndConvertSiUnit(v.y);
|
|
5191
|
-
if (xResult.value === null || yResult.value === null) {
|
|
5192
|
-
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
5193
|
-
}
|
|
5194
|
-
return {
|
|
5195
|
-
parsedUnit,
|
|
5196
|
-
unitOfValue,
|
|
5197
|
-
value: {
|
|
5198
|
-
x: xResult.value,
|
|
5199
|
-
y: yResult.value
|
|
5200
|
-
}
|
|
5201
|
-
};
|
|
5202
|
-
}
|
|
5203
|
-
const reversed_input_string = v.toString().split("").reverse().join("");
|
|
5204
|
-
const unit_reversed = reversed_input_string.match(/[^\d\s]+/)?.[0];
|
|
5205
|
-
if (!unit_reversed) {
|
|
5206
|
-
throw new Error(`Could not determine unit: "${v}"`);
|
|
5207
|
-
}
|
|
5208
|
-
const unit = unit_reversed.split("").reverse().join("");
|
|
5209
|
-
const numberPart = v.slice(0, -unit.length);
|
|
5210
|
-
if (unit in si_prefix_multiplier && !unitMappingAndVariantSuffixes.has(unit)) {
|
|
5211
|
-
const siMultiplier = si_prefix_multiplier[unit];
|
|
5212
|
-
return {
|
|
5213
|
-
parsedUnit: null,
|
|
5214
|
-
unitOfValue: null,
|
|
5215
|
-
value: Number.parseFloat(numberPart) * siMultiplier
|
|
5216
|
-
};
|
|
5217
|
-
}
|
|
5218
|
-
const { baseUnit, conversionFactor } = getBaseTscircuitUnit(unit);
|
|
5219
|
-
return {
|
|
5220
|
-
parsedUnit: unit,
|
|
5221
|
-
unitOfValue: baseUnit,
|
|
5222
|
-
value: conversionFactor * Number.parseFloat(numberPart)
|
|
5223
|
-
};
|
|
5224
|
-
}
|
|
5225
|
-
var resistance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5226
|
-
var capacitance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value).transform((value) => {
|
|
5227
|
-
return Number.parseFloat(value.toPrecision(12));
|
|
5228
|
-
});
|
|
5229
|
-
var inductance = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5230
|
-
var voltage = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5231
|
-
var length = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5232
|
-
var frequency = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5233
|
-
var distance = length;
|
|
5234
|
-
var current = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5235
|
-
var duration_ms = external_exports.string().or(external_exports.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
5236
|
-
var time = duration_ms;
|
|
5237
|
-
var ms = duration_ms;
|
|
5238
|
-
var timestamp = external_exports.string().datetime();
|
|
5239
|
-
var rotation = external_exports.string().or(external_exports.number()).transform((arg) => {
|
|
5240
|
-
if (typeof arg === "number") return arg;
|
|
5241
|
-
if (arg.endsWith("deg")) {
|
|
5242
|
-
return Number.parseFloat(arg.split("deg")[0]);
|
|
5243
|
-
}
|
|
5244
|
-
if (arg.endsWith("rad")) {
|
|
5245
|
-
return Number.parseFloat(arg.split("rad")[0]) * 180 / Math.PI;
|
|
5246
|
-
}
|
|
5247
|
-
return Number.parseFloat(arg);
|
|
5248
|
-
});
|
|
5249
|
-
var battery_capacity = external_exports.number().or(external_exports.string().endsWith("mAh")).transform((v) => {
|
|
5250
|
-
if (typeof v === "string") {
|
|
5251
|
-
const valString = v.replace("mAh", "");
|
|
5252
|
-
const num = Number.parseFloat(valString);
|
|
5253
|
-
if (Number.isNaN(num)) {
|
|
5254
|
-
throw new Error("Invalid capacity");
|
|
5255
|
-
}
|
|
5256
|
-
return num;
|
|
5257
|
-
}
|
|
5258
|
-
return v;
|
|
5259
|
-
}).describe("Battery capacity in mAh");
|
|
5260
|
-
var expectTypesMatch = (shouldBe) => {
|
|
5261
|
-
};
|
|
5262
|
-
expectTypesMatch("extra props b");
|
|
5263
|
-
expectTypesMatch("missing props b");
|
|
5264
|
-
expectTypesMatch(true);
|
|
5265
|
-
expectTypesMatch("mismatched prop types: a");
|
|
5266
|
-
var expectStringUnionsMatch = (shouldBe) => {
|
|
5267
|
-
};
|
|
5268
|
-
expectStringUnionsMatch(true);
|
|
5269
|
-
expectStringUnionsMatch(
|
|
5270
|
-
'T1 has extra: "c", T2 has extra: "d"'
|
|
5271
|
-
);
|
|
5272
|
-
expectStringUnionsMatch('T1 has extra: "c"');
|
|
5273
|
-
expectStringUnionsMatch('T2 has extra: "c"');
|
|
5274
|
-
expectStringUnionsMatch(
|
|
5275
|
-
'T1 has extra: "d", T2 has extra: "c"'
|
|
5276
|
-
);
|
|
5277
|
-
expectStringUnionsMatch(true);
|
|
5278
|
-
var point = external_exports.object({
|
|
5279
|
-
x: distance,
|
|
5280
|
-
y: distance
|
|
5281
|
-
});
|
|
5282
|
-
var position = point;
|
|
5283
|
-
expectTypesMatch(true);
|
|
5284
|
-
expectTypesMatch(true);
|
|
5285
|
-
var point3 = external_exports.object({
|
|
5286
|
-
x: distance,
|
|
5287
|
-
y: distance,
|
|
5288
|
-
z: distance
|
|
5289
|
-
});
|
|
5290
|
-
var position3 = point3;
|
|
5291
|
-
expectTypesMatch(true);
|
|
5292
|
-
var size = external_exports.object({
|
|
5293
|
-
width: external_exports.number(),
|
|
5294
|
-
height: external_exports.number()
|
|
5295
|
-
});
|
|
5296
|
-
expectTypesMatch(true);
|
|
5297
|
-
var randomId = (length4) => {
|
|
5298
|
-
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
5299
|
-
return Array.from(
|
|
5300
|
-
{ length: length4 },
|
|
5301
|
-
() => chars[Math.floor(Math.random() * chars.length)]
|
|
5302
|
-
).join("");
|
|
5303
|
-
};
|
|
5304
|
-
var getZodPrefixedIdWithDefault = (prefix) => {
|
|
5305
|
-
return external_exports.string().optional().default(() => `${prefix}_${randomId(10)}`);
|
|
5306
|
-
};
|
|
5307
|
-
var ninePointAnchor = external_exports.enum([
|
|
5308
|
-
"top_left",
|
|
5309
|
-
"top_center",
|
|
5310
|
-
"top_right",
|
|
5311
|
-
"center_left",
|
|
5312
|
-
"center",
|
|
5313
|
-
"center_right",
|
|
5314
|
-
"bottom_left",
|
|
5315
|
-
"bottom_center",
|
|
5316
|
-
"bottom_right"
|
|
5317
|
-
]);
|
|
5318
|
-
expectTypesMatch(true);
|
|
5319
|
-
var pcbRenderLayer = external_exports.enum([
|
|
5320
|
-
"top_silkscreen",
|
|
5321
|
-
"bottom_silkscreen",
|
|
5322
|
-
"top_copper",
|
|
5323
|
-
"bottom_copper",
|
|
5324
|
-
"top_soldermask",
|
|
5325
|
-
"bottom_soldermask",
|
|
5326
|
-
"top_fabrication_note",
|
|
5327
|
-
"bottom_fabrication_note",
|
|
5328
|
-
"top_user_note",
|
|
5329
|
-
"bottom_user_note",
|
|
5330
|
-
"top_courtyard",
|
|
5331
|
-
"bottom_courtyard",
|
|
5332
|
-
"inner1_copper",
|
|
5333
|
-
"inner2_copper",
|
|
5334
|
-
"inner3_copper",
|
|
5335
|
-
"inner4_copper",
|
|
5336
|
-
"inner5_copper",
|
|
5337
|
-
"inner6_copper",
|
|
5338
|
-
"edge_cuts",
|
|
5339
|
-
"drill"
|
|
5340
|
-
]);
|
|
5341
|
-
expectTypesMatch(true);
|
|
5342
|
-
var asset = external_exports.object({
|
|
5343
|
-
project_relative_path: external_exports.string(),
|
|
5344
|
-
url: external_exports.string(),
|
|
5345
|
-
mimetype: external_exports.string()
|
|
5346
|
-
});
|
|
5347
|
-
expectTypesMatch(true);
|
|
5348
|
-
var kicadAt = point.extend({
|
|
5349
|
-
rotation: rotation.optional()
|
|
5350
|
-
});
|
|
5351
|
-
expectTypesMatch(true);
|
|
5352
|
-
var kicadFont = external_exports.object({
|
|
5353
|
-
size: point.optional(),
|
|
5354
|
-
thickness: distance.optional()
|
|
5355
|
-
});
|
|
5356
|
-
expectTypesMatch(true);
|
|
5357
|
-
var kicadEffects = external_exports.object({
|
|
5358
|
-
font: kicadFont.optional()
|
|
5359
|
-
});
|
|
5360
|
-
expectTypesMatch(true);
|
|
5361
|
-
var kicadProperty = external_exports.object({
|
|
5362
|
-
value: external_exports.string(),
|
|
5363
|
-
at: kicadAt.optional(),
|
|
5364
|
-
layer: external_exports.string().optional(),
|
|
5365
|
-
uuid: external_exports.string().optional(),
|
|
5366
|
-
hide: external_exports.boolean().optional(),
|
|
5367
|
-
effects: kicadEffects.optional()
|
|
5368
|
-
});
|
|
5369
|
-
expectTypesMatch(true);
|
|
5370
|
-
var kicadFootprintProperties = external_exports.object({
|
|
5371
|
-
Reference: kicadProperty.optional(),
|
|
5372
|
-
Value: kicadProperty.optional(),
|
|
5373
|
-
Datasheet: kicadProperty.optional(),
|
|
5374
|
-
Description: kicadProperty.optional()
|
|
5375
|
-
});
|
|
5376
|
-
expectTypesMatch(
|
|
5377
|
-
true
|
|
5378
|
-
);
|
|
5379
|
-
var kicadFootprintAttributes = external_exports.object({
|
|
5380
|
-
through_hole: external_exports.boolean().optional(),
|
|
5381
|
-
smd: external_exports.boolean().optional(),
|
|
5382
|
-
exclude_from_pos_files: external_exports.boolean().optional(),
|
|
5383
|
-
exclude_from_bom: external_exports.boolean().optional()
|
|
5384
|
-
});
|
|
5385
|
-
expectTypesMatch(
|
|
5386
|
-
true
|
|
5387
|
-
);
|
|
5388
|
-
var kicadFootprintPad = external_exports.object({
|
|
5389
|
-
name: external_exports.string(),
|
|
5390
|
-
type: external_exports.string(),
|
|
5391
|
-
shape: external_exports.string().optional(),
|
|
5392
|
-
at: kicadAt.optional(),
|
|
5393
|
-
size: point.optional(),
|
|
5394
|
-
drill: distance.optional(),
|
|
5395
|
-
layers: external_exports.array(external_exports.string()).optional(),
|
|
5396
|
-
removeUnusedLayers: external_exports.boolean().optional(),
|
|
5397
|
-
uuid: external_exports.string().optional()
|
|
5398
|
-
});
|
|
5399
|
-
expectTypesMatch(true);
|
|
5400
|
-
var kicadFootprintModel = external_exports.object({
|
|
5401
|
-
path: external_exports.string(),
|
|
5402
|
-
offset: point3.optional(),
|
|
5403
|
-
scale: point3.optional(),
|
|
5404
|
-
rotate: point3.optional()
|
|
5405
|
-
});
|
|
5406
|
-
expectTypesMatch(true);
|
|
5407
|
-
var kicadFootprintMetadata = external_exports.object({
|
|
5408
|
-
footprintName: external_exports.string().optional(),
|
|
5409
|
-
version: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
5410
|
-
generator: external_exports.string().optional(),
|
|
5411
|
-
generatorVersion: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
5412
|
-
layer: external_exports.string().optional(),
|
|
5413
|
-
properties: kicadFootprintProperties.optional(),
|
|
5414
|
-
attributes: kicadFootprintAttributes.optional(),
|
|
5415
|
-
pads: external_exports.array(kicadFootprintPad).optional(),
|
|
5416
|
-
embeddedFonts: external_exports.boolean().optional(),
|
|
5417
|
-
model: kicadFootprintModel.optional()
|
|
5418
|
-
});
|
|
5419
|
-
expectTypesMatch(true);
|
|
5420
|
-
var kicadSymbolPinNumbers = external_exports.object({
|
|
5421
|
-
hide: external_exports.boolean().optional()
|
|
4679
|
+
expectTypesMatch(true);
|
|
4680
|
+
var kicadSymbolPinNumbers = external_exports.object({
|
|
4681
|
+
hide: external_exports.boolean().optional()
|
|
5422
4682
|
});
|
|
5423
4683
|
expectTypesMatch(true);
|
|
5424
4684
|
var kicadSymbolPinNames = external_exports.object({
|
|
@@ -9617,150 +8877,28 @@ var unitToMm = {
|
|
|
9617
8877
|
inch: 25.4,
|
|
9618
8878
|
mil: 0.0254,
|
|
9619
8879
|
mm: 1,
|
|
9620
|
-
m: 1e3,
|
|
9621
|
-
cm: 10,
|
|
9622
|
-
ft: 304.8,
|
|
9623
|
-
feet: 304.8
|
|
9624
|
-
};
|
|
9625
|
-
var mm = (n) => {
|
|
9626
|
-
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
9627
|
-
if (!unit)
|
|
9628
|
-
unit = "mm";
|
|
9629
|
-
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
9630
|
-
if (unit in unitToMm) {
|
|
9631
|
-
return val * unitToMm[unit];
|
|
9632
|
-
}
|
|
9633
|
-
throw new Error(`Unsupported unit: ${unit}`);
|
|
9634
|
-
};
|
|
9635
|
-
var mmStr = (n) => {
|
|
9636
|
-
return `${mm(n)}mm`;
|
|
9637
|
-
};
|
|
9638
|
-
|
|
9639
|
-
// lib/websafe/generate-footprint-tsx.ts
|
|
9640
|
-
var generateFootprintTsx = (circuitJson) => {
|
|
9641
|
-
const holes = su(circuitJson).pcb_hole.list();
|
|
9642
|
-
const platedHoles = su(circuitJson).pcb_plated_hole.list();
|
|
9643
|
-
const smtPads = su(circuitJson).pcb_smtpad.list();
|
|
9644
|
-
const vias = su(circuitJson).pcb_via.list();
|
|
9645
|
-
const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
|
|
9646
|
-
const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
|
|
9647
|
-
const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
|
|
9648
|
-
const elementStrings = [];
|
|
9649
|
-
for (const hole of holes) {
|
|
9650
|
-
if (hole.hole_shape === "circle") {
|
|
9651
|
-
elementStrings.push(
|
|
9652
|
-
`<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" diameter="${mmStr(hole.hole_diameter)}" />`
|
|
9653
|
-
);
|
|
9654
|
-
} else if (hole.hole_shape === "oval") {
|
|
9655
|
-
console.warn("Unhandled oval hole in conversion (needs implementation)");
|
|
9656
|
-
}
|
|
9657
|
-
}
|
|
9658
|
-
for (const platedHole of platedHoles) {
|
|
9659
|
-
if (platedHole.shape === "pill_hole_with_rect_pad") {
|
|
9660
|
-
elementStrings.push(
|
|
9661
|
-
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.rect_pad_width)}" outerHeight="${mmStr(platedHole.rect_pad_height)}" shape="pill" />`
|
|
9662
|
-
);
|
|
9663
|
-
} else if (platedHole.shape === "circle") {
|
|
9664
|
-
elementStrings.push(
|
|
9665
|
-
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" outerDiameter="${mmStr(platedHole.outer_diameter)}" holeDiameter="${mmStr(platedHole.hole_diameter)}" shape="circle" />`
|
|
9666
|
-
);
|
|
9667
|
-
} else if (platedHole.shape === "rotated_pill_hole_with_rect_pad") {
|
|
9668
|
-
const rotation2 = platedHole.hole_ccw_rotation || 0;
|
|
9669
|
-
elementStrings.push(
|
|
9670
|
-
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.rect_pad_width)}" outerHeight="${mmStr(platedHole.rect_pad_height)}" rectPad={true} pcbRotation="${rotation2}deg" shape="pill" />`
|
|
9671
|
-
);
|
|
9672
|
-
}
|
|
9673
|
-
}
|
|
9674
|
-
for (const smtPad of smtPads) {
|
|
9675
|
-
if (smtPad.shape === "circle") {
|
|
9676
|
-
elementStrings.push(
|
|
9677
|
-
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" radius="${mmStr(smtPad.radius)}" shape="circle" />`
|
|
9678
|
-
);
|
|
9679
|
-
} else if (smtPad.shape === "rect") {
|
|
9680
|
-
elementStrings.push(
|
|
9681
|
-
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" shape="rect" />`
|
|
9682
|
-
);
|
|
9683
|
-
} else if (smtPad.shape === "polygon") {
|
|
9684
|
-
const pointsStr = smtPad.points.map((p) => `{x: "${mmStr(p.x)}", y: "${mmStr(p.y)}"}`).join(", ");
|
|
9685
|
-
elementStrings.push(
|
|
9686
|
-
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} points={[${pointsStr}]} shape="polygon" />`
|
|
9687
|
-
);
|
|
9688
|
-
}
|
|
9689
|
-
}
|
|
9690
|
-
for (const via of vias) {
|
|
9691
|
-
elementStrings.push(
|
|
9692
|
-
`<via pcbX="${mmStr(via.x)}" pcbY="${mmStr(via.y)}" outerDiameter="${mmStr(via.outer_diameter)}" holeDiameter="${mmStr(via.hole_diameter)}" layers={${JSON.stringify(via.layers)}} />`
|
|
9693
|
-
);
|
|
9694
|
-
}
|
|
9695
|
-
for (const silkscreenPath of silkscreenPaths) {
|
|
9696
|
-
elementStrings.push(
|
|
9697
|
-
`<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
|
|
9698
|
-
);
|
|
9699
|
-
}
|
|
9700
|
-
for (const silkscreenText of silkscreenTexts) {
|
|
9701
|
-
elementStrings.push(
|
|
9702
|
-
`<silkscreentext text="${silkscreenText.text}" pcbX="${mmStr(silkscreenText.anchor_position.x)}" pcbY="${mmStr(silkscreenText.anchor_position.y)}" anchorAlignment="${silkscreenText.anchor_alignment}" ${silkscreenText.font_size ? `fontSize="${mmStr(silkscreenText.font_size)}"` : ""} />`
|
|
9703
|
-
);
|
|
9704
|
-
}
|
|
9705
|
-
for (const courtyardOutline of courtyardOutlines) {
|
|
9706
|
-
elementStrings.push(
|
|
9707
|
-
`<courtyardoutline outline={${JSON.stringify(courtyardOutline.outline)}} />`
|
|
9708
|
-
);
|
|
9709
|
-
}
|
|
9710
|
-
return `
|
|
9711
|
-
<footprint>
|
|
9712
|
-
${elementStrings.join("\n")}
|
|
9713
|
-
</footprint>
|
|
9714
|
-
`.trim();
|
|
9715
|
-
};
|
|
9716
|
-
|
|
9717
|
-
// lib/websafe/convert-to-typescript-component/generate-typescript-component.ts
|
|
9718
|
-
var generateTypescriptComponent = ({
|
|
9719
|
-
pinLabels,
|
|
9720
|
-
componentName,
|
|
9721
|
-
objUrl,
|
|
9722
|
-
circuitJson,
|
|
9723
|
-
supplierPartNumbers,
|
|
9724
|
-
manufacturerPartNumber
|
|
9725
|
-
}) => {
|
|
9726
|
-
const safePinLabels = pinLabels ?? {};
|
|
9727
|
-
const cadComponent = circuitJson.find((item) => item.type === "cad_component");
|
|
9728
|
-
const footprintTsx = generateFootprintTsx(circuitJson);
|
|
9729
|
-
const simplifiedPinLabels = Object.fromEntries(
|
|
9730
|
-
Object.entries(safePinLabels).map(([pin, labels]) => {
|
|
9731
|
-
if (Array.isArray(labels) && labels.length > 1) {
|
|
9732
|
-
return [pin, [labels[1]]];
|
|
9733
|
-
}
|
|
9734
|
-
return [pin, labels];
|
|
9735
|
-
})
|
|
9736
|
-
);
|
|
9737
|
-
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
9738
|
-
return `
|
|
9739
|
-
import type { ChipProps } from "@tscircuit/props"
|
|
9740
|
-
|
|
9741
|
-
const pinLabels = {
|
|
9742
|
-
${pinLabelsString}
|
|
9743
|
-
} as const
|
|
9744
|
-
|
|
9745
|
-
export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
9746
|
-
return (
|
|
9747
|
-
<chip
|
|
9748
|
-
pinLabels={pinLabels}
|
|
9749
|
-
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
9750
|
-
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
9751
|
-
footprint={${footprintTsx}}
|
|
9752
|
-
${objUrl ? `cadModel={{
|
|
9753
|
-
objUrl: "${objUrl}",
|
|
9754
|
-
pcbRotationOffset: ${cadComponent?.rotation?.z ?? 0},
|
|
9755
|
-
modelOriginPosition: { x: ${cadComponent?.model_origin_position?.x ?? 0}, y: ${cadComponent?.model_origin_position?.y ?? 0}, z: ${cadComponent?.model_origin_position?.z ?? 0} },
|
|
9756
|
-
}}` : ""}
|
|
9757
|
-
{...props}
|
|
9758
|
-
/>
|
|
9759
|
-
)
|
|
9760
|
-
}
|
|
9761
|
-
`.trim();
|
|
8880
|
+
m: 1e3,
|
|
8881
|
+
cm: 10,
|
|
8882
|
+
ft: 304.8,
|
|
8883
|
+
feet: 304.8
|
|
8884
|
+
};
|
|
8885
|
+
var mm = (n) => {
|
|
8886
|
+
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
8887
|
+
if (!unit)
|
|
8888
|
+
unit = "mm";
|
|
8889
|
+
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
8890
|
+
if (unit in unitToMm) {
|
|
8891
|
+
return val * unitToMm[unit];
|
|
8892
|
+
}
|
|
8893
|
+
throw new Error(`Unsupported unit: ${unit}`);
|
|
8894
|
+
};
|
|
8895
|
+
var mmStr = (n) => {
|
|
8896
|
+
return `${mm(n)}mm`;
|
|
9762
8897
|
};
|
|
9763
8898
|
|
|
8899
|
+
// lib/constants.ts
|
|
8900
|
+
var DEFAULT_PCB_THICKNESS_MM = 1.6;
|
|
8901
|
+
|
|
9764
8902
|
// lib/math/arc-utils.ts
|
|
9765
8903
|
function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag, sweepFlag) {
|
|
9766
8904
|
const start = { x: startX, y: startY };
|
|
@@ -9806,6 +8944,9 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
9806
8944
|
return path;
|
|
9807
8945
|
}
|
|
9808
8946
|
|
|
8947
|
+
// lib/utils/easyeda-unit-to-mm.ts
|
|
8948
|
+
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
8949
|
+
|
|
9809
8950
|
// lib/utils/normalize-pin-labels.ts
|
|
9810
8951
|
var normalizePinLabels = (inputPinLabels) => {
|
|
9811
8952
|
const uniqueInputPinLabels = inputPinLabels.map((labels) => [
|
|
@@ -9875,9 +9016,6 @@ var normalizePinLabels = (inputPinLabels) => {
|
|
|
9875
9016
|
return result;
|
|
9876
9017
|
};
|
|
9877
9018
|
|
|
9878
|
-
// lib/constants.ts
|
|
9879
|
-
var DEFAULT_PCB_THICKNESS_MM = 1.6;
|
|
9880
|
-
|
|
9881
9019
|
// lib/utils/normalize-symbol-name.ts
|
|
9882
9020
|
var normalizeSymbolName = (name) => {
|
|
9883
9021
|
const trimmedName = name.trim();
|
|
@@ -9887,6 +9025,9 @@ var normalizeSymbolName = (name) => {
|
|
|
9887
9025
|
};
|
|
9888
9026
|
|
|
9889
9027
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
9028
|
+
var EASYEDA_STEP_MODEL_URL = "https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y";
|
|
9029
|
+
var EASYEDA_OBJ_MODEL_URL = "https://modules.easyeda.com/3dmodel";
|
|
9030
|
+
var TSCIRCUIT_MODEL_CDN_URL = "https://modelcdn.tscircuit.com/easyeda_models";
|
|
9890
9031
|
var mil2mm = (mil) => {
|
|
9891
9032
|
if (typeof mil === "number") return mm(`${mil}mil`);
|
|
9892
9033
|
if (mil.match(/^\d+$/)) return mm(`${mil}mil`);
|
|
@@ -10249,9 +9390,10 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
10249
9390
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
10250
9391
|
(a) => Boolean(a.type === "SVGNODE" && a.svgData.attrs?.uuid)
|
|
10251
9392
|
);
|
|
10252
|
-
const
|
|
10253
|
-
const objFileUrl =
|
|
10254
|
-
|
|
9393
|
+
const modelUuid = svgNode?.svgData?.attrs?.uuid;
|
|
9394
|
+
const objFileUrl = modelUuid ? useModelCdn ? `${TSCIRCUIT_MODEL_CDN_URL}/assets/${easyEdaJson.lcsc.number}.obj?uuid=${modelUuid}` : `${EASYEDA_OBJ_MODEL_URL}/${modelUuid}` : void 0;
|
|
9395
|
+
const stepFileUrl = modelUuid ? useModelCdn ? `${TSCIRCUIT_MODEL_CDN_URL}/assets/${easyEdaJson.lcsc.number}.step?uuid=${modelUuid}` : `${EASYEDA_STEP_MODEL_URL}/${modelUuid}` : void 0;
|
|
9396
|
+
if (objFileUrl !== void 0 || stepFileUrl !== void 0) {
|
|
10255
9397
|
const { position: position2, rotation: rotation2 } = parseCadOffsetsFromSvgNode(svgNode);
|
|
10256
9398
|
circuitElements.push(
|
|
10257
9399
|
cad_component.parse({
|
|
@@ -10268,7 +9410,8 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
10268
9410
|
},
|
|
10269
9411
|
position: { x: 0, y: 0, z: 0 },
|
|
10270
9412
|
rotation: rotation2,
|
|
10271
|
-
model_obj_url: objFileUrl
|
|
9413
|
+
model_obj_url: objFileUrl,
|
|
9414
|
+
model_step_url: stepFileUrl
|
|
10272
9415
|
})
|
|
10273
9416
|
);
|
|
10274
9417
|
}
|
|
@@ -10332,75 +9475,814 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
10332
9475
|
e.points = e.points.map((p) => applyToPoint(matrix, p));
|
|
10333
9476
|
}
|
|
10334
9477
|
}
|
|
10335
|
-
const cad = circuitElements.find(
|
|
10336
|
-
(e) => e.type === "cad_component"
|
|
9478
|
+
const cad = circuitElements.find(
|
|
9479
|
+
(e) => e.type === "cad_component"
|
|
9480
|
+
);
|
|
9481
|
+
if (cad) {
|
|
9482
|
+
if (!cad.rotation) cad.rotation = { x: 0, y: 0, z: 0 };
|
|
9483
|
+
if (!cad.model_origin_position) {
|
|
9484
|
+
cad.model_origin_position = { x: 0, y: 0, z: 0 };
|
|
9485
|
+
}
|
|
9486
|
+
const side = pcb_component2.layer ?? "top";
|
|
9487
|
+
const t = DEFAULT_PCB_THICKNESS_MM / 2;
|
|
9488
|
+
const attrs = svgNode?.svgData?.attrs ?? {};
|
|
9489
|
+
const modelHeight = readModelHeightMm(attrs.c_height);
|
|
9490
|
+
if (!cad.size) {
|
|
9491
|
+
cad.size = {
|
|
9492
|
+
x: pcb_component2.width,
|
|
9493
|
+
y: pcb_component2.height,
|
|
9494
|
+
z: modelHeight
|
|
9495
|
+
};
|
|
9496
|
+
}
|
|
9497
|
+
const ROTATE_X_FOR_YUP = 90;
|
|
9498
|
+
const originalZRotation = (cad.rotation.z ?? 0) % 360;
|
|
9499
|
+
if (Math.abs(originalZRotation - 0) < 1 || Math.abs(originalZRotation - 360) < 1) {
|
|
9500
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
9501
|
+
} else if (Math.abs(originalZRotation - 180) < 1) {
|
|
9502
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
9503
|
+
} else if (Math.abs(originalZRotation - 90) < 1) {
|
|
9504
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
9505
|
+
} else if (Math.abs(originalZRotation - 270) < 1) {
|
|
9506
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
9507
|
+
cad.rotation.y = ((cad.rotation.y ?? 0) + 0 + 360) % 360;
|
|
9508
|
+
} else {
|
|
9509
|
+
console.warn(
|
|
9510
|
+
`[3D] Unusual rotation angle: ${originalZRotation}\xB0 for component ${easyEdaJson.lcsc.number}`
|
|
9511
|
+
);
|
|
9512
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + ROTATE_X_FOR_YUP + 360) % 360;
|
|
9513
|
+
}
|
|
9514
|
+
if (side !== "top") {
|
|
9515
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 180) % 360;
|
|
9516
|
+
}
|
|
9517
|
+
const USE_Z_OFFSET_FOR_180 = Math.abs(originalZRotation - 180) < 1;
|
|
9518
|
+
const zOffRaw = cad.model_origin_position.z ?? cad.position.z ?? 0;
|
|
9519
|
+
const zOff = USE_Z_OFFSET_FOR_180 ? -zOffRaw : 0;
|
|
9520
|
+
const rx = (cad.rotation.x % 360 + 360) % 360;
|
|
9521
|
+
let thicknessAlongWorldZ;
|
|
9522
|
+
const is180RotatedYUp = (Math.abs(originalZRotation - 180) < 1 || Math.abs(originalZRotation - 0) < 1 || Math.abs(originalZRotation - 360) < 1) && Math.abs(rx) < 1;
|
|
9523
|
+
if (is180RotatedYUp) {
|
|
9524
|
+
thicknessAlongWorldZ = cad.size.y;
|
|
9525
|
+
} else if (rx % 180 === 90) {
|
|
9526
|
+
thicknessAlongWorldZ = cad.size.y;
|
|
9527
|
+
} else {
|
|
9528
|
+
thicknessAlongWorldZ = cad.size.z;
|
|
9529
|
+
}
|
|
9530
|
+
if (Number.isFinite(resolvedCadPositionZMm)) {
|
|
9531
|
+
cad.model_origin_position.z = side === "top" ? resolvedCadPositionZMm : -resolvedCadPositionZMm;
|
|
9532
|
+
} else {
|
|
9533
|
+
let centerZ;
|
|
9534
|
+
if (is180RotatedYUp) {
|
|
9535
|
+
centerZ = side === "top" ? t - thicknessAlongWorldZ / 2 : -t + thicknessAlongWorldZ / 2;
|
|
9536
|
+
} else {
|
|
9537
|
+
centerZ = side === "top" ? t + zOff + thicknessAlongWorldZ / 2 : -t - zOff - thicknessAlongWorldZ / 2;
|
|
9538
|
+
}
|
|
9539
|
+
cad.model_origin_position.z = centerZ;
|
|
9540
|
+
}
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9543
|
+
pcb_component2.center = { x: 0, y: 0 };
|
|
9544
|
+
}
|
|
9545
|
+
return circuitElements;
|
|
9546
|
+
};
|
|
9547
|
+
|
|
9548
|
+
// lib/schemas/package-detail-shape-schema.ts
|
|
9549
|
+
var safeNumber = (defaultValue = 0) => external_exports.union([external_exports.number(), external_exports.string()]).transform((val) => {
|
|
9550
|
+
const num = Number(val);
|
|
9551
|
+
return isNaN(num) ? defaultValue : num;
|
|
9552
|
+
}).default(defaultValue);
|
|
9553
|
+
var tenthmil = external_exports.union([external_exports.number(), external_exports.string()]).optional().transform(
|
|
9554
|
+
(n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
|
|
9555
|
+
).pipe(external_exports.string());
|
|
9556
|
+
var PointSchema = external_exports.any().transform((p) => {
|
|
9557
|
+
if (Array.isArray(p)) {
|
|
9558
|
+
const [x, y] = p;
|
|
9559
|
+
return { x, y };
|
|
9560
|
+
}
|
|
9561
|
+
if (typeof p === "object") {
|
|
9562
|
+
return p;
|
|
9563
|
+
}
|
|
9564
|
+
throw new Error(`Invalid point: ${p}`);
|
|
9565
|
+
}).pipe(
|
|
9566
|
+
external_exports.object({
|
|
9567
|
+
x: external_exports.number(),
|
|
9568
|
+
y: external_exports.number()
|
|
9569
|
+
})
|
|
9570
|
+
);
|
|
9571
|
+
var BaseShapeSchema = external_exports.object({
|
|
9572
|
+
type: external_exports.string(),
|
|
9573
|
+
id: external_exports.string().optional(),
|
|
9574
|
+
layer: external_exports.coerce.number().optional()
|
|
9575
|
+
});
|
|
9576
|
+
var TrackSchema = BaseShapeSchema.extend({
|
|
9577
|
+
type: external_exports.literal("TRACK"),
|
|
9578
|
+
width: external_exports.coerce.number(),
|
|
9579
|
+
points: external_exports.array(PointSchema)
|
|
9580
|
+
});
|
|
9581
|
+
var PadSchema = BaseShapeSchema.extend({
|
|
9582
|
+
type: external_exports.literal("PAD"),
|
|
9583
|
+
shape: external_exports.enum(["RECT", "ELLIPSE", "OVAL", "POLYGON"]),
|
|
9584
|
+
center: external_exports.object({
|
|
9585
|
+
x: tenthmil,
|
|
9586
|
+
y: tenthmil
|
|
9587
|
+
}),
|
|
9588
|
+
width: tenthmil,
|
|
9589
|
+
height: tenthmil,
|
|
9590
|
+
layermask: external_exports.number(),
|
|
9591
|
+
net: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
|
|
9592
|
+
number: external_exports.union([external_exports.string(), external_exports.number()]),
|
|
9593
|
+
holeRadius: tenthmil,
|
|
9594
|
+
points: external_exports.array(PointSchema).optional(),
|
|
9595
|
+
rotation: safeNumber(0),
|
|
9596
|
+
// Will default to 0 if NaN or missing
|
|
9597
|
+
plated: external_exports.boolean()
|
|
9598
|
+
});
|
|
9599
|
+
var ArcSchema = BaseShapeSchema.extend({
|
|
9600
|
+
type: external_exports.literal("ARC"),
|
|
9601
|
+
width: external_exports.number(),
|
|
9602
|
+
start: PointSchema,
|
|
9603
|
+
end: PointSchema,
|
|
9604
|
+
radiusX: external_exports.number(),
|
|
9605
|
+
radiusY: external_exports.number(),
|
|
9606
|
+
largeArc: external_exports.boolean(),
|
|
9607
|
+
sweepDirection: external_exports.enum(["CW", "CCW"])
|
|
9608
|
+
});
|
|
9609
|
+
var CircleSchema = BaseShapeSchema.extend({
|
|
9610
|
+
type: external_exports.literal("CIRCLE"),
|
|
9611
|
+
center: PointSchema,
|
|
9612
|
+
radius: external_exports.number(),
|
|
9613
|
+
width: external_exports.number()
|
|
9614
|
+
});
|
|
9615
|
+
var SolidRegionSchema = BaseShapeSchema.extend({
|
|
9616
|
+
type: external_exports.literal("SOLIDREGION"),
|
|
9617
|
+
layermask: external_exports.number(),
|
|
9618
|
+
points: external_exports.array(PointSchema),
|
|
9619
|
+
fillStyle: external_exports.string()
|
|
9620
|
+
});
|
|
9621
|
+
var SVGNodeSchema = BaseShapeSchema.extend({
|
|
9622
|
+
type: external_exports.literal("SVGNODE"),
|
|
9623
|
+
svgData: external_exports.object({
|
|
9624
|
+
gId: external_exports.string(),
|
|
9625
|
+
nodeName: external_exports.string(),
|
|
9626
|
+
nodeType: external_exports.number(),
|
|
9627
|
+
layerid: external_exports.string(),
|
|
9628
|
+
attrs: external_exports.record(external_exports.string(), external_exports.string()),
|
|
9629
|
+
childNodes: external_exports.array(external_exports.unknown())
|
|
9630
|
+
})
|
|
9631
|
+
});
|
|
9632
|
+
var HoleSchema = BaseShapeSchema.extend({
|
|
9633
|
+
type: external_exports.literal("HOLE"),
|
|
9634
|
+
center: PointSchema,
|
|
9635
|
+
radius: external_exports.number()
|
|
9636
|
+
});
|
|
9637
|
+
var ViaSchema = BaseShapeSchema.extend({
|
|
9638
|
+
type: external_exports.literal("VIA"),
|
|
9639
|
+
center: PointSchema,
|
|
9640
|
+
outerDiameter: external_exports.number(),
|
|
9641
|
+
holeDiameter: external_exports.number()
|
|
9642
|
+
});
|
|
9643
|
+
var RectSchema = BaseShapeSchema.extend({
|
|
9644
|
+
type: external_exports.literal("RECT"),
|
|
9645
|
+
x: tenthmil,
|
|
9646
|
+
y: tenthmil,
|
|
9647
|
+
width: tenthmil,
|
|
9648
|
+
height: tenthmil,
|
|
9649
|
+
lineWidth: external_exports.number(),
|
|
9650
|
+
fillStyle: external_exports.string(),
|
|
9651
|
+
rotation: external_exports.number().optional()
|
|
9652
|
+
});
|
|
9653
|
+
var TextSchema = BaseShapeSchema.extend({
|
|
9654
|
+
type: external_exports.literal("TEXT"),
|
|
9655
|
+
text: external_exports.string(),
|
|
9656
|
+
x: tenthmil,
|
|
9657
|
+
y: tenthmil,
|
|
9658
|
+
size_mm: external_exports.number(),
|
|
9659
|
+
rotation: external_exports.number().optional(),
|
|
9660
|
+
layer: external_exports.number().optional(),
|
|
9661
|
+
textAnchor: external_exports.enum(["L", "C", "R", ""]).optional().transform((val) => val === "" ? void 0 : val),
|
|
9662
|
+
font: external_exports.string().optional()
|
|
9663
|
+
});
|
|
9664
|
+
var PackageDetailShapeSchema = external_exports.discriminatedUnion("type", [
|
|
9665
|
+
TrackSchema,
|
|
9666
|
+
PadSchema,
|
|
9667
|
+
ArcSchema,
|
|
9668
|
+
CircleSchema,
|
|
9669
|
+
SolidRegionSchema,
|
|
9670
|
+
SVGNodeSchema,
|
|
9671
|
+
HoleSchema,
|
|
9672
|
+
ViaSchema,
|
|
9673
|
+
RectSchema,
|
|
9674
|
+
TextSchema
|
|
9675
|
+
]);
|
|
9676
|
+
var pairs = (arr) => {
|
|
9677
|
+
const pairs2 = [];
|
|
9678
|
+
for (let i = 0; i < arr.length; i += 2) {
|
|
9679
|
+
pairs2.push([arr[i], arr[i + 1]]);
|
|
9680
|
+
}
|
|
9681
|
+
return pairs2;
|
|
9682
|
+
};
|
|
9683
|
+
var parsePoints = (pointsStr) => pairs(
|
|
9684
|
+
pointsStr.trim().split(" ").map((n) => Number(n))
|
|
9685
|
+
);
|
|
9686
|
+
var ShapeItemSchema = external_exports.object({
|
|
9687
|
+
type: external_exports.string(),
|
|
9688
|
+
data: external_exports.string()
|
|
9689
|
+
}).transform((shape) => {
|
|
9690
|
+
switch (shape.type) {
|
|
9691
|
+
case "TRACK": {
|
|
9692
|
+
const [width, layer, _, pointsStr, id, _n] = shape.data.split("~");
|
|
9693
|
+
const points = parsePoints(pointsStr);
|
|
9694
|
+
return TrackSchema.parse({ type: "TRACK", width, layer, points, id });
|
|
9695
|
+
}
|
|
9696
|
+
case "PAD": {
|
|
9697
|
+
const [padShape, ...params] = shape.data.split("~");
|
|
9698
|
+
const [
|
|
9699
|
+
centerX,
|
|
9700
|
+
centerY,
|
|
9701
|
+
width,
|
|
9702
|
+
height,
|
|
9703
|
+
layermask,
|
|
9704
|
+
net,
|
|
9705
|
+
number,
|
|
9706
|
+
holeRadius,
|
|
9707
|
+
...rest
|
|
9708
|
+
] = params.map((p) => Number.isNaN(Number(p)) ? p : Number(p));
|
|
9709
|
+
const center = { x: centerX, y: centerY };
|
|
9710
|
+
let points;
|
|
9711
|
+
if (padShape === "RECT" || padShape === "POLYGON") {
|
|
9712
|
+
points = parsePoints(rest[0]);
|
|
9713
|
+
}
|
|
9714
|
+
const r = Number(rest[1]);
|
|
9715
|
+
const rotation2 = Number.isNaN(r) ? void 0 : r;
|
|
9716
|
+
const padInputParams = {
|
|
9717
|
+
type: "PAD",
|
|
9718
|
+
shape: padShape,
|
|
9719
|
+
center,
|
|
9720
|
+
width,
|
|
9721
|
+
height,
|
|
9722
|
+
layermask,
|
|
9723
|
+
net,
|
|
9724
|
+
number,
|
|
9725
|
+
holeRadius,
|
|
9726
|
+
points,
|
|
9727
|
+
rotation: rotation2,
|
|
9728
|
+
plated: rest.includes("Y")
|
|
9729
|
+
};
|
|
9730
|
+
const pad = PadSchema.parse(padInputParams);
|
|
9731
|
+
return pad;
|
|
9732
|
+
}
|
|
9733
|
+
case "ARC": {
|
|
9734
|
+
const [width, layer, , arcData] = shape.data.split("~");
|
|
9735
|
+
const match = arcData.match(
|
|
9736
|
+
/M\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)\s*A\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)/
|
|
10337
9737
|
);
|
|
10338
|
-
if (
|
|
10339
|
-
|
|
10340
|
-
if (!cad.model_origin_position) {
|
|
10341
|
-
cad.model_origin_position = { x: 0, y: 0, z: 0 };
|
|
10342
|
-
}
|
|
10343
|
-
const side = pcb_component2.layer ?? "top";
|
|
10344
|
-
const t = DEFAULT_PCB_THICKNESS_MM / 2;
|
|
10345
|
-
const attrs = svgNode?.svgData?.attrs ?? {};
|
|
10346
|
-
const modelHeight = readModelHeightMm(attrs.c_height);
|
|
10347
|
-
if (!cad.size) {
|
|
10348
|
-
cad.size = {
|
|
10349
|
-
x: pcb_component2.width,
|
|
10350
|
-
y: pcb_component2.height,
|
|
10351
|
-
z: modelHeight
|
|
10352
|
-
};
|
|
10353
|
-
}
|
|
10354
|
-
const ROTATE_X_FOR_YUP = 90;
|
|
10355
|
-
const originalZRotation = (cad.rotation.z ?? 0) % 360;
|
|
10356
|
-
if (Math.abs(originalZRotation - 0) < 1 || Math.abs(originalZRotation - 360) < 1) {
|
|
10357
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
10358
|
-
} else if (Math.abs(originalZRotation - 180) < 1) {
|
|
10359
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
10360
|
-
} else if (Math.abs(originalZRotation - 90) < 1) {
|
|
10361
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
10362
|
-
} else if (Math.abs(originalZRotation - 270) < 1) {
|
|
10363
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
10364
|
-
cad.rotation.y = ((cad.rotation.y ?? 0) + 0 + 360) % 360;
|
|
10365
|
-
} else {
|
|
10366
|
-
console.warn(
|
|
10367
|
-
`[3D] Unusual rotation angle: ${originalZRotation}\xB0 for component ${easyEdaJson.lcsc.number}`
|
|
10368
|
-
);
|
|
10369
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) + ROTATE_X_FOR_YUP + 360) % 360;
|
|
10370
|
-
}
|
|
10371
|
-
if (side !== "top") {
|
|
10372
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) + 180) % 360;
|
|
10373
|
-
}
|
|
10374
|
-
const USE_Z_OFFSET_FOR_180 = Math.abs(originalZRotation - 180) < 1;
|
|
10375
|
-
const zOffRaw = cad.model_origin_position.z ?? cad.position.z ?? 0;
|
|
10376
|
-
const zOff = USE_Z_OFFSET_FOR_180 ? -zOffRaw : 0;
|
|
10377
|
-
const rx = (cad.rotation.x % 360 + 360) % 360;
|
|
10378
|
-
let thicknessAlongWorldZ;
|
|
10379
|
-
const is180RotatedYUp = (Math.abs(originalZRotation - 180) < 1 || Math.abs(originalZRotation - 0) < 1 || Math.abs(originalZRotation - 360) < 1) && Math.abs(rx) < 1;
|
|
10380
|
-
if (is180RotatedYUp) {
|
|
10381
|
-
thicknessAlongWorldZ = cad.size.y;
|
|
10382
|
-
} else if (rx % 180 === 90) {
|
|
10383
|
-
thicknessAlongWorldZ = cad.size.y;
|
|
10384
|
-
} else {
|
|
10385
|
-
thicknessAlongWorldZ = cad.size.z;
|
|
10386
|
-
}
|
|
10387
|
-
if (Number.isFinite(resolvedCadPositionZMm)) {
|
|
10388
|
-
cad.model_origin_position.z = side === "top" ? resolvedCadPositionZMm : -resolvedCadPositionZMm;
|
|
10389
|
-
} else {
|
|
10390
|
-
let centerZ;
|
|
10391
|
-
if (is180RotatedYUp) {
|
|
10392
|
-
centerZ = side === "top" ? t - thicknessAlongWorldZ / 2 : -t + thicknessAlongWorldZ / 2;
|
|
10393
|
-
} else {
|
|
10394
|
-
centerZ = side === "top" ? t + zOff + thicknessAlongWorldZ / 2 : -t - zOff - thicknessAlongWorldZ / 2;
|
|
10395
|
-
}
|
|
10396
|
-
cad.model_origin_position.z = centerZ;
|
|
10397
|
-
}
|
|
9738
|
+
if (!match) {
|
|
9739
|
+
throw new Error(`Invalid arc data: ${arcData}`);
|
|
10398
9740
|
}
|
|
9741
|
+
const [
|
|
9742
|
+
,
|
|
9743
|
+
startX,
|
|
9744
|
+
startY,
|
|
9745
|
+
radiusX,
|
|
9746
|
+
radiusY,
|
|
9747
|
+
xAxisRotation,
|
|
9748
|
+
largeArcFlag,
|
|
9749
|
+
sweepFlag,
|
|
9750
|
+
endX,
|
|
9751
|
+
endY
|
|
9752
|
+
] = match;
|
|
9753
|
+
const start = [Number(startX), Number(startY)];
|
|
9754
|
+
const end = [Number(endX), Number(endY)];
|
|
9755
|
+
return ArcSchema.parse({
|
|
9756
|
+
type: "ARC",
|
|
9757
|
+
width: Number(width),
|
|
9758
|
+
layer: Number(layer),
|
|
9759
|
+
start,
|
|
9760
|
+
end,
|
|
9761
|
+
radiusX: Number(radiusX),
|
|
9762
|
+
radiusY: Number(radiusY),
|
|
9763
|
+
largeArc: largeArcFlag === "1",
|
|
9764
|
+
// sweepFlag=1 means clockwise (CW), sweepFlag=0 means counter-clockwise (CCW)
|
|
9765
|
+
sweepDirection: sweepFlag === "1" ? "CW" : "CCW"
|
|
9766
|
+
});
|
|
9767
|
+
}
|
|
9768
|
+
case "CIRCLE": {
|
|
9769
|
+
const [centerX, centerY, radius, width, layer, id] = shape.data.split("~");
|
|
9770
|
+
const center = [Number(centerX), Number(centerY)];
|
|
9771
|
+
return CircleSchema.parse({
|
|
9772
|
+
type: "CIRCLE",
|
|
9773
|
+
center,
|
|
9774
|
+
radius: Number(radius),
|
|
9775
|
+
width: Number(width),
|
|
9776
|
+
layer: Number(layer),
|
|
9777
|
+
id
|
|
9778
|
+
});
|
|
9779
|
+
}
|
|
9780
|
+
case "HOLE": {
|
|
9781
|
+
const [centerX, centerY, radius, id] = shape.data.split("~");
|
|
9782
|
+
const center = [Number(centerX), Number(centerY)];
|
|
9783
|
+
return HoleSchema.parse({
|
|
9784
|
+
type: "HOLE",
|
|
9785
|
+
center,
|
|
9786
|
+
radius: Number(radius),
|
|
9787
|
+
id
|
|
9788
|
+
});
|
|
9789
|
+
}
|
|
9790
|
+
case "VIA": {
|
|
9791
|
+
const [x, y, outerDiameter, , holeDiameter, id] = shape.data.split("~");
|
|
9792
|
+
const center = [Number(x), Number(y)];
|
|
9793
|
+
return ViaSchema.parse({
|
|
9794
|
+
type: "VIA",
|
|
9795
|
+
center,
|
|
9796
|
+
outerDiameter: Number(outerDiameter),
|
|
9797
|
+
holeDiameter: Number(holeDiameter),
|
|
9798
|
+
id
|
|
9799
|
+
});
|
|
9800
|
+
}
|
|
9801
|
+
case "SOLIDREGION": {
|
|
9802
|
+
const [layermask, , pathData, fillStyle, id] = shape.data.split("~");
|
|
9803
|
+
const points = pathData.match(/[ML] ?(-?[\d.]+)[ ,](-?[\d.]+)/g)?.map((point2) => {
|
|
9804
|
+
const [, x, y] = point2.match(/[ML]? ?(-?[\d.]+)[ ,](-?[\d.]+)/) || [];
|
|
9805
|
+
return [Number(x), Number(y)];
|
|
9806
|
+
}) || [];
|
|
9807
|
+
return SolidRegionSchema.parse({
|
|
9808
|
+
type: "SOLIDREGION",
|
|
9809
|
+
layermask: Number(layermask),
|
|
9810
|
+
points,
|
|
9811
|
+
fillStyle,
|
|
9812
|
+
id
|
|
9813
|
+
});
|
|
9814
|
+
}
|
|
9815
|
+
case "SVGNODE": {
|
|
9816
|
+
const svgData = JSON.parse(shape.data);
|
|
9817
|
+
return SVGNodeSchema.parse({ type: "SVGNODE", svgData });
|
|
9818
|
+
}
|
|
9819
|
+
case "RECT": {
|
|
9820
|
+
const [x, y, width, height, lineWidth, id, rotation2, layer, fillStyle] = shape.data.split("~");
|
|
9821
|
+
const r = rotation2 ? Number(rotation2) : void 0;
|
|
9822
|
+
return RectSchema.parse({
|
|
9823
|
+
type: "RECT",
|
|
9824
|
+
x,
|
|
9825
|
+
y,
|
|
9826
|
+
width,
|
|
9827
|
+
height,
|
|
9828
|
+
lineWidth: Number(lineWidth),
|
|
9829
|
+
id,
|
|
9830
|
+
rotation: Number.isNaN(r) ? void 0 : r,
|
|
9831
|
+
layer: layer ? Number(layer) : void 0,
|
|
9832
|
+
fillStyle: fillStyle || void 0
|
|
9833
|
+
});
|
|
9834
|
+
}
|
|
9835
|
+
case "TEXT": {
|
|
9836
|
+
const [textAnchor, x, y, size2, layer, id, rotation2, , font, text] = shape.data.split("~");
|
|
9837
|
+
const r = rotation2 ? Number(rotation2) : void 0;
|
|
9838
|
+
return TextSchema.parse({
|
|
9839
|
+
type: "TEXT",
|
|
9840
|
+
text,
|
|
9841
|
+
x,
|
|
9842
|
+
y,
|
|
9843
|
+
size_mm: Number(size2) * 2.54,
|
|
9844
|
+
// empirically this seems to match, C5248081 is a good test case
|
|
9845
|
+
layer: layer ? Number(layer) : void 0,
|
|
9846
|
+
id,
|
|
9847
|
+
rotation: Number.isNaN(r) ? void 0 : r,
|
|
9848
|
+
textAnchor,
|
|
9849
|
+
font: font || void 0
|
|
9850
|
+
});
|
|
9851
|
+
}
|
|
9852
|
+
default:
|
|
9853
|
+
throw new Error(`Unknown shape type: ${shape.type}`);
|
|
9854
|
+
}
|
|
9855
|
+
}).pipe(PackageDetailShapeSchema);
|
|
9856
|
+
var ShapesArraySchema = external_exports.array(ShapeItemSchema);
|
|
9857
|
+
|
|
9858
|
+
// lib/schemas/single-letter-shape-schema.ts
|
|
9859
|
+
var PointSchema2 = external_exports.object({
|
|
9860
|
+
x: external_exports.number(),
|
|
9861
|
+
y: external_exports.number()
|
|
9862
|
+
});
|
|
9863
|
+
var RectangleShapeOutputSchema = external_exports.object({
|
|
9864
|
+
type: external_exports.literal("RECTANGLE"),
|
|
9865
|
+
position: PointSchema2,
|
|
9866
|
+
width: external_exports.number(),
|
|
9867
|
+
height: external_exports.number(),
|
|
9868
|
+
color: external_exports.string(),
|
|
9869
|
+
lineWidth: external_exports.number(),
|
|
9870
|
+
id: external_exports.string()
|
|
9871
|
+
});
|
|
9872
|
+
var parseRectangle = (str) => {
|
|
9873
|
+
const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
|
|
9874
|
+
return {
|
|
9875
|
+
type: "RECTANGLE",
|
|
9876
|
+
position: { x: Number(x), y: Number(y) },
|
|
9877
|
+
width: Number(width),
|
|
9878
|
+
height: Number(height),
|
|
9879
|
+
color,
|
|
9880
|
+
lineWidth: Number(lineWidth),
|
|
9881
|
+
id
|
|
9882
|
+
};
|
|
9883
|
+
};
|
|
9884
|
+
var RectangleShapeSchema = external_exports.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
|
|
9885
|
+
var EllipseShapeOutputSchema = external_exports.object({
|
|
9886
|
+
type: external_exports.literal("ELLIPSE"),
|
|
9887
|
+
center: PointSchema2,
|
|
9888
|
+
radiusX: external_exports.number(),
|
|
9889
|
+
radiusY: external_exports.number(),
|
|
9890
|
+
color: external_exports.string(),
|
|
9891
|
+
lineWidth: external_exports.number(),
|
|
9892
|
+
id: external_exports.string()
|
|
9893
|
+
});
|
|
9894
|
+
var parseEllipse = (str) => {
|
|
9895
|
+
const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
|
|
9896
|
+
return {
|
|
9897
|
+
type: "ELLIPSE",
|
|
9898
|
+
center: { x: Number(x), y: Number(y) },
|
|
9899
|
+
radiusX: Number(radiusX),
|
|
9900
|
+
radiusY: Number(radiusY),
|
|
9901
|
+
color,
|
|
9902
|
+
lineWidth: Number(lineWidth),
|
|
9903
|
+
id
|
|
9904
|
+
};
|
|
9905
|
+
};
|
|
9906
|
+
var EllipseShapeSchema = external_exports.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
9907
|
+
var ArcShapeOutputSchema = external_exports.object({
|
|
9908
|
+
type: external_exports.literal("ARC"),
|
|
9909
|
+
start: PointSchema2,
|
|
9910
|
+
end: PointSchema2,
|
|
9911
|
+
radius: external_exports.number(),
|
|
9912
|
+
sweepFlag: external_exports.boolean(),
|
|
9913
|
+
color: external_exports.string(),
|
|
9914
|
+
lineWidth: external_exports.number(),
|
|
9915
|
+
id: external_exports.string()
|
|
9916
|
+
});
|
|
9917
|
+
var parseArc = (str) => {
|
|
9918
|
+
const [, pathData, color, lineWidth, , , id] = str.split("~");
|
|
9919
|
+
const parts = pathData.split(" ");
|
|
9920
|
+
const x1 = Number(parts[1]) || 0;
|
|
9921
|
+
const y1 = Number(parts[2]) || 0;
|
|
9922
|
+
const radius = Number(parts[4]) || 0;
|
|
9923
|
+
const sweepFlag = parts[7] === "1";
|
|
9924
|
+
const x2 = Number(parts[8]) || 0;
|
|
9925
|
+
const y2 = Number(parts[9]) || 0;
|
|
9926
|
+
const parsedLineWidth = Number(lineWidth);
|
|
9927
|
+
const finalLineWidth = Number.isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
9928
|
+
return {
|
|
9929
|
+
type: "ARC",
|
|
9930
|
+
start: { x: x1, y: y1 },
|
|
9931
|
+
end: { x: x2, y: y2 },
|
|
9932
|
+
radius,
|
|
9933
|
+
sweepFlag,
|
|
9934
|
+
color: color || "#880000",
|
|
9935
|
+
// Default color
|
|
9936
|
+
lineWidth: finalLineWidth,
|
|
9937
|
+
id: id || "gge1"
|
|
9938
|
+
};
|
|
9939
|
+
};
|
|
9940
|
+
var ArcShapeSchema = external_exports.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema);
|
|
9941
|
+
var PinShapeOutputSchema = external_exports.object({
|
|
9942
|
+
type: external_exports.literal("PIN"),
|
|
9943
|
+
visibility: external_exports.enum(["show", "hide", "none"]),
|
|
9944
|
+
pinNumber: external_exports.union([external_exports.string(), external_exports.number()]),
|
|
9945
|
+
x: external_exports.number(),
|
|
9946
|
+
y: external_exports.number(),
|
|
9947
|
+
rotation: external_exports.number(),
|
|
9948
|
+
id: external_exports.string(),
|
|
9949
|
+
label: external_exports.string(),
|
|
9950
|
+
labelColor: external_exports.string(),
|
|
9951
|
+
path: external_exports.string(),
|
|
9952
|
+
arrow: external_exports.string()
|
|
9953
|
+
});
|
|
9954
|
+
var parsePin = (pinString) => {
|
|
9955
|
+
const parts = pinString.split("~");
|
|
9956
|
+
const [, visibility, , pinNumber, x, y, rotation2, id] = parts;
|
|
9957
|
+
const nameMatch = pinString.match(/~([\w+#-]+)~(start|end)~/);
|
|
9958
|
+
let label = nameMatch ? nameMatch[1] : "";
|
|
9959
|
+
if (label.endsWith("+")) label = label.slice(0, -1) + "_POS";
|
|
9960
|
+
if (label.endsWith("-")) label = label.slice(0, -1) + "_NEG";
|
|
9961
|
+
if (label.endsWith("#")) label = label.slice(0, -1);
|
|
9962
|
+
if (/^\+\d+(?:\.\d+)?V$/i.test(label)) label = `V${label.slice(1, -1)}`;
|
|
9963
|
+
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
9964
|
+
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
9965
|
+
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
9966
|
+
const path = pathMatch ? pathMatch[1] : "";
|
|
9967
|
+
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
9968
|
+
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
9969
|
+
const r = Number.parseFloat(rotation2);
|
|
9970
|
+
return {
|
|
9971
|
+
type: "PIN",
|
|
9972
|
+
visibility,
|
|
9973
|
+
id,
|
|
9974
|
+
pinNumber: Number.isNaN(Number(pinNumber)) ? pinNumber : Number(pinNumber),
|
|
9975
|
+
x: Number.parseFloat(x),
|
|
9976
|
+
y: Number.parseFloat(y),
|
|
9977
|
+
rotation: Number.isNaN(r) ? 0 : r,
|
|
9978
|
+
label,
|
|
9979
|
+
labelColor,
|
|
9980
|
+
path,
|
|
9981
|
+
arrow
|
|
9982
|
+
};
|
|
9983
|
+
};
|
|
9984
|
+
var PinShapeSchema = external_exports.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
|
|
9985
|
+
var PolylineShapeOutputSchema = external_exports.object({
|
|
9986
|
+
type: external_exports.literal("POLYLINE"),
|
|
9987
|
+
points: external_exports.array(PointSchema2),
|
|
9988
|
+
color: external_exports.string(),
|
|
9989
|
+
lineWidth: external_exports.number(),
|
|
9990
|
+
id: external_exports.string()
|
|
9991
|
+
});
|
|
9992
|
+
var parsePoints2 = (pointsStr) => {
|
|
9993
|
+
return pointsStr.split(" ").reduce((acc, value, index) => {
|
|
9994
|
+
if (index % 2 === 0) {
|
|
9995
|
+
acc.push({ x: Number(value), y: 0 });
|
|
9996
|
+
} else {
|
|
9997
|
+
acc[acc.length - 1].y = Number(value);
|
|
10399
9998
|
}
|
|
10400
|
-
|
|
10401
|
-
}
|
|
10402
|
-
|
|
9999
|
+
return acc;
|
|
10000
|
+
}, []);
|
|
10001
|
+
};
|
|
10002
|
+
var parsePolyline = (str) => {
|
|
10003
|
+
const [, ...rest] = str.split("~");
|
|
10004
|
+
const [pointsStr, color, lineWidth, , , id] = rest;
|
|
10005
|
+
return {
|
|
10006
|
+
type: "POLYLINE",
|
|
10007
|
+
points: parsePoints2(pointsStr),
|
|
10008
|
+
color,
|
|
10009
|
+
lineWidth: Number(lineWidth),
|
|
10010
|
+
id
|
|
10011
|
+
};
|
|
10012
|
+
};
|
|
10013
|
+
var PolylineShapeSchema = external_exports.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
|
|
10014
|
+
var PolygonShapeOutputSchema = external_exports.object({
|
|
10015
|
+
type: external_exports.literal("POLYGON"),
|
|
10016
|
+
points: external_exports.array(PointSchema2),
|
|
10017
|
+
fillColor: external_exports.string(),
|
|
10018
|
+
lineWidth: external_exports.number(),
|
|
10019
|
+
lineColor: external_exports.string(),
|
|
10020
|
+
id: external_exports.string()
|
|
10021
|
+
});
|
|
10022
|
+
var parsePolygon = (str) => {
|
|
10023
|
+
const [, ...rest] = str.split("~");
|
|
10024
|
+
const [pointsStr, fillColor, lineWidth, lineColor, , id] = rest;
|
|
10025
|
+
return {
|
|
10026
|
+
type: "POLYGON",
|
|
10027
|
+
points: parsePoints2(pointsStr),
|
|
10028
|
+
fillColor,
|
|
10029
|
+
lineWidth: Number(lineWidth),
|
|
10030
|
+
lineColor,
|
|
10031
|
+
id
|
|
10032
|
+
};
|
|
10033
|
+
};
|
|
10034
|
+
var PolygonShapeSchema = external_exports.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
|
|
10035
|
+
var PathShapeOutputSchema = external_exports.object({
|
|
10036
|
+
type: external_exports.literal("PATH"),
|
|
10037
|
+
pathData: external_exports.string(),
|
|
10038
|
+
fillColor: external_exports.string(),
|
|
10039
|
+
strokeWidth: external_exports.number(),
|
|
10040
|
+
strokeColor: external_exports.string(),
|
|
10041
|
+
id: external_exports.string()
|
|
10042
|
+
});
|
|
10043
|
+
var parsePath = (str) => {
|
|
10044
|
+
const [, pathData, fillColor, strokeWidth, strokeColor, , id] = str.split("~");
|
|
10045
|
+
return {
|
|
10046
|
+
type: "PATH",
|
|
10047
|
+
pathData,
|
|
10048
|
+
fillColor,
|
|
10049
|
+
strokeWidth: mil10ToMm(Number(strokeWidth)),
|
|
10050
|
+
strokeColor,
|
|
10051
|
+
id
|
|
10052
|
+
};
|
|
10053
|
+
};
|
|
10054
|
+
var PathShapeSchema = external_exports.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
|
|
10055
|
+
var TextShapeOutputSchema = external_exports.object({
|
|
10056
|
+
type: external_exports.literal("TEXT"),
|
|
10057
|
+
alignment: external_exports.enum(["L", "C", "R"]),
|
|
10058
|
+
x: external_exports.number(),
|
|
10059
|
+
y: external_exports.number(),
|
|
10060
|
+
rotation: external_exports.number(),
|
|
10061
|
+
fontColor: external_exports.string(),
|
|
10062
|
+
backgroundColor: external_exports.string().optional(),
|
|
10063
|
+
fontSize: external_exports.string(),
|
|
10064
|
+
fontWeight: external_exports.string().optional().default("normal"),
|
|
10065
|
+
fontStyle: external_exports.enum(["normal", "italic"]).optional().default("normal"),
|
|
10066
|
+
fontDecoration: external_exports.string().optional().default(""),
|
|
10067
|
+
content: external_exports.string(),
|
|
10068
|
+
textType: external_exports.string(),
|
|
10069
|
+
visibility: external_exports.enum(["0", "1"]),
|
|
10070
|
+
mirror: external_exports.string(),
|
|
10071
|
+
id: external_exports.string()
|
|
10072
|
+
});
|
|
10073
|
+
var parseText = (str) => {
|
|
10074
|
+
const [
|
|
10075
|
+
,
|
|
10076
|
+
alignment,
|
|
10077
|
+
x,
|
|
10078
|
+
y,
|
|
10079
|
+
rotation2,
|
|
10080
|
+
fontColor,
|
|
10081
|
+
backgroundColor,
|
|
10082
|
+
fontSize,
|
|
10083
|
+
fontWeight,
|
|
10084
|
+
fontStyle,
|
|
10085
|
+
fontDecoration,
|
|
10086
|
+
content,
|
|
10087
|
+
textType,
|
|
10088
|
+
visibility,
|
|
10089
|
+
mirror,
|
|
10090
|
+
id
|
|
10091
|
+
] = str.split("~");
|
|
10092
|
+
return {
|
|
10093
|
+
type: "TEXT",
|
|
10094
|
+
alignment,
|
|
10095
|
+
x: Number(x),
|
|
10096
|
+
y: Number(y),
|
|
10097
|
+
rotation: Number(rotation2),
|
|
10098
|
+
fontColor,
|
|
10099
|
+
backgroundColor: backgroundColor || void 0,
|
|
10100
|
+
fontSize,
|
|
10101
|
+
fontWeight: fontWeight || "normal",
|
|
10102
|
+
fontStyle: fontStyle || "normal",
|
|
10103
|
+
fontDecoration: fontDecoration || "",
|
|
10104
|
+
content,
|
|
10105
|
+
textType,
|
|
10106
|
+
visibility,
|
|
10107
|
+
mirror,
|
|
10108
|
+
id
|
|
10109
|
+
};
|
|
10403
10110
|
};
|
|
10111
|
+
var TextShapeSchema = external_exports.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema);
|
|
10112
|
+
var SingleLetterShapeSchema = external_exports.string().transform((x) => {
|
|
10113
|
+
if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
|
|
10114
|
+
if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
|
|
10115
|
+
if (x.startsWith("P~")) return PinShapeSchema.parse(x);
|
|
10116
|
+
if (x.startsWith("PL~")) return PolylineShapeSchema.parse(x);
|
|
10117
|
+
if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
|
|
10118
|
+
if (x.startsWith("PT~")) return PathShapeSchema.parse(x);
|
|
10119
|
+
if (x.startsWith("T~")) return TextShapeSchema.parse(x);
|
|
10120
|
+
if (x.startsWith("A~")) return ArcShapeSchema.parse(x);
|
|
10121
|
+
throw new Error(`Invalid shape type: ${x}`);
|
|
10122
|
+
}).pipe(
|
|
10123
|
+
external_exports.union([
|
|
10124
|
+
RectangleShapeOutputSchema,
|
|
10125
|
+
EllipseShapeOutputSchema,
|
|
10126
|
+
PinShapeOutputSchema,
|
|
10127
|
+
PolylineShapeOutputSchema,
|
|
10128
|
+
PolygonShapeOutputSchema,
|
|
10129
|
+
PathShapeOutputSchema,
|
|
10130
|
+
TextShapeOutputSchema,
|
|
10131
|
+
ArcShapeOutputSchema
|
|
10132
|
+
])
|
|
10133
|
+
);
|
|
10134
|
+
|
|
10135
|
+
// lib/schemas/easy-eda-json-schema.ts
|
|
10136
|
+
var maybeNumber = external_exports.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(external_exports.number().nullable().optional());
|
|
10137
|
+
var SzlcscSchema = external_exports.object({
|
|
10138
|
+
id: external_exports.number(),
|
|
10139
|
+
number: external_exports.string(),
|
|
10140
|
+
step: external_exports.number().optional(),
|
|
10141
|
+
min: external_exports.number().optional(),
|
|
10142
|
+
price: external_exports.number().optional(),
|
|
10143
|
+
stock: external_exports.number().optional(),
|
|
10144
|
+
url: external_exports.string().url().optional(),
|
|
10145
|
+
image: external_exports.string().optional().optional()
|
|
10146
|
+
});
|
|
10147
|
+
var LcscSchema = external_exports.object({
|
|
10148
|
+
id: external_exports.number(),
|
|
10149
|
+
number: external_exports.string(),
|
|
10150
|
+
step: external_exports.number().optional(),
|
|
10151
|
+
min: external_exports.number().optional(),
|
|
10152
|
+
price: external_exports.number().optional(),
|
|
10153
|
+
stock: external_exports.number().optional(),
|
|
10154
|
+
url: external_exports.string().url().optional()
|
|
10155
|
+
});
|
|
10156
|
+
var OwnerSchema = external_exports.object({
|
|
10157
|
+
uuid: external_exports.string(),
|
|
10158
|
+
username: external_exports.string(),
|
|
10159
|
+
nickname: external_exports.string(),
|
|
10160
|
+
avatar: external_exports.string()
|
|
10161
|
+
});
|
|
10162
|
+
var HeadSchema = external_exports.object({
|
|
10163
|
+
docType: external_exports.preprocess((val) => val == null ? val : String(val), external_exports.string()),
|
|
10164
|
+
editorVersion: external_exports.string(),
|
|
10165
|
+
c_para: external_exports.record(external_exports.string(), external_exports.string().nullable()),
|
|
10166
|
+
x: external_exports.number(),
|
|
10167
|
+
y: external_exports.number(),
|
|
10168
|
+
puuid: external_exports.string().optional(),
|
|
10169
|
+
uuid: external_exports.string(),
|
|
10170
|
+
utime: external_exports.preprocess((val) => {
|
|
10171
|
+
if (val === "") return 0;
|
|
10172
|
+
if (typeof val === "string") return Number(val);
|
|
10173
|
+
return val;
|
|
10174
|
+
}, external_exports.number()),
|
|
10175
|
+
importFlag: external_exports.number().optional(),
|
|
10176
|
+
c_spiceCmd: external_exports.any().optional(),
|
|
10177
|
+
hasIdFlag: external_exports.boolean()
|
|
10178
|
+
});
|
|
10179
|
+
var BBoxSchema = external_exports.object({
|
|
10180
|
+
x: external_exports.number(),
|
|
10181
|
+
y: external_exports.number(),
|
|
10182
|
+
width: external_exports.number(),
|
|
10183
|
+
height: external_exports.number()
|
|
10184
|
+
});
|
|
10185
|
+
var LayerItemSchema = external_exports.object({
|
|
10186
|
+
name: external_exports.string(),
|
|
10187
|
+
color: external_exports.string(),
|
|
10188
|
+
visible: external_exports.boolean(),
|
|
10189
|
+
active: external_exports.boolean(),
|
|
10190
|
+
config: external_exports.boolean(),
|
|
10191
|
+
transparency: external_exports.boolean()
|
|
10192
|
+
});
|
|
10193
|
+
var ObjectItemSchema = external_exports.object({
|
|
10194
|
+
name: external_exports.string(),
|
|
10195
|
+
visible: external_exports.boolean(),
|
|
10196
|
+
locked: external_exports.boolean()
|
|
10197
|
+
});
|
|
10198
|
+
var DataStrSchema = external_exports.object({
|
|
10199
|
+
head: HeadSchema,
|
|
10200
|
+
canvas: external_exports.string(),
|
|
10201
|
+
shape: external_exports.array(SingleLetterShapeSchema),
|
|
10202
|
+
BBox: BBoxSchema,
|
|
10203
|
+
colors: external_exports.union([external_exports.array(external_exports.string()), external_exports.record(external_exports.string())])
|
|
10204
|
+
});
|
|
10205
|
+
var PackageDetailDataStrSchema = external_exports.object({
|
|
10206
|
+
head: HeadSchema,
|
|
10207
|
+
canvas: external_exports.string(),
|
|
10208
|
+
shape: external_exports.array(external_exports.string()).transform(
|
|
10209
|
+
(shapes) => shapes.map((shape) => {
|
|
10210
|
+
const [type, ...data] = shape.split("~");
|
|
10211
|
+
return ShapeItemSchema.parse({ type, data: data.join("~") });
|
|
10212
|
+
})
|
|
10213
|
+
).pipe(external_exports.array(PackageDetailShapeSchema)),
|
|
10214
|
+
layers: external_exports.array(external_exports.string()).transform(
|
|
10215
|
+
(layers) => layers.map((layer) => {
|
|
10216
|
+
const [name, color, visible, active, config, transparency] = layer.split("~");
|
|
10217
|
+
return LayerItemSchema.parse({
|
|
10218
|
+
name,
|
|
10219
|
+
color,
|
|
10220
|
+
visible: visible === "true",
|
|
10221
|
+
active: active === "true",
|
|
10222
|
+
config: config === "true",
|
|
10223
|
+
transparency: transparency === "true"
|
|
10224
|
+
});
|
|
10225
|
+
})
|
|
10226
|
+
),
|
|
10227
|
+
objects: external_exports.array(external_exports.string()).transform(
|
|
10228
|
+
(objects) => objects.map((obj) => {
|
|
10229
|
+
const [name, visible, locked] = obj.split("~");
|
|
10230
|
+
return ObjectItemSchema.parse({
|
|
10231
|
+
name,
|
|
10232
|
+
visible: visible === "true",
|
|
10233
|
+
locked: locked === "true"
|
|
10234
|
+
});
|
|
10235
|
+
})
|
|
10236
|
+
),
|
|
10237
|
+
BBox: BBoxSchema,
|
|
10238
|
+
netColors: external_exports.array(external_exports.unknown()).optional()
|
|
10239
|
+
});
|
|
10240
|
+
var PackageDetailSchema = external_exports.object({
|
|
10241
|
+
uuid: external_exports.string(),
|
|
10242
|
+
title: external_exports.string(),
|
|
10243
|
+
docType: external_exports.number(),
|
|
10244
|
+
updateTime: external_exports.number(),
|
|
10245
|
+
owner: OwnerSchema,
|
|
10246
|
+
datastrid: external_exports.string(),
|
|
10247
|
+
writable: external_exports.boolean(),
|
|
10248
|
+
dataStr: PackageDetailDataStrSchema
|
|
10249
|
+
});
|
|
10250
|
+
var ModelBoundsSchema = external_exports.object({
|
|
10251
|
+
min: external_exports.object({
|
|
10252
|
+
x: external_exports.number(),
|
|
10253
|
+
y: external_exports.number(),
|
|
10254
|
+
z: external_exports.number()
|
|
10255
|
+
}),
|
|
10256
|
+
max: external_exports.object({
|
|
10257
|
+
x: external_exports.number(),
|
|
10258
|
+
y: external_exports.number(),
|
|
10259
|
+
z: external_exports.number()
|
|
10260
|
+
})
|
|
10261
|
+
});
|
|
10262
|
+
var EasyEdaJsonSchema = external_exports.object({
|
|
10263
|
+
uuid: external_exports.string(),
|
|
10264
|
+
title: external_exports.string(),
|
|
10265
|
+
description: external_exports.string(),
|
|
10266
|
+
docType: external_exports.number(),
|
|
10267
|
+
type: external_exports.number(),
|
|
10268
|
+
szlcsc: SzlcscSchema,
|
|
10269
|
+
lcsc: LcscSchema,
|
|
10270
|
+
owner: OwnerSchema,
|
|
10271
|
+
tags: external_exports.array(external_exports.string()),
|
|
10272
|
+
updateTime: external_exports.number(),
|
|
10273
|
+
updated_at: external_exports.string(),
|
|
10274
|
+
dataStr: DataStrSchema,
|
|
10275
|
+
verify: external_exports.boolean(),
|
|
10276
|
+
SMT: external_exports.boolean().optional(),
|
|
10277
|
+
datastrid: external_exports.string(),
|
|
10278
|
+
jlcOnSale: external_exports.number().optional(),
|
|
10279
|
+
writable: external_exports.boolean(),
|
|
10280
|
+
isFavorite: external_exports.boolean(),
|
|
10281
|
+
packageDetail: PackageDetailSchema,
|
|
10282
|
+
_objMetadata: external_exports.object({
|
|
10283
|
+
bounds: ModelBoundsSchema
|
|
10284
|
+
}).optional()
|
|
10285
|
+
});
|
|
10404
10286
|
|
|
10405
10287
|
// lib/utils/normalize-manufacturer-part-number.ts
|
|
10406
10288
|
function normalizeManufacturerPartNumber(partNumber) {
|
|
@@ -10412,12 +10294,19 @@ function normalizeManufacturerPartNumber(partNumber) {
|
|
|
10412
10294
|
}
|
|
10413
10295
|
|
|
10414
10296
|
// lib/websafe/get-model-cdn-url.ts
|
|
10415
|
-
var
|
|
10297
|
+
var getModelObjCdnUrl = ({
|
|
10298
|
+
easyedaModelUuid,
|
|
10299
|
+
easyedaPartNumber
|
|
10300
|
+
}) => {
|
|
10301
|
+
return `https://modelcdn.tscircuit.com/easyeda_models/assets/${easyedaPartNumber}.obj?uuid=${easyedaModelUuid}`;
|
|
10302
|
+
};
|
|
10303
|
+
var getModelStepCdnUrl = ({
|
|
10416
10304
|
easyedaModelUuid,
|
|
10417
10305
|
easyedaPartNumber
|
|
10418
10306
|
}) => {
|
|
10419
|
-
return `https://modelcdn.tscircuit.com/easyeda_models/
|
|
10307
|
+
return `https://modelcdn.tscircuit.com/easyeda_models/assets/${easyedaPartNumber}.step?uuid=${easyedaModelUuid}`;
|
|
10420
10308
|
};
|
|
10309
|
+
var getModelCdnUrl = getModelObjCdnUrl;
|
|
10421
10310
|
|
|
10422
10311
|
// lib/websafe/get-easyeda-cad-model-placement.ts
|
|
10423
10312
|
var placementCache = /* @__PURE__ */ new Map();
|
|
@@ -10477,7 +10366,11 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
10477
10366
|
if (!modelUuid || !partNumber || svgNodeZOffsetMm == null || !fetch2) {
|
|
10478
10367
|
return null;
|
|
10479
10368
|
}
|
|
10480
|
-
const modelObjUrl =
|
|
10369
|
+
const modelObjUrl = getModelObjCdnUrl({
|
|
10370
|
+
easyedaModelUuid: modelUuid,
|
|
10371
|
+
easyedaPartNumber: partNumber
|
|
10372
|
+
});
|
|
10373
|
+
const modelStepUrl = getModelStepCdnUrl({
|
|
10481
10374
|
easyedaModelUuid: modelUuid,
|
|
10482
10375
|
easyedaPartNumber: partNumber
|
|
10483
10376
|
});
|
|
@@ -10485,6 +10378,7 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
10485
10378
|
if (metadataBounds) {
|
|
10486
10379
|
return {
|
|
10487
10380
|
modelObjUrl,
|
|
10381
|
+
modelStepUrl,
|
|
10488
10382
|
bounds: metadataBounds,
|
|
10489
10383
|
positionZMm: getPositionZMmFromBounds(metadataBounds, svgNodeZOffsetMm)
|
|
10490
10384
|
};
|
|
@@ -10501,6 +10395,7 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
10501
10395
|
if (!bounds) return null;
|
|
10502
10396
|
return {
|
|
10503
10397
|
modelObjUrl,
|
|
10398
|
+
modelStepUrl,
|
|
10504
10399
|
bounds,
|
|
10505
10400
|
// Align the EasyEDA SVG-node Z against the model's minimum Z.
|
|
10506
10401
|
positionZMm: getPositionZMmFromBounds(bounds, svgNodeZOffsetMm)
|
|
@@ -10517,8 +10412,138 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
10517
10412
|
return placementPromise;
|
|
10518
10413
|
};
|
|
10519
10414
|
|
|
10415
|
+
// lib/websafe/generate-footprint-tsx.ts
|
|
10416
|
+
var generateFootprintTsx = (circuitJson) => {
|
|
10417
|
+
const holes = su(circuitJson).pcb_hole.list();
|
|
10418
|
+
const platedHoles = su(circuitJson).pcb_plated_hole.list();
|
|
10419
|
+
const smtPads = su(circuitJson).pcb_smtpad.list();
|
|
10420
|
+
const vias = su(circuitJson).pcb_via.list();
|
|
10421
|
+
const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
|
|
10422
|
+
const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
|
|
10423
|
+
const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
|
|
10424
|
+
const elementStrings = [];
|
|
10425
|
+
for (const hole of holes) {
|
|
10426
|
+
if (hole.hole_shape === "circle") {
|
|
10427
|
+
elementStrings.push(
|
|
10428
|
+
`<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" diameter="${mmStr(hole.hole_diameter)}" />`
|
|
10429
|
+
);
|
|
10430
|
+
} else if (hole.hole_shape === "oval") {
|
|
10431
|
+
console.warn("Unhandled oval hole in conversion (needs implementation)");
|
|
10432
|
+
}
|
|
10433
|
+
}
|
|
10434
|
+
for (const platedHole of platedHoles) {
|
|
10435
|
+
if (platedHole.shape === "pill_hole_with_rect_pad") {
|
|
10436
|
+
elementStrings.push(
|
|
10437
|
+
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.rect_pad_width)}" outerHeight="${mmStr(platedHole.rect_pad_height)}" shape="pill" />`
|
|
10438
|
+
);
|
|
10439
|
+
} else if (platedHole.shape === "circle") {
|
|
10440
|
+
elementStrings.push(
|
|
10441
|
+
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" outerDiameter="${mmStr(platedHole.outer_diameter)}" holeDiameter="${mmStr(platedHole.hole_diameter)}" shape="circle" />`
|
|
10442
|
+
);
|
|
10443
|
+
} else if (platedHole.shape === "rotated_pill_hole_with_rect_pad") {
|
|
10444
|
+
const rotation2 = platedHole.hole_ccw_rotation || 0;
|
|
10445
|
+
elementStrings.push(
|
|
10446
|
+
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.rect_pad_width)}" outerHeight="${mmStr(platedHole.rect_pad_height)}" rectPad={true} pcbRotation="${rotation2}deg" shape="pill" />`
|
|
10447
|
+
);
|
|
10448
|
+
}
|
|
10449
|
+
}
|
|
10450
|
+
for (const smtPad of smtPads) {
|
|
10451
|
+
if (smtPad.shape === "circle") {
|
|
10452
|
+
elementStrings.push(
|
|
10453
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" radius="${mmStr(smtPad.radius)}" shape="circle" />`
|
|
10454
|
+
);
|
|
10455
|
+
} else if (smtPad.shape === "rect") {
|
|
10456
|
+
elementStrings.push(
|
|
10457
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" shape="rect" />`
|
|
10458
|
+
);
|
|
10459
|
+
} else if (smtPad.shape === "polygon") {
|
|
10460
|
+
const pointsStr = smtPad.points.map((p) => `{x: "${mmStr(p.x)}", y: "${mmStr(p.y)}"}`).join(", ");
|
|
10461
|
+
elementStrings.push(
|
|
10462
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} points={[${pointsStr}]} shape="polygon" />`
|
|
10463
|
+
);
|
|
10464
|
+
}
|
|
10465
|
+
}
|
|
10466
|
+
for (const via of vias) {
|
|
10467
|
+
elementStrings.push(
|
|
10468
|
+
`<via pcbX="${mmStr(via.x)}" pcbY="${mmStr(via.y)}" outerDiameter="${mmStr(via.outer_diameter)}" holeDiameter="${mmStr(via.hole_diameter)}" layers={${JSON.stringify(via.layers)}} />`
|
|
10469
|
+
);
|
|
10470
|
+
}
|
|
10471
|
+
for (const silkscreenPath of silkscreenPaths) {
|
|
10472
|
+
elementStrings.push(
|
|
10473
|
+
`<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
|
|
10474
|
+
);
|
|
10475
|
+
}
|
|
10476
|
+
for (const silkscreenText of silkscreenTexts) {
|
|
10477
|
+
elementStrings.push(
|
|
10478
|
+
`<silkscreentext text="${silkscreenText.text}" pcbX="${mmStr(silkscreenText.anchor_position.x)}" pcbY="${mmStr(silkscreenText.anchor_position.y)}" anchorAlignment="${silkscreenText.anchor_alignment}" ${silkscreenText.font_size ? `fontSize="${mmStr(silkscreenText.font_size)}"` : ""} />`
|
|
10479
|
+
);
|
|
10480
|
+
}
|
|
10481
|
+
for (const courtyardOutline of courtyardOutlines) {
|
|
10482
|
+
elementStrings.push(
|
|
10483
|
+
`<courtyardoutline outline={${JSON.stringify(courtyardOutline.outline)}} />`
|
|
10484
|
+
);
|
|
10485
|
+
}
|
|
10486
|
+
return `
|
|
10487
|
+
<footprint>
|
|
10488
|
+
${elementStrings.join("\n")}
|
|
10489
|
+
</footprint>
|
|
10490
|
+
`.trim();
|
|
10491
|
+
};
|
|
10492
|
+
|
|
10493
|
+
// lib/websafe/convert-to-typescript-component/generate-typescript-component.ts
|
|
10494
|
+
var generateTypescriptComponent = ({
|
|
10495
|
+
pinLabels,
|
|
10496
|
+
componentName,
|
|
10497
|
+
objUrl,
|
|
10498
|
+
stepUrl,
|
|
10499
|
+
circuitJson,
|
|
10500
|
+
supplierPartNumbers,
|
|
10501
|
+
manufacturerPartNumber
|
|
10502
|
+
}) => {
|
|
10503
|
+
const safePinLabels = pinLabels ?? {};
|
|
10504
|
+
const cadComponent = circuitJson.find((item) => item.type === "cad_component");
|
|
10505
|
+
const footprintTsx = generateFootprintTsx(circuitJson);
|
|
10506
|
+
const simplifiedPinLabels = Object.fromEntries(
|
|
10507
|
+
Object.entries(safePinLabels).map(([pin, labels]) => {
|
|
10508
|
+
if (Array.isArray(labels) && labels.length > 1) {
|
|
10509
|
+
return [pin, [labels[1]]];
|
|
10510
|
+
}
|
|
10511
|
+
return [pin, labels];
|
|
10512
|
+
})
|
|
10513
|
+
);
|
|
10514
|
+
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
10515
|
+
const cadModelLines = [
|
|
10516
|
+
objUrl ? `objUrl: "${objUrl}",` : "",
|
|
10517
|
+
stepUrl ? `stepUrl: "${stepUrl}",` : "",
|
|
10518
|
+
`pcbRotationOffset: ${cadComponent?.rotation?.z ?? 0},`,
|
|
10519
|
+
`modelOriginPosition: { x: ${cadComponent?.model_origin_position?.x ?? 0}, y: ${cadComponent?.model_origin_position?.y ?? 0}, z: ${cadComponent?.model_origin_position?.z ?? 0} },`
|
|
10520
|
+
].filter(Boolean).map((line) => ` ${line}`).join("\n");
|
|
10521
|
+
return `
|
|
10522
|
+
import type { ChipProps } from "@tscircuit/props"
|
|
10523
|
+
|
|
10524
|
+
const pinLabels = {
|
|
10525
|
+
${pinLabelsString}
|
|
10526
|
+
} as const
|
|
10527
|
+
|
|
10528
|
+
export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
10529
|
+
return (
|
|
10530
|
+
<chip
|
|
10531
|
+
pinLabels={pinLabels}
|
|
10532
|
+
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
10533
|
+
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
10534
|
+
footprint={${footprintTsx}}
|
|
10535
|
+
${objUrl || stepUrl ? `cadModel={{
|
|
10536
|
+
${cadModelLines}
|
|
10537
|
+
}}` : ""}
|
|
10538
|
+
{...props}
|
|
10539
|
+
/>
|
|
10540
|
+
)
|
|
10541
|
+
}
|
|
10542
|
+
`.trim();
|
|
10543
|
+
};
|
|
10544
|
+
|
|
10520
10545
|
// lib/websafe/convert-to-typescript-component/index.tsx
|
|
10521
|
-
var convertRawEasyToTsx = async (rawEasy) => {
|
|
10546
|
+
var convertRawEasyToTsx = async ({ rawEasy }) => {
|
|
10522
10547
|
const betterEasy = EasyEdaJsonSchema.parse(rawEasy);
|
|
10523
10548
|
const result = await convertBetterEasyToTsx({
|
|
10524
10549
|
betterEasy
|
|
@@ -10555,14 +10580,17 @@ var convertBetterEasyToTsx = async ({
|
|
|
10555
10580
|
];
|
|
10556
10581
|
}
|
|
10557
10582
|
let modelObjUrl;
|
|
10583
|
+
let modelStepUrl;
|
|
10558
10584
|
if (cadPlacement?.modelObjUrl) {
|
|
10559
10585
|
modelObjUrl = cadPlacement.modelObjUrl;
|
|
10586
|
+
modelStepUrl = cadPlacement.modelStepUrl;
|
|
10560
10587
|
} else if (cadComponent?.model_obj_url) {
|
|
10561
10588
|
const isValidUrl = await checkModelObjUrlValidity(
|
|
10562
10589
|
cadComponent.model_obj_url
|
|
10563
10590
|
);
|
|
10564
10591
|
if (isValidUrl) {
|
|
10565
10592
|
modelObjUrl = cadComponent.model_obj_url;
|
|
10593
|
+
modelStepUrl = cadComponent.model_step_url;
|
|
10566
10594
|
}
|
|
10567
10595
|
}
|
|
10568
10596
|
const supplierPartNumbers = {
|
|
@@ -10573,6 +10601,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
10573
10601
|
manufacturerPartNumber: pn,
|
|
10574
10602
|
pinLabels,
|
|
10575
10603
|
objUrl: modelObjUrl,
|
|
10604
|
+
stepUrl: modelStepUrl,
|
|
10576
10605
|
circuitJson,
|
|
10577
10606
|
supplierPartNumbers
|
|
10578
10607
|
});
|
|
@@ -10601,7 +10630,6 @@ var getModelUuidFromRawPackageDetail = (result) => {
|
|
|
10601
10630
|
return modelUuid;
|
|
10602
10631
|
}
|
|
10603
10632
|
} catch {
|
|
10604
|
-
continue;
|
|
10605
10633
|
}
|
|
10606
10634
|
}
|
|
10607
10635
|
return null;
|
|
@@ -10722,6 +10750,8 @@ export {
|
|
|
10722
10750
|
convertRawEasyToTsx,
|
|
10723
10751
|
fetchEasyEDAComponent,
|
|
10724
10752
|
generateFootprintTsx,
|
|
10725
|
-
getModelCdnUrl
|
|
10753
|
+
getModelCdnUrl,
|
|
10754
|
+
getModelObjCdnUrl,
|
|
10755
|
+
getModelStepCdnUrl
|
|
10726
10756
|
};
|
|
10727
10757
|
//# sourceMappingURL=index.js.map
|