circuit-json 0.0.75 → 0.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js DELETED
@@ -1,1153 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- all_layers: () => all_layers,
34
- any_circuit_element: () => any_circuit_element,
35
- any_soup_element: () => any_soup_element,
36
- any_source_component: () => any_source_component,
37
- cad_component: () => cad_component,
38
- capacitance: () => capacitance,
39
- current: () => current,
40
- distance: () => distance,
41
- getZodPrefixedIdWithDefault: () => getZodPrefixedIdWithDefault,
42
- inductance: () => inductance,
43
- layer_ref: () => layer_ref,
44
- layer_string: () => layer_string,
45
- length: () => length,
46
- pcb_board: () => pcb_board,
47
- pcb_component: () => pcb_component,
48
- pcb_fabrication_note_path: () => pcb_fabrication_note_path,
49
- pcb_fabrication_note_text: () => pcb_fabrication_note_text,
50
- pcb_hole: () => pcb_hole,
51
- pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
52
- pcb_hole_oval_shape: () => pcb_hole_oval_shape,
53
- pcb_keepout: () => pcb_keepout,
54
- pcb_placement_error: () => pcb_placement_error,
55
- pcb_plated_hole: () => pcb_plated_hole,
56
- pcb_port: () => pcb_port,
57
- pcb_port_not_matched_error: () => pcb_port_not_matched_error,
58
- pcb_route_hint: () => pcb_route_hint,
59
- pcb_route_hints: () => pcb_route_hints,
60
- pcb_silkscreen_circle: () => pcb_silkscreen_circle,
61
- pcb_silkscreen_line: () => pcb_silkscreen_line,
62
- pcb_silkscreen_oval: () => pcb_silkscreen_oval,
63
- pcb_silkscreen_path: () => pcb_silkscreen_path,
64
- pcb_silkscreen_rect: () => pcb_silkscreen_rect,
65
- pcb_silkscreen_text: () => pcb_silkscreen_text,
66
- pcb_smtpad: () => pcb_smtpad,
67
- pcb_text: () => pcb_text,
68
- pcb_trace: () => pcb_trace,
69
- pcb_trace_error: () => pcb_trace_error,
70
- pcb_trace_hint: () => pcb_trace_hint,
71
- pcb_trace_route_point: () => pcb_trace_route_point,
72
- pcb_trace_route_point_via: () => pcb_trace_route_point_via,
73
- pcb_trace_route_point_wire: () => pcb_trace_route_point_wire,
74
- pcb_via: () => pcb_via,
75
- point: () => point,
76
- point3: () => point3,
77
- position: () => position,
78
- position3: () => position3,
79
- resistance: () => resistance,
80
- rotation: () => rotation,
81
- route_hint_point: () => route_hint_point,
82
- schematic_box: () => schematic_box,
83
- schematic_component: () => schematic_component,
84
- schematic_error: () => schematic_error,
85
- schematic_line: () => schematic_line,
86
- schematic_net_label: () => schematic_net_label,
87
- schematic_path: () => schematic_path,
88
- schematic_pin_styles: () => schematic_pin_styles,
89
- schematic_port: () => schematic_port,
90
- schematic_text: () => schematic_text,
91
- schematic_trace: () => schematic_trace,
92
- size: () => size,
93
- source_component_base: () => source_component_base,
94
- source_group: () => source_group,
95
- source_led: () => source_led,
96
- source_net: () => source_net,
97
- source_port: () => source_port,
98
- source_simple_bug: () => source_simple_bug,
99
- source_simple_capacitor: () => source_simple_capacitor,
100
- source_simple_chip: () => source_simple_chip,
101
- source_simple_diode: () => source_simple_diode,
102
- source_simple_ground: () => source_simple_ground,
103
- source_simple_power_source: () => source_simple_power_source,
104
- source_simple_resistor: () => source_simple_resistor,
105
- source_trace: () => source_trace,
106
- supplier_name: () => supplier_name,
107
- time: () => time,
108
- visible_layer: () => visible_layer,
109
- voltage: () => voltage
110
- });
111
- module.exports = __toCommonJS(src_exports);
112
-
113
- // src/utils/convert-si-unit-to-number.ts
114
- var import_convert_units = __toESM(require("convert-units"));
115
- var si_prefix_multiplier = {
116
- tera: 1e13,
117
- T: 1e13,
118
- giga: 1e10,
119
- G: 1e10,
120
- mega: 1e7,
121
- M: 1e7,
122
- kilo: 1e4,
123
- k: 1e4,
124
- deci: 1,
125
- d: 1,
126
- centi: 0.1,
127
- c: 0.1,
128
- milli: 0.01,
129
- m: 0.01,
130
- micro: 1e-5,
131
- u: 1e-5,
132
- \u00B5: 1e-5,
133
- nano: 1e-8,
134
- n: 1e-8,
135
- pico: 1e-11,
136
- p: 1e-11
137
- };
138
- var si_prefixes = Object.keys(si_prefix_multiplier);
139
- var target_conversion = {
140
- mass: "g",
141
- length: "mm",
142
- time: "ms",
143
- volume: "ml",
144
- angle: "deg"
145
- };
146
- function getSiPrefixMultiplierFromUnit(v) {
147
- for (const prefix of si_prefixes) {
148
- if (v.startsWith(prefix)) {
149
- return si_prefix_multiplier[prefix];
150
- }
151
- }
152
- return 1;
153
- }
154
- var parseAndConvertSiUnit = (v) => {
155
- if (typeof v === "undefined")
156
- return { unit: null, value: null };
157
- if (typeof v === "string" && v.match(/^[\d\.]+$/))
158
- return { value: parseFloat(v), unit: null };
159
- if (typeof v === "number")
160
- return { value: v, unit: null };
161
- if (typeof v === "object" && "x" in v && "y" in v) {
162
- return {
163
- unit: parseAndConvertSiUnit(v.x).unit,
164
- value: {
165
- x: parseAndConvertSiUnit(v.x).value,
166
- y: parseAndConvertSiUnit(v.y).value
167
- }
168
- };
169
- }
170
- const unit_reversed = v.split("").reverse().join("").match(/[a-zA-Z]+/)?.[0];
171
- if (!unit_reversed) {
172
- throw new Error(`Could not determine unit: "${v}"`);
173
- }
174
- const unit = unit_reversed.split("").reverse().join("");
175
- const value = v.slice(0, -unit.length);
176
- let measure;
177
- try {
178
- measure = (0, import_convert_units.default)().describe(unit)?.measure;
179
- } catch (e) {
180
- }
181
- if (measure) {
182
- const target_unit = target_conversion[measure];
183
- if (!target_unit) {
184
- throw new Error(
185
- `Could not determine target unit for measure: "${measure}"`
186
- );
187
- }
188
- return {
189
- unit,
190
- value: (0, import_convert_units.default)(parseFloat(value)).from(unit).to(target_unit)
191
- };
192
- } else {
193
- return {
194
- unit,
195
- value: getSiPrefixMultiplierFromUnit(unit) * parseFloat(value)
196
- };
197
- }
198
- };
199
-
200
- // src/units/index.ts
201
- var import_zod = require("zod");
202
- var resistance = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
203
- var capacitance = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
204
- var inductance = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
205
- var voltage = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
206
- var length = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
207
- var distance = length;
208
- var current = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
209
- var time = import_zod.z.string().or(import_zod.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
210
- var rotation = import_zod.z.string().or(import_zod.z.number()).transform((arg) => {
211
- if (typeof arg === "number")
212
- return arg;
213
- if (arg.endsWith("deg")) {
214
- return Number.parseFloat(arg.split("deg")[0]);
215
- }
216
- if (arg.endsWith("rad")) {
217
- return Number.parseFloat(arg.split("rad")[0]) * 180 / Math.PI;
218
- }
219
- return Number.parseFloat(arg);
220
- });
221
-
222
- // src/common/point.ts
223
- var import_zod2 = require("zod");
224
- var point = import_zod2.z.object({
225
- x: distance,
226
- y: distance
227
- });
228
- var position = point;
229
-
230
- // src/common/point3.ts
231
- var import_zod3 = require("zod");
232
- var point3 = import_zod3.z.object({
233
- x: distance,
234
- y: distance,
235
- z: distance
236
- });
237
- var position3 = point3;
238
-
239
- // src/common/size.ts
240
- var import_zod4 = require("zod");
241
- var size = import_zod4.z.object({
242
- width: import_zod4.z.number(),
243
- height: import_zod4.z.number()
244
- });
245
-
246
- // src/common/getZodPrefixedIdWithDefault.ts
247
- var import_zod5 = require("zod");
248
- var import_nanoid = require("nanoid");
249
- var getZodPrefixedIdWithDefault = (prefix) => {
250
- return import_zod5.z.string().optional().default(() => `${prefix}_${(0, import_nanoid.nanoid)(10)}`);
251
- };
252
-
253
- // src/source/source_simple_capacitor.ts
254
- var import_zod8 = require("zod");
255
-
256
- // src/pcb/properties/supplier_name.ts
257
- var import_zod6 = require("zod");
258
- var supplier_name = import_zod6.z.enum([
259
- "jlcpcb",
260
- "macrofab",
261
- "pcbway",
262
- "digikey",
263
- "mouser",
264
- "lcsc"
265
- ]);
266
-
267
- // src/source/base/source_component_base.ts
268
- var import_zod7 = require("zod");
269
- var source_component_base = import_zod7.z.object({
270
- type: import_zod7.z.literal("source_component"),
271
- ftype: import_zod7.z.string().optional(),
272
- source_component_id: import_zod7.z.string(),
273
- name: import_zod7.z.string(),
274
- manufacturer_part_number: import_zod7.z.string().optional(),
275
- supplier_part_numbers: import_zod7.z.record(supplier_name, import_zod7.z.array(import_zod7.z.string())).optional()
276
- });
277
-
278
- // src/source/source_simple_capacitor.ts
279
- var source_simple_capacitor = source_component_base.extend({
280
- ftype: import_zod8.z.literal("simple_capacitor"),
281
- capacitance
282
- });
283
-
284
- // src/source/source_simple_resistor.ts
285
- var import_zod9 = require("zod");
286
- var source_simple_resistor = source_component_base.extend({
287
- ftype: import_zod9.z.literal("simple_resistor"),
288
- resistance
289
- });
290
-
291
- // src/source/source_simple_diode.ts
292
- var import_zod10 = require("zod");
293
- var source_simple_diode = source_component_base.extend({
294
- ftype: import_zod10.z.literal("simple_diode")
295
- });
296
-
297
- // src/source/source_simple_ground.ts
298
- var import_zod11 = require("zod");
299
- var source_simple_ground = source_component_base.extend({
300
- ftype: import_zod11.z.literal("simple_ground")
301
- });
302
-
303
- // src/source/source_simple_bug.ts
304
- var import_zod12 = require("zod");
305
- var source_simple_bug = source_component_base.extend({
306
- ftype: import_zod12.z.literal("simple_bug")
307
- }).describe("@deprecated");
308
-
309
- // src/source/source_simple_chip.ts
310
- var import_zod13 = require("zod");
311
- var source_simple_chip = source_component_base.extend({
312
- ftype: import_zod13.z.literal("simple_chip")
313
- });
314
-
315
- // src/source/source_simple_inductor.ts
316
- var import_zod14 = require("zod");
317
- var source_simple_inductor = source_component_base.extend({
318
- ftype: import_zod14.z.literal("simple_inductor"),
319
- inductance
320
- });
321
-
322
- // src/source/source_led.ts
323
- var import_zod15 = require("zod");
324
- var source_led = source_simple_diode.extend({
325
- ftype: import_zod15.z.literal("led")
326
- });
327
-
328
- // src/source/source_simple_power_source.ts
329
- var import_zod16 = require("zod");
330
- var source_simple_power_source = source_component_base.extend({
331
- ftype: import_zod16.z.literal("simple_power_source"),
332
- voltage
333
- });
334
-
335
- // src/source/any_source_component.ts
336
- var import_zod17 = require("zod");
337
- var any_source_component = import_zod17.z.union([
338
- source_simple_resistor,
339
- source_simple_capacitor,
340
- source_simple_diode,
341
- source_simple_ground,
342
- source_simple_chip,
343
- source_simple_bug,
344
- source_led,
345
- source_simple_power_source
346
- ]);
347
-
348
- // src/source/source_port.ts
349
- var import_zod18 = require("zod");
350
- var source_port = import_zod18.z.object({
351
- type: import_zod18.z.literal("source_port"),
352
- pin_number: import_zod18.z.number().optional(),
353
- port_hints: import_zod18.z.array(import_zod18.z.string()).optional(),
354
- name: import_zod18.z.string(),
355
- source_port_id: import_zod18.z.string(),
356
- source_component_id: import_zod18.z.string()
357
- });
358
-
359
- // src/source/source_trace.ts
360
- var import_zod19 = require("zod");
361
- var source_trace = import_zod19.z.object({
362
- type: import_zod19.z.literal("source_trace"),
363
- source_trace_id: import_zod19.z.string(),
364
- connected_source_port_ids: import_zod19.z.array(import_zod19.z.string()),
365
- connected_source_net_ids: import_zod19.z.array(import_zod19.z.string())
366
- });
367
-
368
- // src/source/source_group.ts
369
- var import_zod20 = require("zod");
370
- var source_group = import_zod20.z.object({
371
- type: import_zod20.z.literal("source_group"),
372
- source_group_id: import_zod20.z.string(),
373
- name: import_zod20.z.string().optional()
374
- });
375
-
376
- // src/source/source_net.ts
377
- var import_zod21 = require("zod");
378
- var source_net = import_zod21.z.object({
379
- type: import_zod21.z.literal("source_net"),
380
- source_net_id: import_zod21.z.string(),
381
- name: import_zod21.z.string(),
382
- member_source_group_ids: import_zod21.z.array(import_zod21.z.string()),
383
- is_power: import_zod21.z.boolean().optional(),
384
- is_ground: import_zod21.z.boolean().optional(),
385
- is_digital_signal: import_zod21.z.boolean().optional(),
386
- is_analog_signal: import_zod21.z.boolean().optional(),
387
- trace_width: import_zod21.z.number().optional()
388
- });
389
-
390
- // src/schematic/schematic_box.ts
391
- var import_zod22 = require("zod");
392
- var schematic_box = import_zod22.z.object({
393
- type: import_zod22.z.literal("schematic_box"),
394
- schematic_component_id: import_zod22.z.string(),
395
- width: distance,
396
- height: distance,
397
- x: distance,
398
- y: distance
399
- }).describe("Draws a box on the schematic");
400
-
401
- // src/schematic/schematic_path.ts
402
- var import_zod23 = require("zod");
403
- var schematic_path = import_zod23.z.object({
404
- type: import_zod23.z.literal("schematic_path"),
405
- schematic_component_id: import_zod23.z.string(),
406
- fill_color: import_zod23.z.enum(["red", "blue"]).optional(),
407
- is_filled: import_zod23.z.boolean().optional(),
408
- points: import_zod23.z.array(point)
409
- });
410
-
411
- // src/schematic/schematic_component.ts
412
- var import_zod24 = require("zod");
413
- var schematic_pin_styles = import_zod24.z.record(
414
- import_zod24.z.object({
415
- left_margin: length.optional(),
416
- right_margin: length.optional(),
417
- top_margin: length.optional(),
418
- bottom_margin: length.optional()
419
- })
420
- );
421
- var schematic_component = import_zod24.z.object({
422
- type: import_zod24.z.literal("schematic_component"),
423
- rotation: rotation.default(0),
424
- size,
425
- center: point,
426
- source_component_id: import_zod24.z.string(),
427
- schematic_component_id: import_zod24.z.string(),
428
- pin_spacing: length.optional(),
429
- pin_styles: schematic_pin_styles.optional(),
430
- box_width: length.optional(),
431
- symbol_name: import_zod24.z.string().optional(),
432
- port_arrangement: import_zod24.z.union([
433
- import_zod24.z.object({
434
- left_size: import_zod24.z.number(),
435
- right_size: import_zod24.z.number(),
436
- top_size: import_zod24.z.number().optional(),
437
- bottom_size: import_zod24.z.number().optional()
438
- }),
439
- import_zod24.z.object({
440
- left_side: import_zod24.z.object({
441
- pins: import_zod24.z.array(import_zod24.z.number()),
442
- direction: import_zod24.z.enum(["top-to-bottom", "bottom-to-top"]).optional()
443
- }).optional(),
444
- right_side: import_zod24.z.object({
445
- pins: import_zod24.z.array(import_zod24.z.number()),
446
- direction: import_zod24.z.enum(["top-to-bottom", "bottom-to-top"]).optional()
447
- }).optional(),
448
- top_side: import_zod24.z.object({
449
- pins: import_zod24.z.array(import_zod24.z.number()),
450
- direction: import_zod24.z.enum(["left-to-right", "right-to-left"]).optional()
451
- }).optional(),
452
- bottom_side: import_zod24.z.object({
453
- pins: import_zod24.z.array(import_zod24.z.number()),
454
- direction: import_zod24.z.enum(["left-to-right", "right-to-left"]).optional()
455
- }).optional()
456
- })
457
- ]).optional(),
458
- port_labels: import_zod24.z.record(import_zod24.z.string()).optional()
459
- });
460
-
461
- // src/schematic/schematic_line.ts
462
- var import_zod25 = require("zod");
463
- var schematic_line = import_zod25.z.object({
464
- type: import_zod25.z.literal("schematic_line"),
465
- schematic_component_id: import_zod25.z.string(),
466
- x1: distance,
467
- x2: distance,
468
- y1: distance,
469
- y2: distance
470
- });
471
-
472
- // src/schematic/schematic_trace.ts
473
- var import_zod26 = require("zod");
474
- var schematic_trace = import_zod26.z.object({
475
- type: import_zod26.z.literal("schematic_trace"),
476
- schematic_trace_id: import_zod26.z.string(),
477
- source_trace_id: import_zod26.z.string(),
478
- edges: import_zod26.z.array(
479
- import_zod26.z.object({
480
- from: import_zod26.z.object({
481
- x: import_zod26.z.number(),
482
- y: import_zod26.z.number()
483
- }),
484
- to: import_zod26.z.object({
485
- x: import_zod26.z.number(),
486
- y: import_zod26.z.number()
487
- }),
488
- from_schematic_port_id: import_zod26.z.string().optional(),
489
- to_schematic_port_id: import_zod26.z.string().optional()
490
- })
491
- )
492
- });
493
-
494
- // src/schematic/schematic_text.ts
495
- var import_zod27 = require("zod");
496
- var schematic_text = import_zod27.z.object({
497
- type: import_zod27.z.literal("schematic_text"),
498
- schematic_component_id: import_zod27.z.string(),
499
- schematic_text_id: import_zod27.z.string(),
500
- text: import_zod27.z.string(),
501
- position: import_zod27.z.object({
502
- x: distance,
503
- y: distance
504
- }),
505
- rotation: import_zod27.z.number().default(0),
506
- anchor: import_zod27.z.enum(["center", "left", "right", "top", "bottom"]).default("center")
507
- });
508
-
509
- // src/schematic/schematic_port.ts
510
- var import_zod28 = require("zod");
511
- var schematic_port = import_zod28.z.object({
512
- type: import_zod28.z.literal("schematic_port"),
513
- schematic_port_id: import_zod28.z.string(),
514
- source_port_id: import_zod28.z.string(),
515
- schematic_component_id: import_zod28.z.string().optional(),
516
- center: point,
517
- facing_direction: import_zod28.z.enum(["up", "down", "left", "right"]).optional()
518
- }).describe("Defines a port on a schematic component");
519
-
520
- // src/schematic/schematic_net_label.ts
521
- var import_zod29 = require("zod");
522
- var schematic_net_label = import_zod29.z.object({
523
- type: import_zod29.z.literal("schematic_net_label"),
524
- source_net_id: import_zod29.z.string(),
525
- center: point,
526
- anchor_side: import_zod29.z.enum(["top", "bottom", "left", "right"]),
527
- text: import_zod29.z.string()
528
- });
529
-
530
- // src/schematic/schematic_error.ts
531
- var import_zod30 = require("zod");
532
- var schematic_error = import_zod30.z.object({
533
- schematic_error_id: import_zod30.z.string(),
534
- type: import_zod30.z.literal("schematic_error"),
535
- // eventually each error type should be broken out into a dir of files
536
- error_type: import_zod30.z.literal("schematic_port_not_found"),
537
- message: import_zod30.z.string()
538
- }).describe("Defines a schematic error on the schematic");
539
-
540
- // src/pcb/properties/layer_ref.ts
541
- var import_zod31 = require("zod");
542
- var all_layers = [
543
- "top",
544
- "bottom",
545
- "inner1",
546
- "inner2",
547
- "inner3",
548
- "inner4",
549
- "inner5",
550
- "inner6"
551
- ];
552
- var layer_string = import_zod31.z.enum(all_layers);
553
- var layer_ref = layer_string.or(
554
- import_zod31.z.object({
555
- name: layer_string
556
- })
557
- ).transform((layer) => {
558
- if (typeof layer === "string") {
559
- return layer;
560
- }
561
- return layer.name;
562
- });
563
- var visible_layer = import_zod31.z.enum(["top", "bottom"]);
564
-
565
- // src/pcb/properties/pcb_route_hints.ts
566
- var import_zod32 = require("zod");
567
- var pcb_route_hint = import_zod32.z.object({
568
- x: distance,
569
- y: distance,
570
- via: import_zod32.z.boolean().optional(),
571
- via_to_layer: layer_ref.optional()
572
- });
573
- var pcb_route_hints = import_zod32.z.array(pcb_route_hint);
574
-
575
- // src/pcb/properties/route_hint_point.ts
576
- var import_zod33 = require("zod");
577
- var route_hint_point = import_zod33.z.object({
578
- x: distance,
579
- y: distance,
580
- via: import_zod33.z.boolean().optional(),
581
- to_layer: layer_ref.optional(),
582
- trace_width: distance.optional()
583
- });
584
-
585
- // src/pcb/pcb_component.ts
586
- var import_zod34 = require("zod");
587
-
588
- // src/utils/expect-types-match.ts
589
- var expectTypesMatch = (shouldBe) => {
590
- };
591
-
592
- // src/pcb/pcb_component.ts
593
- var pcb_component = import_zod34.z.object({
594
- type: import_zod34.z.literal("pcb_component"),
595
- pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
596
- source_component_id: import_zod34.z.string(),
597
- center: point,
598
- layer: layer_ref,
599
- rotation,
600
- width: length,
601
- height: length
602
- }).describe("Defines a component on the PCB");
603
- expectTypesMatch(true);
604
-
605
- // src/pcb/pcb_hole.ts
606
- var import_zod35 = require("zod");
607
- var pcb_hole_circle_or_square = import_zod35.z.object({
608
- type: import_zod35.z.literal("pcb_hole"),
609
- pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
610
- hole_shape: import_zod35.z.enum(["circle", "square"]),
611
- hole_diameter: import_zod35.z.number(),
612
- x: distance,
613
- y: distance
614
- });
615
- var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
616
- "Defines a circular or square hole on the PCB"
617
- );
618
- expectTypesMatch(true);
619
- var pcb_hole_oval = import_zod35.z.object({
620
- type: import_zod35.z.literal("pcb_hole"),
621
- pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
622
- hole_shape: import_zod35.z.literal("oval"),
623
- hole_width: import_zod35.z.number(),
624
- hole_height: import_zod35.z.number(),
625
- x: distance,
626
- y: distance
627
- });
628
- var pcb_hole_oval_shape = pcb_hole_oval.describe(
629
- "Defines an oval hole on the PCB"
630
- );
631
- expectTypesMatch(true);
632
- var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
633
-
634
- // src/pcb/pcb_plated_hole.ts
635
- var import_zod36 = require("zod");
636
- var pcb_plated_hole_circle = import_zod36.z.object({
637
- type: import_zod36.z.literal("pcb_plated_hole"),
638
- shape: import_zod36.z.literal("circle"),
639
- outer_diameter: import_zod36.z.number(),
640
- hole_diameter: import_zod36.z.number(),
641
- x: distance,
642
- y: distance,
643
- layers: import_zod36.z.array(layer_ref),
644
- port_hints: import_zod36.z.array(import_zod36.z.string()).optional(),
645
- pcb_component_id: import_zod36.z.string().optional(),
646
- pcb_port_id: import_zod36.z.string().optional(),
647
- pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
648
- });
649
- var pcb_plated_hole_oval = import_zod36.z.object({
650
- type: import_zod36.z.literal("pcb_plated_hole"),
651
- shape: import_zod36.z.enum(["oval", "pill"]),
652
- outer_width: import_zod36.z.number(),
653
- outer_height: import_zod36.z.number(),
654
- hole_width: import_zod36.z.number(),
655
- hole_height: import_zod36.z.number(),
656
- x: distance,
657
- y: distance,
658
- layers: import_zod36.z.array(layer_ref),
659
- port_hints: import_zod36.z.array(import_zod36.z.string()).optional(),
660
- pcb_component_id: import_zod36.z.string().optional(),
661
- pcb_port_id: import_zod36.z.string().optional(),
662
- pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
663
- });
664
- var pcb_plated_hole = import_zod36.z.union([
665
- pcb_plated_hole_circle,
666
- pcb_plated_hole_oval
667
- ]);
668
- expectTypesMatch(
669
- true
670
- );
671
- expectTypesMatch(true);
672
-
673
- // src/pcb/pcb_port.ts
674
- var import_zod37 = require("zod");
675
- var pcb_port = import_zod37.z.object({
676
- type: import_zod37.z.literal("pcb_port"),
677
- pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
678
- source_port_id: import_zod37.z.string(),
679
- pcb_component_id: import_zod37.z.string(),
680
- x: distance,
681
- y: distance,
682
- layers: import_zod37.z.array(layer_ref)
683
- }).describe("Defines a port on the PCB");
684
- expectTypesMatch(true);
685
-
686
- // src/pcb/pcb_smtpad.ts
687
- var import_zod38 = require("zod");
688
- var pcb_smtpad_circle = import_zod38.z.object({
689
- type: import_zod38.z.literal("pcb_smtpad"),
690
- shape: import_zod38.z.literal("circle"),
691
- pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
692
- x: distance,
693
- y: distance,
694
- radius: import_zod38.z.number(),
695
- layer: layer_ref,
696
- port_hints: import_zod38.z.array(import_zod38.z.string()).optional(),
697
- pcb_component_id: import_zod38.z.string().optional(),
698
- pcb_port_id: import_zod38.z.string().optional()
699
- });
700
- var pcb_smtpad_rect = import_zod38.z.object({
701
- type: import_zod38.z.literal("pcb_smtpad"),
702
- shape: import_zod38.z.literal("rect"),
703
- pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
704
- x: distance,
705
- y: distance,
706
- width: import_zod38.z.number(),
707
- height: import_zod38.z.number(),
708
- layer: layer_ref,
709
- port_hints: import_zod38.z.array(import_zod38.z.string()).optional(),
710
- pcb_component_id: import_zod38.z.string().optional(),
711
- pcb_port_id: import_zod38.z.string().optional()
712
- });
713
- var pcb_smtpad = import_zod38.z.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
714
- expectTypesMatch(true);
715
- expectTypesMatch(true);
716
-
717
- // src/pcb/pcb_text.ts
718
- var import_zod39 = require("zod");
719
- var pcb_text = import_zod39.z.object({
720
- type: import_zod39.z.literal("pcb_text"),
721
- pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
722
- text: import_zod39.z.string(),
723
- center: point,
724
- layer: layer_ref,
725
- width: length,
726
- height: length,
727
- lines: import_zod39.z.number(),
728
- align: import_zod39.z.enum(["bottom-left"])
729
- }).describe("Defines text on the PCB");
730
- expectTypesMatch(true);
731
-
732
- // src/pcb/pcb_trace.ts
733
- var import_zod40 = require("zod");
734
- var pcb_trace_route_point_wire = import_zod40.z.object({
735
- route_type: import_zod40.z.literal("wire"),
736
- x: distance,
737
- y: distance,
738
- width: distance,
739
- start_pcb_port_id: import_zod40.z.string().optional(),
740
- end_pcb_port_id: import_zod40.z.string().optional(),
741
- layer: layer_ref
742
- });
743
- var pcb_trace_route_point_via = import_zod40.z.object({
744
- route_type: import_zod40.z.literal("via"),
745
- x: distance,
746
- y: distance,
747
- from_layer: import_zod40.z.string(),
748
- to_layer: import_zod40.z.string()
749
- });
750
- var pcb_trace_route_point = import_zod40.z.union([
751
- pcb_trace_route_point_wire,
752
- pcb_trace_route_point_via
753
- ]);
754
- var pcb_trace = import_zod40.z.object({
755
- type: import_zod40.z.literal("pcb_trace"),
756
- source_trace_id: import_zod40.z.string().optional(),
757
- pcb_component_id: import_zod40.z.string().optional(),
758
- pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
759
- route_thickness_mode: import_zod40.z.enum(["constant", "interpolated"]).default("constant").optional(),
760
- should_round_corners: import_zod40.z.boolean().optional(),
761
- route: import_zod40.z.array(
762
- import_zod40.z.union([
763
- import_zod40.z.object({
764
- route_type: import_zod40.z.literal("wire"),
765
- x: distance,
766
- y: distance,
767
- width: distance,
768
- start_pcb_port_id: import_zod40.z.string().optional(),
769
- end_pcb_port_id: import_zod40.z.string().optional(),
770
- layer: layer_ref
771
- }),
772
- import_zod40.z.object({
773
- route_type: import_zod40.z.literal("via"),
774
- x: distance,
775
- y: distance,
776
- from_layer: import_zod40.z.string(),
777
- to_layer: import_zod40.z.string()
778
- })
779
- ])
780
- )
781
- }).describe("Defines a trace on the PCB");
782
- expectTypesMatch(true);
783
- expectTypesMatch(true);
784
-
785
- // src/pcb/pcb_trace_error.ts
786
- var import_zod41 = require("zod");
787
- var pcb_trace_error = import_zod41.z.object({
788
- type: import_zod41.z.literal("pcb_trace_error"),
789
- pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
790
- error_type: import_zod41.z.literal("pcb_trace_error"),
791
- message: import_zod41.z.string(),
792
- center: point.optional(),
793
- pcb_trace_id: import_zod41.z.string(),
794
- source_trace_id: import_zod41.z.string(),
795
- pcb_component_ids: import_zod41.z.array(import_zod41.z.string()),
796
- pcb_port_ids: import_zod41.z.array(import_zod41.z.string())
797
- }).describe("Defines a trace error on the PCB");
798
- expectTypesMatch(true);
799
-
800
- // src/pcb/pcb_port_not_matched_error.ts
801
- var import_zod42 = require("zod");
802
- var pcb_port_not_matched_error = import_zod42.z.object({
803
- type: import_zod42.z.literal("pcb_port_not_matched_error"),
804
- pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
805
- message: import_zod42.z.string(),
806
- pcb_component_ids: import_zod42.z.array(import_zod42.z.string())
807
- }).describe("Defines a trace error on the PCB where a port is not matched");
808
- expectTypesMatch(true);
809
-
810
- // src/pcb/pcb_via.ts
811
- var import_zod43 = require("zod");
812
- var pcb_via = import_zod43.z.object({
813
- type: import_zod43.z.literal("pcb_via"),
814
- pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
815
- x: distance,
816
- y: distance,
817
- outer_diameter: distance.default("0.6mm"),
818
- hole_diameter: distance.default("0.25mm"),
819
- /** @deprecated */
820
- from_layer: layer_ref.optional(),
821
- /** @deprecated */
822
- to_layer: layer_ref.optional(),
823
- layers: import_zod43.z.array(layer_ref)
824
- }).describe("Defines a via on the PCB");
825
- expectTypesMatch(true);
826
-
827
- // src/pcb/pcb_board.ts
828
- var import_zod44 = require("zod");
829
- var pcb_board = import_zod44.z.object({
830
- type: import_zod44.z.literal("pcb_board"),
831
- pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
832
- width: length,
833
- height: length,
834
- center: point,
835
- outline: import_zod44.z.array(point).optional()
836
- }).describe("Defines the board outline of the PCB");
837
- expectTypesMatch(true);
838
-
839
- // src/pcb/pcb_placement_error.ts
840
- var import_zod45 = require("zod");
841
- var pcb_placement_error = import_zod45.z.object({
842
- type: import_zod45.z.literal("pcb_placement_error"),
843
- pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
844
- message: import_zod45.z.string()
845
- }).describe("Defines a placement error on the PCB");
846
- expectTypesMatch(true);
847
-
848
- // src/pcb/pcb_trace_hint.ts
849
- var import_zod46 = require("zod");
850
- var pcb_trace_hint = import_zod46.z.object({
851
- type: import_zod46.z.literal("pcb_trace_hint"),
852
- pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
853
- pcb_port_id: import_zod46.z.string(),
854
- pcb_component_id: import_zod46.z.string(),
855
- route: import_zod46.z.array(route_hint_point)
856
- }).describe("A hint that can be used during generation of a PCB trace");
857
- expectTypesMatch(true);
858
-
859
- // src/pcb/pcb_silkscreen_line.ts
860
- var import_zod47 = require("zod");
861
- var pcb_silkscreen_line = import_zod47.z.object({
862
- type: import_zod47.z.literal("pcb_silkscreen_line"),
863
- pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
864
- pcb_component_id: import_zod47.z.string(),
865
- stroke_width: distance.default("0.1mm"),
866
- x1: distance,
867
- y1: distance,
868
- x2: distance,
869
- y2: distance,
870
- layer: visible_layer
871
- }).describe("Defines a silkscreen line on the PCB");
872
- expectTypesMatch(true);
873
-
874
- // src/pcb/pcb_silkscreen_path.ts
875
- var import_zod48 = require("zod");
876
- var pcb_silkscreen_path = import_zod48.z.object({
877
- type: import_zod48.z.literal("pcb_silkscreen_path"),
878
- pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
879
- pcb_component_id: import_zod48.z.string(),
880
- layer: visible_layer,
881
- route: import_zod48.z.array(point),
882
- stroke_width: length
883
- }).describe("Defines a silkscreen path on the PCB");
884
- expectTypesMatch(true);
885
-
886
- // src/pcb/pcb_silkscreen_text.ts
887
- var import_zod49 = require("zod");
888
- var pcb_silkscreen_text = import_zod49.z.object({
889
- type: import_zod49.z.literal("pcb_silkscreen_text"),
890
- pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
891
- font: import_zod49.z.literal("tscircuit2024").default("tscircuit2024"),
892
- font_size: distance.default("0.2mm"),
893
- pcb_component_id: import_zod49.z.string(),
894
- text: import_zod49.z.string(),
895
- layer: layer_ref,
896
- anchor_position: point.default({ x: 0, y: 0 }),
897
- anchor_alignment: import_zod49.z.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
898
- }).describe("Defines silkscreen text on the PCB");
899
- expectTypesMatch(true);
900
-
901
- // src/pcb/pcb_silkscreen_rect.ts
902
- var import_zod50 = require("zod");
903
- var pcb_silkscreen_rect = import_zod50.z.object({
904
- type: import_zod50.z.literal("pcb_silkscreen_rect"),
905
- pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
906
- pcb_component_id: import_zod50.z.string(),
907
- center: point,
908
- width: length,
909
- height: length,
910
- layer: layer_ref
911
- }).describe("Defines a silkscreen rect on the PCB");
912
- expectTypesMatch(true);
913
-
914
- // src/pcb/pcb_silkscreen_circle.ts
915
- var import_zod51 = require("zod");
916
- var pcb_silkscreen_circle = import_zod51.z.object({
917
- type: import_zod51.z.literal("pcb_silkscreen_circle"),
918
- pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
919
- "pcb_silkscreen_circle"
920
- ),
921
- pcb_component_id: import_zod51.z.string(),
922
- center: point,
923
- radius: length,
924
- layer: visible_layer
925
- }).describe("Defines a silkscreen circle on the PCB");
926
- expectTypesMatch(true);
927
-
928
- // src/pcb/pcb_silkscreen_oval.ts
929
- var import_zod52 = require("zod");
930
- var pcb_silkscreen_oval = import_zod52.z.object({
931
- type: import_zod52.z.literal("pcb_silkscreen_oval"),
932
- pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
933
- pcb_component_id: import_zod52.z.string(),
934
- center: point,
935
- radius_x: distance,
936
- radius_y: distance,
937
- layer: visible_layer
938
- }).describe("Defines a silkscreen oval on the PCB");
939
- expectTypesMatch(true);
940
-
941
- // src/pcb/pcb_fabrication_note_text.ts
942
- var import_zod53 = require("zod");
943
- var pcb_fabrication_note_text = import_zod53.z.object({
944
- type: import_zod53.z.literal("pcb_fabrication_note_text"),
945
- pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
946
- "pcb_fabrication_note_text"
947
- ),
948
- font: import_zod53.z.literal("tscircuit2024").default("tscircuit2024"),
949
- font_size: distance.default("1mm"),
950
- pcb_component_id: import_zod53.z.string(),
951
- text: import_zod53.z.string(),
952
- layer: visible_layer,
953
- anchor_position: point.default({ x: 0, y: 0 }),
954
- anchor_alignment: import_zod53.z.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
955
- color: import_zod53.z.string().optional()
956
- }).describe(
957
- "Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
958
- );
959
- expectTypesMatch(true);
960
-
961
- // src/pcb/pcb_fabrication_note_path.ts
962
- var import_zod54 = require("zod");
963
- var pcb_fabrication_note_path = import_zod54.z.object({
964
- type: import_zod54.z.literal("pcb_fabrication_note_path"),
965
- pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
966
- "pcb_fabrication_note_path"
967
- ),
968
- pcb_component_id: import_zod54.z.string(),
969
- layer: layer_ref,
970
- route: import_zod54.z.array(point),
971
- stroke_width: length,
972
- color: import_zod54.z.string().optional()
973
- }).describe(
974
- "Defines a fabrication path on the PCB for fabricators or assemblers"
975
- );
976
- expectTypesMatch(true);
977
-
978
- // src/pcb/pcb_keepout.ts
979
- var import_zod55 = require("zod");
980
- var pcb_keepout = import_zod55.z.object({
981
- type: import_zod55.z.literal("pcb_keepout"),
982
- shape: import_zod55.z.literal("rect"),
983
- center: point,
984
- width: distance,
985
- height: distance,
986
- pcb_keepout_id: import_zod55.z.string(),
987
- layers: import_zod55.z.array(import_zod55.z.string()),
988
- // Specify layers where the keepout applies
989
- description: import_zod55.z.string().optional()
990
- // Optional description of the keepout
991
- }).or(
992
- import_zod55.z.object({
993
- type: import_zod55.z.literal("pcb_keepout"),
994
- shape: import_zod55.z.literal("circle"),
995
- center: point,
996
- radius: distance,
997
- pcb_keepout_id: import_zod55.z.string(),
998
- layers: import_zod55.z.array(import_zod55.z.string()),
999
- // Specify layers where the keepout applies
1000
- description: import_zod55.z.string().optional()
1001
- // Optional description of the keepout
1002
- })
1003
- );
1004
-
1005
- // src/cad/cad_component.ts
1006
- var import_zod56 = require("zod");
1007
- var cad_component = import_zod56.z.object({
1008
- type: import_zod56.z.literal("cad_component"),
1009
- cad_component_id: import_zod56.z.string(),
1010
- pcb_component_id: import_zod56.z.string(),
1011
- source_component_id: import_zod56.z.string(),
1012
- position: point3,
1013
- rotation: point3.optional(),
1014
- size: point3.optional(),
1015
- layer: layer_ref.optional(),
1016
- // These are all ways to generate/load the 3d model
1017
- footprinter_string: import_zod56.z.string().optional(),
1018
- model_obj_url: import_zod56.z.string().optional(),
1019
- model_stl_url: import_zod56.z.string().optional(),
1020
- model_3mf_url: import_zod56.z.string().optional(),
1021
- model_jscad: import_zod56.z.any().optional()
1022
- }).describe("Defines a component on the PCB");
1023
-
1024
- // src/any_circuit_element.ts
1025
- var import_zod57 = require("zod");
1026
- var any_circuit_element = import_zod57.z.union([
1027
- source_trace,
1028
- source_port,
1029
- any_source_component,
1030
- source_led,
1031
- source_net,
1032
- source_group,
1033
- source_simple_bug,
1034
- source_simple_chip,
1035
- source_simple_capacitor,
1036
- source_simple_diode,
1037
- source_simple_resistor,
1038
- source_simple_power_source,
1039
- pcb_component,
1040
- pcb_hole,
1041
- pcb_plated_hole,
1042
- pcb_keepout,
1043
- pcb_port,
1044
- pcb_text,
1045
- pcb_trace,
1046
- pcb_via,
1047
- pcb_smtpad,
1048
- pcb_board,
1049
- pcb_trace_hint,
1050
- pcb_silkscreen_line,
1051
- pcb_silkscreen_path,
1052
- pcb_silkscreen_text,
1053
- pcb_silkscreen_rect,
1054
- pcb_silkscreen_circle,
1055
- pcb_silkscreen_oval,
1056
- pcb_trace_error,
1057
- pcb_placement_error,
1058
- pcb_port_not_matched_error,
1059
- pcb_fabrication_note_path,
1060
- pcb_fabrication_note_text,
1061
- schematic_box,
1062
- schematic_text,
1063
- schematic_line,
1064
- schematic_component,
1065
- schematic_port,
1066
- schematic_trace,
1067
- schematic_path,
1068
- schematic_error,
1069
- schematic_net_label,
1070
- cad_component
1071
- ]);
1072
- var any_soup_element = any_circuit_element;
1073
- // Annotate the CommonJS export names for ESM import in node:
1074
- 0 && (module.exports = {
1075
- all_layers,
1076
- any_circuit_element,
1077
- any_soup_element,
1078
- any_source_component,
1079
- cad_component,
1080
- capacitance,
1081
- current,
1082
- distance,
1083
- getZodPrefixedIdWithDefault,
1084
- inductance,
1085
- layer_ref,
1086
- layer_string,
1087
- length,
1088
- pcb_board,
1089
- pcb_component,
1090
- pcb_fabrication_note_path,
1091
- pcb_fabrication_note_text,
1092
- pcb_hole,
1093
- pcb_hole_circle_or_square_shape,
1094
- pcb_hole_oval_shape,
1095
- pcb_keepout,
1096
- pcb_placement_error,
1097
- pcb_plated_hole,
1098
- pcb_port,
1099
- pcb_port_not_matched_error,
1100
- pcb_route_hint,
1101
- pcb_route_hints,
1102
- pcb_silkscreen_circle,
1103
- pcb_silkscreen_line,
1104
- pcb_silkscreen_oval,
1105
- pcb_silkscreen_path,
1106
- pcb_silkscreen_rect,
1107
- pcb_silkscreen_text,
1108
- pcb_smtpad,
1109
- pcb_text,
1110
- pcb_trace,
1111
- pcb_trace_error,
1112
- pcb_trace_hint,
1113
- pcb_trace_route_point,
1114
- pcb_trace_route_point_via,
1115
- pcb_trace_route_point_wire,
1116
- pcb_via,
1117
- point,
1118
- point3,
1119
- position,
1120
- position3,
1121
- resistance,
1122
- rotation,
1123
- route_hint_point,
1124
- schematic_box,
1125
- schematic_component,
1126
- schematic_error,
1127
- schematic_line,
1128
- schematic_net_label,
1129
- schematic_path,
1130
- schematic_pin_styles,
1131
- schematic_port,
1132
- schematic_text,
1133
- schematic_trace,
1134
- size,
1135
- source_component_base,
1136
- source_group,
1137
- source_led,
1138
- source_net,
1139
- source_port,
1140
- source_simple_bug,
1141
- source_simple_capacitor,
1142
- source_simple_chip,
1143
- source_simple_diode,
1144
- source_simple_ground,
1145
- source_simple_power_source,
1146
- source_simple_resistor,
1147
- source_trace,
1148
- supplier_name,
1149
- time,
1150
- visible_layer,
1151
- voltage
1152
- });
1153
- //# sourceMappingURL=index.js.map