easyeda 0.0.31 → 0.0.33
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/{lib/index.cjs → chunk-3ZPJFTXV.js} +653 -700
- package/dist/chunk-3ZPJFTXV.js.map +1 -0
- package/dist/cli/main.js +84 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/lib/index.js +41 -0
- package/dist/lib/index.js.map +1 -0
- package/package.json +6 -6
- package/dist/cli/main.cjs +0 -2377
- package/dist/cli/main.cjs.map +0 -1
- package/dist/lib/index.cjs.map +0 -1
- /package/dist/cli/{main.d.cts → main.d.ts} +0 -0
- /package/dist/lib/{index.d.cts → index.d.ts} +0 -0
|
@@ -1,62 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
1
|
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
2
|
var __export = (target, all) => {
|
|
9
3
|
for (var name in all)
|
|
10
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
5
|
};
|
|
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
|
-
// lib/index.ts
|
|
31
|
-
var lib_exports = {};
|
|
32
|
-
__export(lib_exports, {
|
|
33
|
-
BBoxSchema: () => BBoxSchema,
|
|
34
|
-
DataStrSchema: () => DataStrSchema,
|
|
35
|
-
EasyEdaJsonSchema: () => EasyEdaJsonSchema,
|
|
36
|
-
HeadSchema: () => HeadSchema,
|
|
37
|
-
LayerItemSchema: () => LayerItemSchema,
|
|
38
|
-
LcscSchema: () => LcscSchema,
|
|
39
|
-
ObjectItemSchema: () => ObjectItemSchema,
|
|
40
|
-
OwnerSchema: () => OwnerSchema,
|
|
41
|
-
PackageDetailDataStrSchema: () => PackageDetailDataStrSchema,
|
|
42
|
-
PackageDetailSchema: () => PackageDetailSchema,
|
|
43
|
-
SzlcscSchema: () => SzlcscSchema,
|
|
44
|
-
convertEasyEdaJsonToCircuitJson: () => convertEasyEdaJsonToCircuitJson,
|
|
45
|
-
convertEasyEdaJsonToTscircuitSoupJson: () => convertEasyEdaJsonToTscircuitSoupJson,
|
|
46
|
-
convertEasyEdaJsonToVariousFormats: () => convertEasyEdaJsonToVariousFormats,
|
|
47
|
-
convertRawEasyEdaToTs: () => convertRawEasyEdaToTs,
|
|
48
|
-
fetchEasyEDAComponent: () => fetchEasyEDAComponent,
|
|
49
|
-
maybeNumber: () => maybeNumber,
|
|
50
|
-
normalizeManufacturerPartNumber: () => normalizeManufacturerPartNumber
|
|
51
|
-
});
|
|
52
|
-
module.exports = __toCommonJS(lib_exports);
|
|
53
6
|
|
|
54
7
|
// lib/schemas/package-detail-shape-schema.ts
|
|
55
|
-
|
|
56
|
-
var tenthmil =
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
var tenthmil = z.union([z.number(), z.string()]).optional().transform(
|
|
57
10
|
(n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
|
|
58
|
-
).pipe(
|
|
59
|
-
var PointSchema =
|
|
11
|
+
).pipe(z.string());
|
|
12
|
+
var PointSchema = z.any().transform((p) => {
|
|
60
13
|
if (Array.isArray(p)) {
|
|
61
14
|
const [x, y] = p;
|
|
62
15
|
return { x, y };
|
|
@@ -65,87 +18,87 @@ var PointSchema = import_zod.z.any().transform((p) => {
|
|
|
65
18
|
}
|
|
66
19
|
throw new Error(`Invalid point: ${p}`);
|
|
67
20
|
}).pipe(
|
|
68
|
-
|
|
69
|
-
x:
|
|
70
|
-
y:
|
|
21
|
+
z.object({
|
|
22
|
+
x: z.number(),
|
|
23
|
+
y: z.number()
|
|
71
24
|
})
|
|
72
25
|
);
|
|
73
|
-
var BaseShapeSchema =
|
|
74
|
-
type:
|
|
75
|
-
id:
|
|
76
|
-
layer:
|
|
26
|
+
var BaseShapeSchema = z.object({
|
|
27
|
+
type: z.string(),
|
|
28
|
+
id: z.string().optional(),
|
|
29
|
+
layer: z.coerce.number().optional()
|
|
77
30
|
});
|
|
78
31
|
var TrackSchema = BaseShapeSchema.extend({
|
|
79
|
-
type:
|
|
80
|
-
width:
|
|
81
|
-
points:
|
|
32
|
+
type: z.literal("TRACK"),
|
|
33
|
+
width: z.coerce.number(),
|
|
34
|
+
points: z.array(PointSchema)
|
|
82
35
|
});
|
|
83
36
|
var PadSchema = BaseShapeSchema.extend({
|
|
84
|
-
type:
|
|
85
|
-
shape:
|
|
86
|
-
center:
|
|
37
|
+
type: z.literal("PAD"),
|
|
38
|
+
shape: z.enum(["RECT", "ELLIPSE", "OVAL"]),
|
|
39
|
+
center: z.object({
|
|
87
40
|
x: tenthmil,
|
|
88
41
|
y: tenthmil
|
|
89
42
|
}),
|
|
90
43
|
width: tenthmil,
|
|
91
44
|
height: tenthmil,
|
|
92
|
-
layermask:
|
|
93
|
-
net:
|
|
94
|
-
number:
|
|
45
|
+
layermask: z.number(),
|
|
46
|
+
net: z.union([z.string(), z.number()]).optional(),
|
|
47
|
+
number: z.number(),
|
|
95
48
|
holeRadius: tenthmil,
|
|
96
|
-
points:
|
|
97
|
-
rotation:
|
|
98
|
-
plated:
|
|
49
|
+
points: z.array(PointSchema).optional(),
|
|
50
|
+
rotation: z.number().optional(),
|
|
51
|
+
plated: z.boolean()
|
|
99
52
|
});
|
|
100
53
|
var ArcSchema = BaseShapeSchema.extend({
|
|
101
|
-
type:
|
|
102
|
-
width:
|
|
54
|
+
type: z.literal("ARC"),
|
|
55
|
+
width: z.number(),
|
|
103
56
|
start: PointSchema,
|
|
104
57
|
end: PointSchema,
|
|
105
|
-
radiusX:
|
|
106
|
-
radiusY:
|
|
107
|
-
largeArc:
|
|
108
|
-
sweepDirection:
|
|
58
|
+
radiusX: z.number(),
|
|
59
|
+
radiusY: z.number(),
|
|
60
|
+
largeArc: z.boolean(),
|
|
61
|
+
sweepDirection: z.enum(["CW", "CCW"])
|
|
109
62
|
});
|
|
110
63
|
var CircleSchema = BaseShapeSchema.extend({
|
|
111
|
-
type:
|
|
64
|
+
type: z.literal("CIRCLE"),
|
|
112
65
|
center: PointSchema,
|
|
113
|
-
radius:
|
|
114
|
-
width:
|
|
66
|
+
radius: z.number(),
|
|
67
|
+
width: z.number()
|
|
115
68
|
});
|
|
116
69
|
var SolidRegionSchema = BaseShapeSchema.extend({
|
|
117
|
-
type:
|
|
118
|
-
layermask:
|
|
119
|
-
points:
|
|
120
|
-
fillStyle:
|
|
70
|
+
type: z.literal("SOLIDREGION"),
|
|
71
|
+
layermask: z.number(),
|
|
72
|
+
points: z.array(PointSchema),
|
|
73
|
+
fillStyle: z.string()
|
|
121
74
|
});
|
|
122
75
|
var SVGNodeSchema = BaseShapeSchema.extend({
|
|
123
|
-
type:
|
|
124
|
-
svgData:
|
|
125
|
-
gId:
|
|
126
|
-
nodeName:
|
|
127
|
-
nodeType:
|
|
128
|
-
layerid:
|
|
129
|
-
attrs:
|
|
130
|
-
childNodes:
|
|
76
|
+
type: z.literal("SVGNODE"),
|
|
77
|
+
svgData: z.object({
|
|
78
|
+
gId: z.string(),
|
|
79
|
+
nodeName: z.string(),
|
|
80
|
+
nodeType: z.number(),
|
|
81
|
+
layerid: z.string(),
|
|
82
|
+
attrs: z.record(z.string(), z.string()),
|
|
83
|
+
childNodes: z.array(z.unknown())
|
|
131
84
|
})
|
|
132
85
|
});
|
|
133
86
|
var HoleSchema = BaseShapeSchema.extend({
|
|
134
|
-
type:
|
|
87
|
+
type: z.literal("HOLE"),
|
|
135
88
|
center: PointSchema,
|
|
136
|
-
radius:
|
|
89
|
+
radius: z.number()
|
|
137
90
|
});
|
|
138
91
|
var RectSchema = BaseShapeSchema.extend({
|
|
139
|
-
type:
|
|
92
|
+
type: z.literal("RECT"),
|
|
140
93
|
x: tenthmil,
|
|
141
94
|
y: tenthmil,
|
|
142
95
|
width: tenthmil,
|
|
143
96
|
height: tenthmil,
|
|
144
|
-
lineWidth:
|
|
145
|
-
fillStyle:
|
|
146
|
-
rotation:
|
|
97
|
+
lineWidth: z.number(),
|
|
98
|
+
fillStyle: z.string(),
|
|
99
|
+
rotation: z.number().optional()
|
|
147
100
|
});
|
|
148
|
-
var PackageDetailShapeSchema =
|
|
101
|
+
var PackageDetailShapeSchema = z.discriminatedUnion("type", [
|
|
149
102
|
TrackSchema,
|
|
150
103
|
PadSchema,
|
|
151
104
|
ArcSchema,
|
|
@@ -165,9 +118,9 @@ var pairs = (arr) => {
|
|
|
165
118
|
var parsePoints = (pointsStr) => pairs(
|
|
166
119
|
pointsStr.trim().split(" ").map((n) => Number(n))
|
|
167
120
|
);
|
|
168
|
-
var ShapeItemSchema =
|
|
169
|
-
type:
|
|
170
|
-
data:
|
|
121
|
+
var ShapeItemSchema = z.object({
|
|
122
|
+
type: z.string(),
|
|
123
|
+
data: z.string()
|
|
171
124
|
}).transform((shape) => {
|
|
172
125
|
const [firstParam, ...restParams] = shape.data.split("~");
|
|
173
126
|
const lastParam = restParams.pop();
|
|
@@ -303,10 +256,10 @@ var ShapeItemSchema = import_zod.z.object({
|
|
|
303
256
|
return BaseShapeSchema.parse({ type: shape.type });
|
|
304
257
|
}
|
|
305
258
|
}).pipe(PackageDetailShapeSchema);
|
|
306
|
-
var ShapesArraySchema =
|
|
259
|
+
var ShapesArraySchema = z.array(ShapeItemSchema);
|
|
307
260
|
|
|
308
261
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
309
|
-
|
|
262
|
+
import "zod";
|
|
310
263
|
|
|
311
264
|
// node_modules/circuit-json/dist/index.mjs
|
|
312
265
|
var dist_exports = {};
|
|
@@ -390,14 +343,14 @@ __export(dist_exports, {
|
|
|
390
343
|
visible_layer: () => visible_layer,
|
|
391
344
|
voltage: () => voltage
|
|
392
345
|
});
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
346
|
+
import { z as z2 } from "zod";
|
|
347
|
+
import { z as z22 } from "zod";
|
|
348
|
+
import { z as z3 } from "zod";
|
|
349
|
+
import { z as z4 } from "zod";
|
|
350
|
+
import { z as z5 } from "zod";
|
|
398
351
|
|
|
399
352
|
// node_modules/nanoid/index.js
|
|
400
|
-
|
|
353
|
+
import { webcrypto as crypto } from "node:crypto";
|
|
401
354
|
|
|
402
355
|
// node_modules/nanoid/url-alphabet/index.js
|
|
403
356
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
@@ -409,10 +362,10 @@ var poolOffset;
|
|
|
409
362
|
function fillPool(bytes) {
|
|
410
363
|
if (!pool || pool.length < bytes) {
|
|
411
364
|
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
412
|
-
|
|
365
|
+
crypto.getRandomValues(pool);
|
|
413
366
|
poolOffset = 0;
|
|
414
367
|
} else if (poolOffset + bytes > pool.length) {
|
|
415
|
-
|
|
368
|
+
crypto.getRandomValues(pool);
|
|
416
369
|
poolOffset = 0;
|
|
417
370
|
}
|
|
418
371
|
poolOffset += bytes;
|
|
@@ -427,59 +380,59 @@ function nanoid(size2 = 21) {
|
|
|
427
380
|
}
|
|
428
381
|
|
|
429
382
|
// node_modules/circuit-json/dist/index.mjs
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
383
|
+
import { z as z8 } from "zod";
|
|
384
|
+
import { z as z6 } from "zod";
|
|
385
|
+
import { z as z7 } from "zod";
|
|
386
|
+
import { z as z9 } from "zod";
|
|
387
|
+
import { z as z10 } from "zod";
|
|
388
|
+
import { z as z11 } from "zod";
|
|
389
|
+
import { z as z12 } from "zod";
|
|
390
|
+
import { z as z13 } from "zod";
|
|
391
|
+
import { z as z14 } from "zod";
|
|
392
|
+
import { z as z15 } from "zod";
|
|
393
|
+
import { z as z16 } from "zod";
|
|
394
|
+
import { z as z17 } from "zod";
|
|
395
|
+
import { z as z18 } from "zod";
|
|
396
|
+
import { z as z19 } from "zod";
|
|
397
|
+
import { z as z20 } from "zod";
|
|
398
|
+
import { z as z21 } from "zod";
|
|
399
|
+
import { z as z222 } from "zod";
|
|
400
|
+
import { z as z23 } from "zod";
|
|
401
|
+
import { z as z24 } from "zod";
|
|
402
|
+
import { z as z25 } from "zod";
|
|
403
|
+
import { z as z26 } from "zod";
|
|
404
|
+
import { z as z27 } from "zod";
|
|
405
|
+
import { z as z28 } from "zod";
|
|
406
|
+
import { z as z29 } from "zod";
|
|
407
|
+
import { z as z30 } from "zod";
|
|
408
|
+
import { z as z31 } from "zod";
|
|
409
|
+
import { z as z32 } from "zod";
|
|
410
|
+
import { z as z33 } from "zod";
|
|
411
|
+
import { z as z34 } from "zod";
|
|
412
|
+
import { z as z35 } from "zod";
|
|
413
|
+
import { z as z36 } from "zod";
|
|
414
|
+
import { z as z37 } from "zod";
|
|
415
|
+
import { z as z38 } from "zod";
|
|
416
|
+
import { z as z39 } from "zod";
|
|
417
|
+
import { z as z40 } from "zod";
|
|
418
|
+
import { z as z41 } from "zod";
|
|
419
|
+
import { z as z42 } from "zod";
|
|
420
|
+
import { z as z43 } from "zod";
|
|
421
|
+
import { z as z44 } from "zod";
|
|
422
|
+
import { z as z45 } from "zod";
|
|
423
|
+
import { z as z46 } from "zod";
|
|
424
|
+
import { z as z47 } from "zod";
|
|
425
|
+
import { z as z48 } from "zod";
|
|
426
|
+
import { z as z49 } from "zod";
|
|
427
|
+
import { z as z50 } from "zod";
|
|
428
|
+
import { z as z51 } from "zod";
|
|
429
|
+
import { z as z52 } from "zod";
|
|
430
|
+
import { z as z53 } from "zod";
|
|
431
|
+
import { z as z54 } from "zod";
|
|
432
|
+
import { z as z55 } from "zod";
|
|
433
|
+
import { z as z56 } from "zod";
|
|
434
|
+
import { z as z57 } from "zod";
|
|
435
|
+
import { z as z58 } from "zod";
|
|
483
436
|
var unitMappings = {
|
|
484
437
|
Hz: {
|
|
485
438
|
baseUnit: "Hz",
|
|
@@ -629,15 +582,15 @@ var parseAndConvertSiUnit = (v) => {
|
|
|
629
582
|
value: conversionFactor * Number.parseFloat(value)
|
|
630
583
|
};
|
|
631
584
|
};
|
|
632
|
-
var resistance =
|
|
633
|
-
var capacitance =
|
|
634
|
-
var inductance =
|
|
635
|
-
var voltage =
|
|
636
|
-
var length =
|
|
585
|
+
var resistance = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
586
|
+
var capacitance = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
587
|
+
var inductance = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
588
|
+
var voltage = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
589
|
+
var length = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
637
590
|
var distance = length;
|
|
638
|
-
var current =
|
|
639
|
-
var time =
|
|
640
|
-
var rotation =
|
|
591
|
+
var current = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
592
|
+
var time = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
593
|
+
var rotation = z2.string().or(z2.number()).transform((arg) => {
|
|
641
594
|
if (typeof arg === "number") return arg;
|
|
642
595
|
if (arg.endsWith("deg")) {
|
|
643
596
|
return Number.parseFloat(arg.split("deg")[0]);
|
|
@@ -647,25 +600,25 @@ var rotation = import_zod2.z.string().or(import_zod2.z.number()).transform((arg)
|
|
|
647
600
|
}
|
|
648
601
|
return Number.parseFloat(arg);
|
|
649
602
|
});
|
|
650
|
-
var point =
|
|
603
|
+
var point = z22.object({
|
|
651
604
|
x: distance,
|
|
652
605
|
y: distance
|
|
653
606
|
});
|
|
654
607
|
var position = point;
|
|
655
|
-
var point3 =
|
|
608
|
+
var point3 = z3.object({
|
|
656
609
|
x: distance,
|
|
657
610
|
y: distance,
|
|
658
611
|
z: distance
|
|
659
612
|
});
|
|
660
613
|
var position3 = point3;
|
|
661
|
-
var size =
|
|
662
|
-
width:
|
|
663
|
-
height:
|
|
614
|
+
var size = z4.object({
|
|
615
|
+
width: z4.number(),
|
|
616
|
+
height: z4.number()
|
|
664
617
|
});
|
|
665
618
|
var getZodPrefixedIdWithDefault = (prefix) => {
|
|
666
|
-
return
|
|
619
|
+
return z5.string().optional().default(() => `${prefix}_${nanoid(10)}`);
|
|
667
620
|
};
|
|
668
|
-
var supplier_name =
|
|
621
|
+
var supplier_name = z6.enum([
|
|
669
622
|
"jlcpcb",
|
|
670
623
|
"macrofab",
|
|
671
624
|
"pcbway",
|
|
@@ -673,46 +626,46 @@ var supplier_name = import_zod8.z.enum([
|
|
|
673
626
|
"mouser",
|
|
674
627
|
"lcsc"
|
|
675
628
|
]);
|
|
676
|
-
var source_component_base =
|
|
677
|
-
type:
|
|
678
|
-
ftype:
|
|
679
|
-
source_component_id:
|
|
680
|
-
name:
|
|
681
|
-
manufacturer_part_number:
|
|
682
|
-
supplier_part_numbers:
|
|
629
|
+
var source_component_base = z7.object({
|
|
630
|
+
type: z7.literal("source_component"),
|
|
631
|
+
ftype: z7.string().optional(),
|
|
632
|
+
source_component_id: z7.string(),
|
|
633
|
+
name: z7.string(),
|
|
634
|
+
manufacturer_part_number: z7.string().optional(),
|
|
635
|
+
supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional()
|
|
683
636
|
});
|
|
684
637
|
var source_simple_capacitor = source_component_base.extend({
|
|
685
|
-
ftype:
|
|
638
|
+
ftype: z8.literal("simple_capacitor"),
|
|
686
639
|
capacitance
|
|
687
640
|
});
|
|
688
641
|
var source_simple_resistor = source_component_base.extend({
|
|
689
|
-
ftype:
|
|
642
|
+
ftype: z9.literal("simple_resistor"),
|
|
690
643
|
resistance
|
|
691
644
|
});
|
|
692
645
|
var source_simple_diode = source_component_base.extend({
|
|
693
|
-
ftype:
|
|
646
|
+
ftype: z10.literal("simple_diode")
|
|
694
647
|
});
|
|
695
648
|
var source_simple_ground = source_component_base.extend({
|
|
696
|
-
ftype:
|
|
649
|
+
ftype: z11.literal("simple_ground")
|
|
697
650
|
});
|
|
698
651
|
var source_simple_bug = source_component_base.extend({
|
|
699
|
-
ftype:
|
|
652
|
+
ftype: z12.literal("simple_bug")
|
|
700
653
|
}).describe("@deprecated");
|
|
701
654
|
var source_simple_chip = source_component_base.extend({
|
|
702
|
-
ftype:
|
|
655
|
+
ftype: z13.literal("simple_chip")
|
|
703
656
|
});
|
|
704
657
|
var source_simple_inductor = source_component_base.extend({
|
|
705
|
-
ftype:
|
|
658
|
+
ftype: z14.literal("simple_inductor"),
|
|
706
659
|
inductance
|
|
707
660
|
});
|
|
708
661
|
var source_led = source_simple_diode.extend({
|
|
709
|
-
ftype:
|
|
662
|
+
ftype: z15.literal("led")
|
|
710
663
|
});
|
|
711
664
|
var source_simple_power_source = source_component_base.extend({
|
|
712
|
-
ftype:
|
|
665
|
+
ftype: z16.literal("simple_power_source"),
|
|
713
666
|
voltage
|
|
714
667
|
});
|
|
715
|
-
var any_source_component =
|
|
668
|
+
var any_source_component = z17.union([
|
|
716
669
|
source_simple_resistor,
|
|
717
670
|
source_simple_capacitor,
|
|
718
671
|
source_simple_diode,
|
|
@@ -722,158 +675,158 @@ var any_source_component = import_zod18.z.union([
|
|
|
722
675
|
source_led,
|
|
723
676
|
source_simple_power_source
|
|
724
677
|
]);
|
|
725
|
-
var source_port =
|
|
726
|
-
type:
|
|
727
|
-
pin_number:
|
|
728
|
-
port_hints:
|
|
729
|
-
name:
|
|
730
|
-
source_port_id:
|
|
731
|
-
source_component_id:
|
|
732
|
-
});
|
|
733
|
-
var source_trace =
|
|
734
|
-
type:
|
|
735
|
-
source_trace_id:
|
|
736
|
-
connected_source_port_ids:
|
|
737
|
-
connected_source_net_ids:
|
|
738
|
-
});
|
|
739
|
-
var source_group =
|
|
740
|
-
type:
|
|
741
|
-
source_group_id:
|
|
742
|
-
name:
|
|
743
|
-
});
|
|
744
|
-
var source_net =
|
|
745
|
-
type:
|
|
746
|
-
source_net_id:
|
|
747
|
-
name:
|
|
748
|
-
member_source_group_ids:
|
|
749
|
-
is_power:
|
|
750
|
-
is_ground:
|
|
751
|
-
is_digital_signal:
|
|
752
|
-
is_analog_signal:
|
|
753
|
-
trace_width:
|
|
754
|
-
});
|
|
755
|
-
var schematic_box =
|
|
756
|
-
type:
|
|
757
|
-
schematic_component_id:
|
|
678
|
+
var source_port = z18.object({
|
|
679
|
+
type: z18.literal("source_port"),
|
|
680
|
+
pin_number: z18.number().optional(),
|
|
681
|
+
port_hints: z18.array(z18.string()).optional(),
|
|
682
|
+
name: z18.string(),
|
|
683
|
+
source_port_id: z18.string(),
|
|
684
|
+
source_component_id: z18.string()
|
|
685
|
+
});
|
|
686
|
+
var source_trace = z19.object({
|
|
687
|
+
type: z19.literal("source_trace"),
|
|
688
|
+
source_trace_id: z19.string(),
|
|
689
|
+
connected_source_port_ids: z19.array(z19.string()),
|
|
690
|
+
connected_source_net_ids: z19.array(z19.string())
|
|
691
|
+
});
|
|
692
|
+
var source_group = z20.object({
|
|
693
|
+
type: z20.literal("source_group"),
|
|
694
|
+
source_group_id: z20.string(),
|
|
695
|
+
name: z20.string().optional()
|
|
696
|
+
});
|
|
697
|
+
var source_net = z21.object({
|
|
698
|
+
type: z21.literal("source_net"),
|
|
699
|
+
source_net_id: z21.string(),
|
|
700
|
+
name: z21.string(),
|
|
701
|
+
member_source_group_ids: z21.array(z21.string()),
|
|
702
|
+
is_power: z21.boolean().optional(),
|
|
703
|
+
is_ground: z21.boolean().optional(),
|
|
704
|
+
is_digital_signal: z21.boolean().optional(),
|
|
705
|
+
is_analog_signal: z21.boolean().optional(),
|
|
706
|
+
trace_width: z21.number().optional()
|
|
707
|
+
});
|
|
708
|
+
var schematic_box = z222.object({
|
|
709
|
+
type: z222.literal("schematic_box"),
|
|
710
|
+
schematic_component_id: z222.string(),
|
|
758
711
|
width: distance,
|
|
759
712
|
height: distance,
|
|
760
713
|
x: distance,
|
|
761
714
|
y: distance
|
|
762
715
|
}).describe("Draws a box on the schematic");
|
|
763
|
-
var schematic_path =
|
|
764
|
-
type:
|
|
765
|
-
schematic_component_id:
|
|
766
|
-
fill_color:
|
|
767
|
-
is_filled:
|
|
768
|
-
points:
|
|
769
|
-
});
|
|
770
|
-
var schematic_pin_styles =
|
|
771
|
-
|
|
716
|
+
var schematic_path = z23.object({
|
|
717
|
+
type: z23.literal("schematic_path"),
|
|
718
|
+
schematic_component_id: z23.string(),
|
|
719
|
+
fill_color: z23.enum(["red", "blue"]).optional(),
|
|
720
|
+
is_filled: z23.boolean().optional(),
|
|
721
|
+
points: z23.array(point)
|
|
722
|
+
});
|
|
723
|
+
var schematic_pin_styles = z24.record(
|
|
724
|
+
z24.object({
|
|
772
725
|
left_margin: length.optional(),
|
|
773
726
|
right_margin: length.optional(),
|
|
774
727
|
top_margin: length.optional(),
|
|
775
728
|
bottom_margin: length.optional()
|
|
776
729
|
})
|
|
777
730
|
);
|
|
778
|
-
var schematic_component =
|
|
779
|
-
type:
|
|
731
|
+
var schematic_component = z24.object({
|
|
732
|
+
type: z24.literal("schematic_component"),
|
|
780
733
|
rotation: rotation.default(0),
|
|
781
734
|
size,
|
|
782
735
|
center: point,
|
|
783
|
-
source_component_id:
|
|
784
|
-
schematic_component_id:
|
|
736
|
+
source_component_id: z24.string(),
|
|
737
|
+
schematic_component_id: z24.string(),
|
|
785
738
|
pin_spacing: length.optional(),
|
|
786
739
|
pin_styles: schematic_pin_styles.optional(),
|
|
787
740
|
box_width: length.optional(),
|
|
788
|
-
symbol_name:
|
|
789
|
-
port_arrangement:
|
|
790
|
-
|
|
791
|
-
left_size:
|
|
792
|
-
right_size:
|
|
793
|
-
top_size:
|
|
794
|
-
bottom_size:
|
|
741
|
+
symbol_name: z24.string().optional(),
|
|
742
|
+
port_arrangement: z24.union([
|
|
743
|
+
z24.object({
|
|
744
|
+
left_size: z24.number(),
|
|
745
|
+
right_size: z24.number(),
|
|
746
|
+
top_size: z24.number().optional(),
|
|
747
|
+
bottom_size: z24.number().optional()
|
|
795
748
|
}),
|
|
796
|
-
|
|
797
|
-
left_side:
|
|
798
|
-
pins:
|
|
799
|
-
direction:
|
|
749
|
+
z24.object({
|
|
750
|
+
left_side: z24.object({
|
|
751
|
+
pins: z24.array(z24.number()),
|
|
752
|
+
direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
800
753
|
}).optional(),
|
|
801
|
-
right_side:
|
|
802
|
-
pins:
|
|
803
|
-
direction:
|
|
754
|
+
right_side: z24.object({
|
|
755
|
+
pins: z24.array(z24.number()),
|
|
756
|
+
direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
804
757
|
}).optional(),
|
|
805
|
-
top_side:
|
|
806
|
-
pins:
|
|
807
|
-
direction:
|
|
758
|
+
top_side: z24.object({
|
|
759
|
+
pins: z24.array(z24.number()),
|
|
760
|
+
direction: z24.enum(["left-to-right", "right-to-left"]).optional()
|
|
808
761
|
}).optional(),
|
|
809
|
-
bottom_side:
|
|
810
|
-
pins:
|
|
811
|
-
direction:
|
|
762
|
+
bottom_side: z24.object({
|
|
763
|
+
pins: z24.array(z24.number()),
|
|
764
|
+
direction: z24.enum(["left-to-right", "right-to-left"]).optional()
|
|
812
765
|
}).optional()
|
|
813
766
|
})
|
|
814
767
|
]).optional(),
|
|
815
|
-
port_labels:
|
|
768
|
+
port_labels: z24.record(z24.string()).optional()
|
|
816
769
|
});
|
|
817
|
-
var schematic_line =
|
|
818
|
-
type:
|
|
819
|
-
schematic_component_id:
|
|
770
|
+
var schematic_line = z25.object({
|
|
771
|
+
type: z25.literal("schematic_line"),
|
|
772
|
+
schematic_component_id: z25.string(),
|
|
820
773
|
x1: distance,
|
|
821
774
|
x2: distance,
|
|
822
775
|
y1: distance,
|
|
823
776
|
y2: distance
|
|
824
777
|
});
|
|
825
|
-
var schematic_trace =
|
|
826
|
-
type:
|
|
827
|
-
schematic_trace_id:
|
|
828
|
-
source_trace_id:
|
|
829
|
-
edges:
|
|
830
|
-
|
|
831
|
-
from:
|
|
832
|
-
x:
|
|
833
|
-
y:
|
|
778
|
+
var schematic_trace = z26.object({
|
|
779
|
+
type: z26.literal("schematic_trace"),
|
|
780
|
+
schematic_trace_id: z26.string(),
|
|
781
|
+
source_trace_id: z26.string(),
|
|
782
|
+
edges: z26.array(
|
|
783
|
+
z26.object({
|
|
784
|
+
from: z26.object({
|
|
785
|
+
x: z26.number(),
|
|
786
|
+
y: z26.number()
|
|
834
787
|
}),
|
|
835
|
-
to:
|
|
836
|
-
x:
|
|
837
|
-
y:
|
|
788
|
+
to: z26.object({
|
|
789
|
+
x: z26.number(),
|
|
790
|
+
y: z26.number()
|
|
838
791
|
}),
|
|
839
|
-
from_schematic_port_id:
|
|
840
|
-
to_schematic_port_id:
|
|
792
|
+
from_schematic_port_id: z26.string().optional(),
|
|
793
|
+
to_schematic_port_id: z26.string().optional()
|
|
841
794
|
})
|
|
842
795
|
)
|
|
843
796
|
});
|
|
844
|
-
var schematic_text =
|
|
845
|
-
type:
|
|
846
|
-
schematic_component_id:
|
|
847
|
-
schematic_text_id:
|
|
848
|
-
text:
|
|
849
|
-
position:
|
|
797
|
+
var schematic_text = z27.object({
|
|
798
|
+
type: z27.literal("schematic_text"),
|
|
799
|
+
schematic_component_id: z27.string(),
|
|
800
|
+
schematic_text_id: z27.string(),
|
|
801
|
+
text: z27.string(),
|
|
802
|
+
position: z27.object({
|
|
850
803
|
x: distance,
|
|
851
804
|
y: distance
|
|
852
805
|
}),
|
|
853
|
-
rotation:
|
|
854
|
-
anchor:
|
|
855
|
-
});
|
|
856
|
-
var schematic_port =
|
|
857
|
-
type:
|
|
858
|
-
schematic_port_id:
|
|
859
|
-
source_port_id:
|
|
860
|
-
schematic_component_id:
|
|
806
|
+
rotation: z27.number().default(0),
|
|
807
|
+
anchor: z27.enum(["center", "left", "right", "top", "bottom"]).default("center")
|
|
808
|
+
});
|
|
809
|
+
var schematic_port = z28.object({
|
|
810
|
+
type: z28.literal("schematic_port"),
|
|
811
|
+
schematic_port_id: z28.string(),
|
|
812
|
+
source_port_id: z28.string(),
|
|
813
|
+
schematic_component_id: z28.string().optional(),
|
|
861
814
|
center: point,
|
|
862
|
-
facing_direction:
|
|
815
|
+
facing_direction: z28.enum(["up", "down", "left", "right"]).optional()
|
|
863
816
|
}).describe("Defines a port on a schematic component");
|
|
864
|
-
var schematic_net_label =
|
|
865
|
-
type:
|
|
866
|
-
source_net_id:
|
|
817
|
+
var schematic_net_label = z29.object({
|
|
818
|
+
type: z29.literal("schematic_net_label"),
|
|
819
|
+
source_net_id: z29.string(),
|
|
867
820
|
center: point,
|
|
868
|
-
anchor_side:
|
|
869
|
-
text:
|
|
821
|
+
anchor_side: z29.enum(["top", "bottom", "left", "right"]),
|
|
822
|
+
text: z29.string()
|
|
870
823
|
});
|
|
871
|
-
var schematic_error =
|
|
872
|
-
schematic_error_id:
|
|
873
|
-
type:
|
|
824
|
+
var schematic_error = z30.object({
|
|
825
|
+
schematic_error_id: z30.string(),
|
|
826
|
+
type: z30.literal("schematic_error"),
|
|
874
827
|
// eventually each error type should be broken out into a dir of files
|
|
875
|
-
error_type:
|
|
876
|
-
message:
|
|
828
|
+
error_type: z30.literal("schematic_port_not_found"),
|
|
829
|
+
message: z30.string()
|
|
877
830
|
}).describe("Defines a schematic error on the schematic");
|
|
878
831
|
var all_layers = [
|
|
879
832
|
"top",
|
|
@@ -885,9 +838,9 @@ var all_layers = [
|
|
|
885
838
|
"inner5",
|
|
886
839
|
"inner6"
|
|
887
840
|
];
|
|
888
|
-
var layer_string =
|
|
841
|
+
var layer_string = z31.enum(all_layers);
|
|
889
842
|
var layer_ref = layer_string.or(
|
|
890
|
-
|
|
843
|
+
z31.object({
|
|
891
844
|
name: layer_string
|
|
892
845
|
})
|
|
893
846
|
).transform((layer) => {
|
|
@@ -896,27 +849,27 @@ var layer_ref = layer_string.or(
|
|
|
896
849
|
}
|
|
897
850
|
return layer.name;
|
|
898
851
|
});
|
|
899
|
-
var visible_layer =
|
|
900
|
-
var pcb_route_hint =
|
|
852
|
+
var visible_layer = z31.enum(["top", "bottom"]);
|
|
853
|
+
var pcb_route_hint = z32.object({
|
|
901
854
|
x: distance,
|
|
902
855
|
y: distance,
|
|
903
|
-
via:
|
|
856
|
+
via: z32.boolean().optional(),
|
|
904
857
|
via_to_layer: layer_ref.optional()
|
|
905
858
|
});
|
|
906
|
-
var pcb_route_hints =
|
|
907
|
-
var route_hint_point =
|
|
859
|
+
var pcb_route_hints = z32.array(pcb_route_hint);
|
|
860
|
+
var route_hint_point = z33.object({
|
|
908
861
|
x: distance,
|
|
909
862
|
y: distance,
|
|
910
|
-
via:
|
|
863
|
+
via: z33.boolean().optional(),
|
|
911
864
|
to_layer: layer_ref.optional(),
|
|
912
865
|
trace_width: distance.optional()
|
|
913
866
|
});
|
|
914
867
|
var expectTypesMatch = (shouldBe) => {
|
|
915
868
|
};
|
|
916
|
-
var pcb_component =
|
|
917
|
-
type:
|
|
869
|
+
var pcb_component = z34.object({
|
|
870
|
+
type: z34.literal("pcb_component"),
|
|
918
871
|
pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
|
|
919
|
-
source_component_id:
|
|
872
|
+
source_component_id: z34.string(),
|
|
920
873
|
center: point,
|
|
921
874
|
layer: layer_ref,
|
|
922
875
|
rotation,
|
|
@@ -924,11 +877,11 @@ var pcb_component = import_zod35.z.object({
|
|
|
924
877
|
height: length
|
|
925
878
|
}).describe("Defines a component on the PCB");
|
|
926
879
|
expectTypesMatch(true);
|
|
927
|
-
var pcb_hole_circle_or_square =
|
|
928
|
-
type:
|
|
880
|
+
var pcb_hole_circle_or_square = z35.object({
|
|
881
|
+
type: z35.literal("pcb_hole"),
|
|
929
882
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
930
|
-
hole_shape:
|
|
931
|
-
hole_diameter:
|
|
883
|
+
hole_shape: z35.enum(["circle", "square"]),
|
|
884
|
+
hole_diameter: z35.number(),
|
|
932
885
|
x: distance,
|
|
933
886
|
y: distance
|
|
934
887
|
});
|
|
@@ -936,12 +889,12 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
|
|
|
936
889
|
"Defines a circular or square hole on the PCB"
|
|
937
890
|
);
|
|
938
891
|
expectTypesMatch(true);
|
|
939
|
-
var pcb_hole_oval =
|
|
940
|
-
type:
|
|
892
|
+
var pcb_hole_oval = z35.object({
|
|
893
|
+
type: z35.literal("pcb_hole"),
|
|
941
894
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
942
|
-
hole_shape:
|
|
943
|
-
hole_width:
|
|
944
|
-
hole_height:
|
|
895
|
+
hole_shape: z35.literal("oval"),
|
|
896
|
+
hole_width: z35.number(),
|
|
897
|
+
hole_height: z35.number(),
|
|
945
898
|
x: distance,
|
|
946
899
|
y: distance
|
|
947
900
|
});
|
|
@@ -950,35 +903,35 @@ var pcb_hole_oval_shape = pcb_hole_oval.describe(
|
|
|
950
903
|
);
|
|
951
904
|
expectTypesMatch(true);
|
|
952
905
|
var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
|
|
953
|
-
var pcb_plated_hole_circle =
|
|
954
|
-
type:
|
|
955
|
-
shape:
|
|
956
|
-
outer_diameter:
|
|
957
|
-
hole_diameter:
|
|
906
|
+
var pcb_plated_hole_circle = z36.object({
|
|
907
|
+
type: z36.literal("pcb_plated_hole"),
|
|
908
|
+
shape: z36.literal("circle"),
|
|
909
|
+
outer_diameter: z36.number(),
|
|
910
|
+
hole_diameter: z36.number(),
|
|
958
911
|
x: distance,
|
|
959
912
|
y: distance,
|
|
960
|
-
layers:
|
|
961
|
-
port_hints:
|
|
962
|
-
pcb_component_id:
|
|
963
|
-
pcb_port_id:
|
|
913
|
+
layers: z36.array(layer_ref),
|
|
914
|
+
port_hints: z36.array(z36.string()).optional(),
|
|
915
|
+
pcb_component_id: z36.string().optional(),
|
|
916
|
+
pcb_port_id: z36.string().optional(),
|
|
964
917
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
965
918
|
});
|
|
966
|
-
var pcb_plated_hole_oval =
|
|
967
|
-
type:
|
|
968
|
-
shape:
|
|
969
|
-
outer_width:
|
|
970
|
-
outer_height:
|
|
971
|
-
hole_width:
|
|
972
|
-
hole_height:
|
|
919
|
+
var pcb_plated_hole_oval = z36.object({
|
|
920
|
+
type: z36.literal("pcb_plated_hole"),
|
|
921
|
+
shape: z36.enum(["oval", "pill"]),
|
|
922
|
+
outer_width: z36.number(),
|
|
923
|
+
outer_height: z36.number(),
|
|
924
|
+
hole_width: z36.number(),
|
|
925
|
+
hole_height: z36.number(),
|
|
973
926
|
x: distance,
|
|
974
927
|
y: distance,
|
|
975
|
-
layers:
|
|
976
|
-
port_hints:
|
|
977
|
-
pcb_component_id:
|
|
978
|
-
pcb_port_id:
|
|
928
|
+
layers: z36.array(layer_ref),
|
|
929
|
+
port_hints: z36.array(z36.string()).optional(),
|
|
930
|
+
pcb_component_id: z36.string().optional(),
|
|
931
|
+
pcb_port_id: z36.string().optional(),
|
|
979
932
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
980
933
|
});
|
|
981
|
-
var pcb_plated_hole =
|
|
934
|
+
var pcb_plated_hole = z36.union([
|
|
982
935
|
pcb_plated_hole_circle,
|
|
983
936
|
pcb_plated_hole_oval
|
|
984
937
|
]);
|
|
@@ -986,154 +939,154 @@ expectTypesMatch(
|
|
|
986
939
|
true
|
|
987
940
|
);
|
|
988
941
|
expectTypesMatch(true);
|
|
989
|
-
var pcb_port =
|
|
990
|
-
type:
|
|
942
|
+
var pcb_port = z37.object({
|
|
943
|
+
type: z37.literal("pcb_port"),
|
|
991
944
|
pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
|
|
992
|
-
source_port_id:
|
|
993
|
-
pcb_component_id:
|
|
945
|
+
source_port_id: z37.string(),
|
|
946
|
+
pcb_component_id: z37.string(),
|
|
994
947
|
x: distance,
|
|
995
948
|
y: distance,
|
|
996
|
-
layers:
|
|
949
|
+
layers: z37.array(layer_ref)
|
|
997
950
|
}).describe("Defines a port on the PCB");
|
|
998
951
|
expectTypesMatch(true);
|
|
999
|
-
var pcb_smtpad_circle =
|
|
1000
|
-
type:
|
|
1001
|
-
shape:
|
|
952
|
+
var pcb_smtpad_circle = z38.object({
|
|
953
|
+
type: z38.literal("pcb_smtpad"),
|
|
954
|
+
shape: z38.literal("circle"),
|
|
1002
955
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1003
956
|
x: distance,
|
|
1004
957
|
y: distance,
|
|
1005
|
-
radius:
|
|
958
|
+
radius: z38.number(),
|
|
1006
959
|
layer: layer_ref,
|
|
1007
|
-
port_hints:
|
|
1008
|
-
pcb_component_id:
|
|
1009
|
-
pcb_port_id:
|
|
960
|
+
port_hints: z38.array(z38.string()).optional(),
|
|
961
|
+
pcb_component_id: z38.string().optional(),
|
|
962
|
+
pcb_port_id: z38.string().optional()
|
|
1010
963
|
});
|
|
1011
|
-
var pcb_smtpad_rect =
|
|
1012
|
-
type:
|
|
1013
|
-
shape:
|
|
964
|
+
var pcb_smtpad_rect = z38.object({
|
|
965
|
+
type: z38.literal("pcb_smtpad"),
|
|
966
|
+
shape: z38.literal("rect"),
|
|
1014
967
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1015
968
|
x: distance,
|
|
1016
969
|
y: distance,
|
|
1017
|
-
width:
|
|
1018
|
-
height:
|
|
970
|
+
width: z38.number(),
|
|
971
|
+
height: z38.number(),
|
|
1019
972
|
layer: layer_ref,
|
|
1020
|
-
port_hints:
|
|
1021
|
-
pcb_component_id:
|
|
1022
|
-
pcb_port_id:
|
|
973
|
+
port_hints: z38.array(z38.string()).optional(),
|
|
974
|
+
pcb_component_id: z38.string().optional(),
|
|
975
|
+
pcb_port_id: z38.string().optional()
|
|
1023
976
|
});
|
|
1024
|
-
var pcb_smtpad =
|
|
977
|
+
var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
|
|
1025
978
|
expectTypesMatch(true);
|
|
1026
979
|
expectTypesMatch(true);
|
|
1027
|
-
var pcb_solder_paste_circle =
|
|
1028
|
-
type:
|
|
1029
|
-
shape:
|
|
980
|
+
var pcb_solder_paste_circle = z39.object({
|
|
981
|
+
type: z39.literal("pcb_solder_paste"),
|
|
982
|
+
shape: z39.literal("circle"),
|
|
1030
983
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1031
984
|
x: distance,
|
|
1032
985
|
y: distance,
|
|
1033
|
-
radius:
|
|
986
|
+
radius: z39.number(),
|
|
1034
987
|
layer: layer_ref,
|
|
1035
|
-
pcb_component_id:
|
|
1036
|
-
pcb_smtpad_id:
|
|
988
|
+
pcb_component_id: z39.string().optional(),
|
|
989
|
+
pcb_smtpad_id: z39.string().optional()
|
|
1037
990
|
});
|
|
1038
|
-
var pcb_solder_paste_rect =
|
|
1039
|
-
type:
|
|
1040
|
-
shape:
|
|
991
|
+
var pcb_solder_paste_rect = z39.object({
|
|
992
|
+
type: z39.literal("pcb_solder_paste"),
|
|
993
|
+
shape: z39.literal("rect"),
|
|
1041
994
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1042
995
|
x: distance,
|
|
1043
996
|
y: distance,
|
|
1044
|
-
width:
|
|
1045
|
-
height:
|
|
997
|
+
width: z39.number(),
|
|
998
|
+
height: z39.number(),
|
|
1046
999
|
layer: layer_ref,
|
|
1047
|
-
pcb_component_id:
|
|
1048
|
-
pcb_smtpad_id:
|
|
1000
|
+
pcb_component_id: z39.string().optional(),
|
|
1001
|
+
pcb_smtpad_id: z39.string().optional()
|
|
1049
1002
|
});
|
|
1050
|
-
var pcb_solder_paste =
|
|
1003
|
+
var pcb_solder_paste = z39.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
|
|
1051
1004
|
expectTypesMatch(true);
|
|
1052
1005
|
expectTypesMatch(true);
|
|
1053
|
-
var pcb_text =
|
|
1054
|
-
type:
|
|
1006
|
+
var pcb_text = z40.object({
|
|
1007
|
+
type: z40.literal("pcb_text"),
|
|
1055
1008
|
pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
|
|
1056
|
-
text:
|
|
1009
|
+
text: z40.string(),
|
|
1057
1010
|
center: point,
|
|
1058
1011
|
layer: layer_ref,
|
|
1059
1012
|
width: length,
|
|
1060
1013
|
height: length,
|
|
1061
|
-
lines:
|
|
1062
|
-
align:
|
|
1014
|
+
lines: z40.number(),
|
|
1015
|
+
align: z40.enum(["bottom-left"])
|
|
1063
1016
|
}).describe("Defines text on the PCB");
|
|
1064
1017
|
expectTypesMatch(true);
|
|
1065
|
-
var pcb_trace_route_point_wire =
|
|
1066
|
-
route_type:
|
|
1018
|
+
var pcb_trace_route_point_wire = z41.object({
|
|
1019
|
+
route_type: z41.literal("wire"),
|
|
1067
1020
|
x: distance,
|
|
1068
1021
|
y: distance,
|
|
1069
1022
|
width: distance,
|
|
1070
|
-
start_pcb_port_id:
|
|
1071
|
-
end_pcb_port_id:
|
|
1023
|
+
start_pcb_port_id: z41.string().optional(),
|
|
1024
|
+
end_pcb_port_id: z41.string().optional(),
|
|
1072
1025
|
layer: layer_ref
|
|
1073
1026
|
});
|
|
1074
|
-
var pcb_trace_route_point_via =
|
|
1075
|
-
route_type:
|
|
1027
|
+
var pcb_trace_route_point_via = z41.object({
|
|
1028
|
+
route_type: z41.literal("via"),
|
|
1076
1029
|
x: distance,
|
|
1077
1030
|
y: distance,
|
|
1078
|
-
from_layer:
|
|
1079
|
-
to_layer:
|
|
1031
|
+
from_layer: z41.string(),
|
|
1032
|
+
to_layer: z41.string()
|
|
1080
1033
|
});
|
|
1081
|
-
var pcb_trace_route_point =
|
|
1034
|
+
var pcb_trace_route_point = z41.union([
|
|
1082
1035
|
pcb_trace_route_point_wire,
|
|
1083
1036
|
pcb_trace_route_point_via
|
|
1084
1037
|
]);
|
|
1085
|
-
var pcb_trace =
|
|
1086
|
-
type:
|
|
1087
|
-
source_trace_id:
|
|
1088
|
-
pcb_component_id:
|
|
1038
|
+
var pcb_trace = z41.object({
|
|
1039
|
+
type: z41.literal("pcb_trace"),
|
|
1040
|
+
source_trace_id: z41.string().optional(),
|
|
1041
|
+
pcb_component_id: z41.string().optional(),
|
|
1089
1042
|
pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
|
|
1090
|
-
route_thickness_mode:
|
|
1091
|
-
route_order_index:
|
|
1092
|
-
should_round_corners:
|
|
1093
|
-
route:
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
route_type:
|
|
1043
|
+
route_thickness_mode: z41.enum(["constant", "interpolated"]).default("constant").optional(),
|
|
1044
|
+
route_order_index: z41.number().optional(),
|
|
1045
|
+
should_round_corners: z41.boolean().optional(),
|
|
1046
|
+
route: z41.array(
|
|
1047
|
+
z41.union([
|
|
1048
|
+
z41.object({
|
|
1049
|
+
route_type: z41.literal("wire"),
|
|
1097
1050
|
x: distance,
|
|
1098
1051
|
y: distance,
|
|
1099
1052
|
width: distance,
|
|
1100
|
-
start_pcb_port_id:
|
|
1101
|
-
end_pcb_port_id:
|
|
1053
|
+
start_pcb_port_id: z41.string().optional(),
|
|
1054
|
+
end_pcb_port_id: z41.string().optional(),
|
|
1102
1055
|
layer: layer_ref
|
|
1103
1056
|
}),
|
|
1104
|
-
|
|
1105
|
-
route_type:
|
|
1057
|
+
z41.object({
|
|
1058
|
+
route_type: z41.literal("via"),
|
|
1106
1059
|
x: distance,
|
|
1107
1060
|
y: distance,
|
|
1108
|
-
from_layer:
|
|
1109
|
-
to_layer:
|
|
1061
|
+
from_layer: z41.string(),
|
|
1062
|
+
to_layer: z41.string()
|
|
1110
1063
|
})
|
|
1111
1064
|
])
|
|
1112
1065
|
)
|
|
1113
1066
|
}).describe("Defines a trace on the PCB");
|
|
1114
1067
|
expectTypesMatch(true);
|
|
1115
1068
|
expectTypesMatch(true);
|
|
1116
|
-
var pcb_trace_error =
|
|
1117
|
-
type:
|
|
1069
|
+
var pcb_trace_error = z42.object({
|
|
1070
|
+
type: z42.literal("pcb_trace_error"),
|
|
1118
1071
|
pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
|
|
1119
|
-
error_type:
|
|
1120
|
-
message:
|
|
1072
|
+
error_type: z42.literal("pcb_trace_error"),
|
|
1073
|
+
message: z42.string(),
|
|
1121
1074
|
center: point.optional(),
|
|
1122
|
-
pcb_trace_id:
|
|
1123
|
-
source_trace_id:
|
|
1124
|
-
pcb_component_ids:
|
|
1125
|
-
pcb_port_ids:
|
|
1075
|
+
pcb_trace_id: z42.string(),
|
|
1076
|
+
source_trace_id: z42.string(),
|
|
1077
|
+
pcb_component_ids: z42.array(z42.string()),
|
|
1078
|
+
pcb_port_ids: z42.array(z42.string())
|
|
1126
1079
|
}).describe("Defines a trace error on the PCB");
|
|
1127
1080
|
expectTypesMatch(true);
|
|
1128
|
-
var pcb_port_not_matched_error =
|
|
1129
|
-
type:
|
|
1081
|
+
var pcb_port_not_matched_error = z43.object({
|
|
1082
|
+
type: z43.literal("pcb_port_not_matched_error"),
|
|
1130
1083
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
1131
|
-
message:
|
|
1132
|
-
pcb_component_ids:
|
|
1084
|
+
message: z43.string(),
|
|
1085
|
+
pcb_component_ids: z43.array(z43.string())
|
|
1133
1086
|
}).describe("Defines a trace error on the PCB where a port is not matched");
|
|
1134
1087
|
expectTypesMatch(true);
|
|
1135
|
-
var pcb_via =
|
|
1136
|
-
type:
|
|
1088
|
+
var pcb_via = z44.object({
|
|
1089
|
+
type: z44.literal("pcb_via"),
|
|
1137
1090
|
pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
|
|
1138
1091
|
x: distance,
|
|
1139
1092
|
y: distance,
|
|
@@ -1143,39 +1096,39 @@ var pcb_via = import_zod45.z.object({
|
|
|
1143
1096
|
from_layer: layer_ref.optional(),
|
|
1144
1097
|
/** @deprecated */
|
|
1145
1098
|
to_layer: layer_ref.optional(),
|
|
1146
|
-
layers:
|
|
1147
|
-
pcb_trace_id:
|
|
1099
|
+
layers: z44.array(layer_ref),
|
|
1100
|
+
pcb_trace_id: z44.string().optional()
|
|
1148
1101
|
}).describe("Defines a via on the PCB");
|
|
1149
1102
|
expectTypesMatch(true);
|
|
1150
|
-
var pcb_board =
|
|
1151
|
-
type:
|
|
1103
|
+
var pcb_board = z45.object({
|
|
1104
|
+
type: z45.literal("pcb_board"),
|
|
1152
1105
|
pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
|
|
1153
1106
|
width: length,
|
|
1154
1107
|
height: length,
|
|
1155
1108
|
center: point,
|
|
1156
1109
|
thickness: length.optional().default(1.4),
|
|
1157
|
-
num_layers:
|
|
1158
|
-
outline:
|
|
1110
|
+
num_layers: z45.number().optional().default(4),
|
|
1111
|
+
outline: z45.array(point).optional()
|
|
1159
1112
|
}).describe("Defines the board outline of the PCB");
|
|
1160
1113
|
expectTypesMatch(true);
|
|
1161
|
-
var pcb_placement_error =
|
|
1162
|
-
type:
|
|
1114
|
+
var pcb_placement_error = z46.object({
|
|
1115
|
+
type: z46.literal("pcb_placement_error"),
|
|
1163
1116
|
pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
|
|
1164
|
-
message:
|
|
1117
|
+
message: z46.string()
|
|
1165
1118
|
}).describe("Defines a placement error on the PCB");
|
|
1166
1119
|
expectTypesMatch(true);
|
|
1167
|
-
var pcb_trace_hint =
|
|
1168
|
-
type:
|
|
1120
|
+
var pcb_trace_hint = z47.object({
|
|
1121
|
+
type: z47.literal("pcb_trace_hint"),
|
|
1169
1122
|
pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
|
|
1170
|
-
pcb_port_id:
|
|
1171
|
-
pcb_component_id:
|
|
1172
|
-
route:
|
|
1123
|
+
pcb_port_id: z47.string(),
|
|
1124
|
+
pcb_component_id: z47.string(),
|
|
1125
|
+
route: z47.array(route_hint_point)
|
|
1173
1126
|
}).describe("A hint that can be used during generation of a PCB trace");
|
|
1174
1127
|
expectTypesMatch(true);
|
|
1175
|
-
var pcb_silkscreen_line =
|
|
1176
|
-
type:
|
|
1128
|
+
var pcb_silkscreen_line = z48.object({
|
|
1129
|
+
type: z48.literal("pcb_silkscreen_line"),
|
|
1177
1130
|
pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
|
|
1178
|
-
pcb_component_id:
|
|
1131
|
+
pcb_component_id: z48.string(),
|
|
1179
1132
|
stroke_width: distance.default("0.1mm"),
|
|
1180
1133
|
x1: distance,
|
|
1181
1134
|
y1: distance,
|
|
@@ -1184,131 +1137,131 @@ var pcb_silkscreen_line = import_zod49.z.object({
|
|
|
1184
1137
|
layer: visible_layer
|
|
1185
1138
|
}).describe("Defines a silkscreen line on the PCB");
|
|
1186
1139
|
expectTypesMatch(true);
|
|
1187
|
-
var pcb_silkscreen_path =
|
|
1188
|
-
type:
|
|
1140
|
+
var pcb_silkscreen_path = z49.object({
|
|
1141
|
+
type: z49.literal("pcb_silkscreen_path"),
|
|
1189
1142
|
pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
|
|
1190
|
-
pcb_component_id:
|
|
1143
|
+
pcb_component_id: z49.string(),
|
|
1191
1144
|
layer: visible_layer,
|
|
1192
|
-
route:
|
|
1145
|
+
route: z49.array(point),
|
|
1193
1146
|
stroke_width: length
|
|
1194
1147
|
}).describe("Defines a silkscreen path on the PCB");
|
|
1195
1148
|
expectTypesMatch(true);
|
|
1196
|
-
var pcb_silkscreen_text =
|
|
1197
|
-
type:
|
|
1149
|
+
var pcb_silkscreen_text = z50.object({
|
|
1150
|
+
type: z50.literal("pcb_silkscreen_text"),
|
|
1198
1151
|
pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
|
|
1199
|
-
font:
|
|
1152
|
+
font: z50.literal("tscircuit2024").default("tscircuit2024"),
|
|
1200
1153
|
font_size: distance.default("0.2mm"),
|
|
1201
|
-
pcb_component_id:
|
|
1202
|
-
text:
|
|
1154
|
+
pcb_component_id: z50.string(),
|
|
1155
|
+
text: z50.string(),
|
|
1203
1156
|
layer: layer_ref,
|
|
1204
|
-
is_mirrored:
|
|
1157
|
+
is_mirrored: z50.boolean().default(false).optional(),
|
|
1205
1158
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
1206
|
-
anchor_alignment:
|
|
1159
|
+
anchor_alignment: z50.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
|
|
1207
1160
|
}).describe("Defines silkscreen text on the PCB");
|
|
1208
1161
|
expectTypesMatch(true);
|
|
1209
|
-
var pcb_silkscreen_rect =
|
|
1210
|
-
type:
|
|
1162
|
+
var pcb_silkscreen_rect = z51.object({
|
|
1163
|
+
type: z51.literal("pcb_silkscreen_rect"),
|
|
1211
1164
|
pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
|
|
1212
|
-
pcb_component_id:
|
|
1165
|
+
pcb_component_id: z51.string(),
|
|
1213
1166
|
center: point,
|
|
1214
1167
|
width: length,
|
|
1215
1168
|
height: length,
|
|
1216
1169
|
layer: layer_ref
|
|
1217
1170
|
}).describe("Defines a silkscreen rect on the PCB");
|
|
1218
1171
|
expectTypesMatch(true);
|
|
1219
|
-
var pcb_silkscreen_circle =
|
|
1220
|
-
type:
|
|
1172
|
+
var pcb_silkscreen_circle = z52.object({
|
|
1173
|
+
type: z52.literal("pcb_silkscreen_circle"),
|
|
1221
1174
|
pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
|
|
1222
1175
|
"pcb_silkscreen_circle"
|
|
1223
1176
|
),
|
|
1224
|
-
pcb_component_id:
|
|
1177
|
+
pcb_component_id: z52.string(),
|
|
1225
1178
|
center: point,
|
|
1226
1179
|
radius: length,
|
|
1227
1180
|
layer: visible_layer
|
|
1228
1181
|
}).describe("Defines a silkscreen circle on the PCB");
|
|
1229
1182
|
expectTypesMatch(true);
|
|
1230
|
-
var pcb_silkscreen_oval =
|
|
1231
|
-
type:
|
|
1183
|
+
var pcb_silkscreen_oval = z53.object({
|
|
1184
|
+
type: z53.literal("pcb_silkscreen_oval"),
|
|
1232
1185
|
pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
|
|
1233
|
-
pcb_component_id:
|
|
1186
|
+
pcb_component_id: z53.string(),
|
|
1234
1187
|
center: point,
|
|
1235
1188
|
radius_x: distance,
|
|
1236
1189
|
radius_y: distance,
|
|
1237
1190
|
layer: visible_layer
|
|
1238
1191
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
1239
1192
|
expectTypesMatch(true);
|
|
1240
|
-
var pcb_fabrication_note_text =
|
|
1241
|
-
type:
|
|
1193
|
+
var pcb_fabrication_note_text = z54.object({
|
|
1194
|
+
type: z54.literal("pcb_fabrication_note_text"),
|
|
1242
1195
|
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
|
|
1243
1196
|
"pcb_fabrication_note_text"
|
|
1244
1197
|
),
|
|
1245
|
-
font:
|
|
1198
|
+
font: z54.literal("tscircuit2024").default("tscircuit2024"),
|
|
1246
1199
|
font_size: distance.default("1mm"),
|
|
1247
|
-
pcb_component_id:
|
|
1248
|
-
text:
|
|
1200
|
+
pcb_component_id: z54.string(),
|
|
1201
|
+
text: z54.string(),
|
|
1249
1202
|
layer: visible_layer,
|
|
1250
1203
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
1251
|
-
anchor_alignment:
|
|
1252
|
-
color:
|
|
1204
|
+
anchor_alignment: z54.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
1205
|
+
color: z54.string().optional()
|
|
1253
1206
|
}).describe(
|
|
1254
1207
|
"Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
|
|
1255
1208
|
);
|
|
1256
1209
|
expectTypesMatch(true);
|
|
1257
|
-
var pcb_fabrication_note_path =
|
|
1258
|
-
type:
|
|
1210
|
+
var pcb_fabrication_note_path = z55.object({
|
|
1211
|
+
type: z55.literal("pcb_fabrication_note_path"),
|
|
1259
1212
|
pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
|
|
1260
1213
|
"pcb_fabrication_note_path"
|
|
1261
1214
|
),
|
|
1262
|
-
pcb_component_id:
|
|
1215
|
+
pcb_component_id: z55.string(),
|
|
1263
1216
|
layer: layer_ref,
|
|
1264
|
-
route:
|
|
1217
|
+
route: z55.array(point),
|
|
1265
1218
|
stroke_width: length,
|
|
1266
|
-
color:
|
|
1219
|
+
color: z55.string().optional()
|
|
1267
1220
|
}).describe(
|
|
1268
1221
|
"Defines a fabrication path on the PCB for fabricators or assemblers"
|
|
1269
1222
|
);
|
|
1270
1223
|
expectTypesMatch(true);
|
|
1271
|
-
var pcb_keepout =
|
|
1272
|
-
type:
|
|
1273
|
-
shape:
|
|
1224
|
+
var pcb_keepout = z56.object({
|
|
1225
|
+
type: z56.literal("pcb_keepout"),
|
|
1226
|
+
shape: z56.literal("rect"),
|
|
1274
1227
|
center: point,
|
|
1275
1228
|
width: distance,
|
|
1276
1229
|
height: distance,
|
|
1277
|
-
pcb_keepout_id:
|
|
1278
|
-
layers:
|
|
1230
|
+
pcb_keepout_id: z56.string(),
|
|
1231
|
+
layers: z56.array(z56.string()),
|
|
1279
1232
|
// Specify layers where the keepout applies
|
|
1280
|
-
description:
|
|
1233
|
+
description: z56.string().optional()
|
|
1281
1234
|
// Optional description of the keepout
|
|
1282
1235
|
}).or(
|
|
1283
|
-
|
|
1284
|
-
type:
|
|
1285
|
-
shape:
|
|
1236
|
+
z56.object({
|
|
1237
|
+
type: z56.literal("pcb_keepout"),
|
|
1238
|
+
shape: z56.literal("circle"),
|
|
1286
1239
|
center: point,
|
|
1287
1240
|
radius: distance,
|
|
1288
|
-
pcb_keepout_id:
|
|
1289
|
-
layers:
|
|
1241
|
+
pcb_keepout_id: z56.string(),
|
|
1242
|
+
layers: z56.array(z56.string()),
|
|
1290
1243
|
// Specify layers where the keepout applies
|
|
1291
|
-
description:
|
|
1244
|
+
description: z56.string().optional()
|
|
1292
1245
|
// Optional description of the keepout
|
|
1293
1246
|
})
|
|
1294
1247
|
);
|
|
1295
|
-
var cad_component =
|
|
1296
|
-
type:
|
|
1297
|
-
cad_component_id:
|
|
1298
|
-
pcb_component_id:
|
|
1299
|
-
source_component_id:
|
|
1248
|
+
var cad_component = z57.object({
|
|
1249
|
+
type: z57.literal("cad_component"),
|
|
1250
|
+
cad_component_id: z57.string(),
|
|
1251
|
+
pcb_component_id: z57.string(),
|
|
1252
|
+
source_component_id: z57.string(),
|
|
1300
1253
|
position: point3,
|
|
1301
1254
|
rotation: point3.optional(),
|
|
1302
1255
|
size: point3.optional(),
|
|
1303
1256
|
layer: layer_ref.optional(),
|
|
1304
1257
|
// These are all ways to generate/load the 3d model
|
|
1305
|
-
footprinter_string:
|
|
1306
|
-
model_obj_url:
|
|
1307
|
-
model_stl_url:
|
|
1308
|
-
model_3mf_url:
|
|
1309
|
-
model_jscad:
|
|
1258
|
+
footprinter_string: z57.string().optional(),
|
|
1259
|
+
model_obj_url: z57.string().optional(),
|
|
1260
|
+
model_stl_url: z57.string().optional(),
|
|
1261
|
+
model_3mf_url: z57.string().optional(),
|
|
1262
|
+
model_jscad: z57.any().optional()
|
|
1310
1263
|
}).describe("Defines a component on the PCB");
|
|
1311
|
-
var any_circuit_element =
|
|
1264
|
+
var any_circuit_element = z58.union([
|
|
1312
1265
|
source_trace,
|
|
1313
1266
|
source_port,
|
|
1314
1267
|
any_source_component,
|
|
@@ -1403,7 +1356,7 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
1403
1356
|
}
|
|
1404
1357
|
|
|
1405
1358
|
// node_modules/@tscircuit/soup-util/dist/index.js
|
|
1406
|
-
|
|
1359
|
+
import { applyToPoint, decomposeTSR } from "transformation-matrix";
|
|
1407
1360
|
var su = (soup, options = {}) => {
|
|
1408
1361
|
let internalStore = soup._internal_store;
|
|
1409
1362
|
if (!internalStore) {
|
|
@@ -1539,18 +1492,18 @@ su.unparsed = su;
|
|
|
1539
1492
|
var su_default = su;
|
|
1540
1493
|
var transformPCBElement = (elm, matrix) => {
|
|
1541
1494
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
1542
|
-
const { x, y } =
|
|
1495
|
+
const { x, y } = applyToPoint(matrix, { x: elm.x, y: elm.y });
|
|
1543
1496
|
elm.x = x;
|
|
1544
1497
|
elm.y = y;
|
|
1545
1498
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
1546
|
-
elm.center =
|
|
1499
|
+
elm.center = applyToPoint(matrix, elm.center);
|
|
1547
1500
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text") {
|
|
1548
|
-
elm.anchor_position =
|
|
1501
|
+
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
1549
1502
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_component") {
|
|
1550
|
-
elm.center =
|
|
1503
|
+
elm.center = applyToPoint(matrix, elm.center);
|
|
1551
1504
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path") {
|
|
1552
1505
|
elm.route = elm.route.map((rp) => {
|
|
1553
|
-
const tp =
|
|
1506
|
+
const tp = applyToPoint(matrix, rp);
|
|
1554
1507
|
rp.x = tp.x;
|
|
1555
1508
|
rp.y = tp.y;
|
|
1556
1509
|
return rp;
|
|
@@ -1558,14 +1511,14 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
1558
1511
|
} else if (elm.type === "pcb_silkscreen_line") {
|
|
1559
1512
|
const p1 = { x: elm.x1, y: elm.y1 };
|
|
1560
1513
|
const p2 = { x: elm.x2, y: elm.y2 };
|
|
1561
|
-
const p1t =
|
|
1562
|
-
const p2t =
|
|
1514
|
+
const p1t = applyToPoint(matrix, p1);
|
|
1515
|
+
const p2t = applyToPoint(matrix, p2);
|
|
1563
1516
|
elm.x1 = p1t.x;
|
|
1564
1517
|
elm.y1 = p1t.y;
|
|
1565
1518
|
elm.x2 = p2t.x;
|
|
1566
1519
|
elm.y2 = p2t.y;
|
|
1567
1520
|
} else if (elm.type === "cad_component") {
|
|
1568
|
-
const newPos =
|
|
1521
|
+
const newPos = applyToPoint(matrix, {
|
|
1569
1522
|
x: elm.position.x,
|
|
1570
1523
|
y: elm.position.y
|
|
1571
1524
|
});
|
|
@@ -1575,7 +1528,7 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
1575
1528
|
return elm;
|
|
1576
1529
|
};
|
|
1577
1530
|
var transformPCBElements = (elms, matrix) => {
|
|
1578
|
-
const tsr =
|
|
1531
|
+
const tsr = decomposeTSR(matrix);
|
|
1579
1532
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
1580
1533
|
let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
|
|
1581
1534
|
if (flipPadWidthHeight) {
|
|
@@ -1591,18 +1544,18 @@ var transformPCBElements = (elms, matrix) => {
|
|
|
1591
1544
|
};
|
|
1592
1545
|
|
|
1593
1546
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1594
|
-
|
|
1547
|
+
import { scale, translate } from "transformation-matrix";
|
|
1595
1548
|
|
|
1596
1549
|
// lib/compute-center-offset.ts
|
|
1597
|
-
|
|
1550
|
+
import { mm } from "@tscircuit/mm";
|
|
1598
1551
|
var computeCenterOffset = (easyeda) => {
|
|
1599
1552
|
const pads = easyeda.packageDetail.dataStr.shape.filter(
|
|
1600
1553
|
(shape) => shape.type === "PAD"
|
|
1601
1554
|
);
|
|
1602
|
-
const minX = Math.min(...pads.map((pad) =>
|
|
1603
|
-
const maxX = Math.max(...pads.map((pad) =>
|
|
1604
|
-
const minY = Math.min(...pads.map((pad) =>
|
|
1605
|
-
const maxY = Math.max(...pads.map((pad) =>
|
|
1555
|
+
const minX = Math.min(...pads.map((pad) => mm(pad.center.x)));
|
|
1556
|
+
const maxX = Math.max(...pads.map((pad) => mm(pad.center.x)));
|
|
1557
|
+
const minY = Math.min(...pads.map((pad) => mm(pad.center.y)));
|
|
1558
|
+
const maxY = Math.max(...pads.map((pad) => mm(pad.center.y)));
|
|
1606
1559
|
const centerX = (minX + maxX) / 2;
|
|
1607
1560
|
const centerY = (minY + maxY) / 2;
|
|
1608
1561
|
return {
|
|
@@ -1612,7 +1565,7 @@ var computeCenterOffset = (easyeda) => {
|
|
|
1612
1565
|
};
|
|
1613
1566
|
|
|
1614
1567
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1615
|
-
|
|
1568
|
+
import { mm as mm2 } from "@tscircuit/mm";
|
|
1616
1569
|
var handleSilkscreenPath = (track, index) => {
|
|
1617
1570
|
return pcb_silkscreen_path.parse({
|
|
1618
1571
|
type: "pcb_silkscreen_path",
|
|
@@ -1676,17 +1629,17 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1676
1629
|
source_component_id: "source_component_1",
|
|
1677
1630
|
name: portNumber
|
|
1678
1631
|
});
|
|
1679
|
-
if (pad.holeRadius !== void 0 && (
|
|
1632
|
+
if (pad.holeRadius !== void 0 && mm2(pad.holeRadius) !== 0) {
|
|
1680
1633
|
soupElements.push(
|
|
1681
1634
|
pcb_plated_hole.parse({
|
|
1682
1635
|
type: "pcb_plated_hole",
|
|
1683
1636
|
pcb_plated_hole_id: `pcb_plated_hole_${index + 1}`,
|
|
1684
1637
|
shape: "circle",
|
|
1685
|
-
x: (
|
|
1686
|
-
y: (
|
|
1687
|
-
hole_diameter: (
|
|
1688
|
-
outer_diameter: (
|
|
1689
|
-
radius: (
|
|
1638
|
+
x: mm2(pad.center.x),
|
|
1639
|
+
y: mm2(pad.center.y),
|
|
1640
|
+
hole_diameter: mm2(pad.holeRadius) * 2,
|
|
1641
|
+
outer_diameter: mm2(pad.width),
|
|
1642
|
+
radius: mm2(pad.holeRadius),
|
|
1690
1643
|
port_hints: [portNumber],
|
|
1691
1644
|
pcb_component_id: "pcb_component_1",
|
|
1692
1645
|
pcb_port_id: `pcb_port_${index + 1}`,
|
|
@@ -1710,9 +1663,9 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1710
1663
|
type: "pcb_smtpad",
|
|
1711
1664
|
pcb_smtpad_id: `pcb_smtpad_${index + 1}`,
|
|
1712
1665
|
shape: soupShape,
|
|
1713
|
-
x: (
|
|
1714
|
-
y: (
|
|
1715
|
-
...soupShape === "rect" ? { width: (
|
|
1666
|
+
x: mm2(pad.center.x),
|
|
1667
|
+
y: mm2(pad.center.y),
|
|
1668
|
+
...soupShape === "rect" ? { width: mm2(pad.width), height: mm2(pad.height) } : { radius: Math.min(mm2(pad.width), mm2(pad.height)) / 2 },
|
|
1716
1669
|
layer: "top",
|
|
1717
1670
|
port_hints: [portNumber],
|
|
1718
1671
|
pcb_component_id: "pcb_component_1",
|
|
@@ -1728,7 +1681,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1728
1681
|
soupElements.push(handleSilkscreenArc(shape, index));
|
|
1729
1682
|
}
|
|
1730
1683
|
});
|
|
1731
|
-
transformPCBElements(soupElements,
|
|
1684
|
+
transformPCBElements(soupElements, scale(1, -1));
|
|
1732
1685
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
1733
1686
|
(a) => Boolean(a.type === "SVGNODE" && a.svgData.attrs?.uuid)
|
|
1734
1687
|
);
|
|
@@ -1751,7 +1704,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1751
1704
|
if (shouldRecenter) {
|
|
1752
1705
|
transformPCBElements(
|
|
1753
1706
|
soupElements,
|
|
1754
|
-
|
|
1707
|
+
translate(-centerOffset.x, centerOffset.y)
|
|
1755
1708
|
);
|
|
1756
1709
|
}
|
|
1757
1710
|
return soupElements;
|
|
@@ -1807,22 +1760,22 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber) {
|
|
|
1807
1760
|
}
|
|
1808
1761
|
|
|
1809
1762
|
// lib/schemas/easy-eda-json-schema.ts
|
|
1810
|
-
|
|
1763
|
+
import { z as z61 } from "zod";
|
|
1811
1764
|
|
|
1812
1765
|
// lib/schemas/single-letter-shape-schema.ts
|
|
1813
|
-
|
|
1814
|
-
var PointSchema2 =
|
|
1815
|
-
x:
|
|
1816
|
-
y:
|
|
1766
|
+
import { z as z60 } from "zod";
|
|
1767
|
+
var PointSchema2 = z60.object({
|
|
1768
|
+
x: z60.number(),
|
|
1769
|
+
y: z60.number()
|
|
1817
1770
|
});
|
|
1818
|
-
var RectangleShapeOutputSchema =
|
|
1819
|
-
type:
|
|
1771
|
+
var RectangleShapeOutputSchema = z60.object({
|
|
1772
|
+
type: z60.literal("RECTANGLE"),
|
|
1820
1773
|
position: PointSchema2,
|
|
1821
|
-
width:
|
|
1822
|
-
height:
|
|
1823
|
-
color:
|
|
1824
|
-
lineWidth:
|
|
1825
|
-
id:
|
|
1774
|
+
width: z60.number(),
|
|
1775
|
+
height: z60.number(),
|
|
1776
|
+
color: z60.string(),
|
|
1777
|
+
lineWidth: z60.number(),
|
|
1778
|
+
id: z60.string()
|
|
1826
1779
|
});
|
|
1827
1780
|
var parseRectangle = (str) => {
|
|
1828
1781
|
const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
|
|
@@ -1836,15 +1789,15 @@ var parseRectangle = (str) => {
|
|
|
1836
1789
|
id
|
|
1837
1790
|
};
|
|
1838
1791
|
};
|
|
1839
|
-
var RectangleShapeSchema =
|
|
1840
|
-
var EllipseShapeOutputSchema =
|
|
1841
|
-
type:
|
|
1792
|
+
var RectangleShapeSchema = z60.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
|
|
1793
|
+
var EllipseShapeOutputSchema = z60.object({
|
|
1794
|
+
type: z60.literal("ELLIPSE"),
|
|
1842
1795
|
center: PointSchema2,
|
|
1843
|
-
radiusX:
|
|
1844
|
-
radiusY:
|
|
1845
|
-
color:
|
|
1846
|
-
lineWidth:
|
|
1847
|
-
id:
|
|
1796
|
+
radiusX: z60.number(),
|
|
1797
|
+
radiusY: z60.number(),
|
|
1798
|
+
color: z60.string(),
|
|
1799
|
+
lineWidth: z60.number(),
|
|
1800
|
+
id: z60.string()
|
|
1848
1801
|
});
|
|
1849
1802
|
var parseEllipse = (str) => {
|
|
1850
1803
|
const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
|
|
@@ -1858,19 +1811,19 @@ var parseEllipse = (str) => {
|
|
|
1858
1811
|
id
|
|
1859
1812
|
};
|
|
1860
1813
|
};
|
|
1861
|
-
var EllipseShapeSchema =
|
|
1862
|
-
var PinShapeOutputSchema =
|
|
1863
|
-
type:
|
|
1864
|
-
visibility:
|
|
1865
|
-
pinNumber:
|
|
1866
|
-
x:
|
|
1867
|
-
y:
|
|
1868
|
-
rotation:
|
|
1869
|
-
id:
|
|
1870
|
-
label:
|
|
1871
|
-
labelColor:
|
|
1872
|
-
path:
|
|
1873
|
-
arrow:
|
|
1814
|
+
var EllipseShapeSchema = z60.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
1815
|
+
var PinShapeOutputSchema = z60.object({
|
|
1816
|
+
type: z60.literal("PIN"),
|
|
1817
|
+
visibility: z60.enum(["show", "hide"]),
|
|
1818
|
+
pinNumber: z60.number(),
|
|
1819
|
+
x: z60.number(),
|
|
1820
|
+
y: z60.number(),
|
|
1821
|
+
rotation: z60.number(),
|
|
1822
|
+
id: z60.string(),
|
|
1823
|
+
label: z60.string(),
|
|
1824
|
+
labelColor: z60.string(),
|
|
1825
|
+
path: z60.string(),
|
|
1826
|
+
arrow: z60.string()
|
|
1874
1827
|
});
|
|
1875
1828
|
var parsePin = (pinString) => {
|
|
1876
1829
|
const parts = pinString.split("~");
|
|
@@ -1897,13 +1850,13 @@ var parsePin = (pinString) => {
|
|
|
1897
1850
|
arrow
|
|
1898
1851
|
};
|
|
1899
1852
|
};
|
|
1900
|
-
var PinShapeSchema =
|
|
1901
|
-
var PolylineShapeOutputSchema =
|
|
1902
|
-
type:
|
|
1903
|
-
points:
|
|
1904
|
-
color:
|
|
1905
|
-
lineWidth:
|
|
1906
|
-
id:
|
|
1853
|
+
var PinShapeSchema = z60.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
|
|
1854
|
+
var PolylineShapeOutputSchema = z60.object({
|
|
1855
|
+
type: z60.literal("POLYLINE"),
|
|
1856
|
+
points: z60.array(PointSchema2),
|
|
1857
|
+
color: z60.string(),
|
|
1858
|
+
lineWidth: z60.number(),
|
|
1859
|
+
id: z60.string()
|
|
1907
1860
|
});
|
|
1908
1861
|
var parsePoints2 = (pointsStr) => {
|
|
1909
1862
|
return pointsStr.split(" ").reduce((acc, value, index) => {
|
|
@@ -1926,14 +1879,14 @@ var parsePolyline = (str) => {
|
|
|
1926
1879
|
id
|
|
1927
1880
|
};
|
|
1928
1881
|
};
|
|
1929
|
-
var PolylineShapeSchema =
|
|
1930
|
-
var PolygonShapeOutputSchema =
|
|
1931
|
-
type:
|
|
1932
|
-
points:
|
|
1933
|
-
fillColor:
|
|
1934
|
-
lineWidth:
|
|
1935
|
-
lineColor:
|
|
1936
|
-
id:
|
|
1882
|
+
var PolylineShapeSchema = z60.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
|
|
1883
|
+
var PolygonShapeOutputSchema = z60.object({
|
|
1884
|
+
type: z60.literal("POLYGON"),
|
|
1885
|
+
points: z60.array(PointSchema2),
|
|
1886
|
+
fillColor: z60.string(),
|
|
1887
|
+
lineWidth: z60.number(),
|
|
1888
|
+
lineColor: z60.string(),
|
|
1889
|
+
id: z60.string()
|
|
1937
1890
|
});
|
|
1938
1891
|
var parsePolygon = (str) => {
|
|
1939
1892
|
const [, ...rest] = str.split("~");
|
|
@@ -1947,8 +1900,8 @@ var parsePolygon = (str) => {
|
|
|
1947
1900
|
id
|
|
1948
1901
|
};
|
|
1949
1902
|
};
|
|
1950
|
-
var PolygonShapeSchema =
|
|
1951
|
-
var SingleLetterShapeSchema =
|
|
1903
|
+
var PolygonShapeSchema = z60.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
|
|
1904
|
+
var SingleLetterShapeSchema = z60.string().transform((x) => {
|
|
1952
1905
|
if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
|
|
1953
1906
|
if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
|
|
1954
1907
|
if (x.startsWith("P~")) return PinShapeSchema.parse(x);
|
|
@@ -1956,7 +1909,7 @@ var SingleLetterShapeSchema = import_zod61.z.string().transform((x) => {
|
|
|
1956
1909
|
if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
|
|
1957
1910
|
throw new Error(`Invalid shape type: ${x}`);
|
|
1958
1911
|
}).pipe(
|
|
1959
|
-
|
|
1912
|
+
z60.union([
|
|
1960
1913
|
RectangleShapeOutputSchema,
|
|
1961
1914
|
EllipseShapeOutputSchema,
|
|
1962
1915
|
PinShapeOutputSchema,
|
|
@@ -1966,81 +1919,81 @@ var SingleLetterShapeSchema = import_zod61.z.string().transform((x) => {
|
|
|
1966
1919
|
);
|
|
1967
1920
|
|
|
1968
1921
|
// lib/schemas/easy-eda-json-schema.ts
|
|
1969
|
-
var maybeNumber =
|
|
1970
|
-
var SzlcscSchema =
|
|
1971
|
-
id:
|
|
1972
|
-
number:
|
|
1973
|
-
step:
|
|
1974
|
-
min:
|
|
1975
|
-
price:
|
|
1976
|
-
stock:
|
|
1977
|
-
url:
|
|
1978
|
-
image:
|
|
1979
|
-
});
|
|
1980
|
-
var LcscSchema =
|
|
1981
|
-
id:
|
|
1982
|
-
number:
|
|
1983
|
-
step:
|
|
1984
|
-
min:
|
|
1985
|
-
price:
|
|
1986
|
-
stock:
|
|
1987
|
-
url:
|
|
1988
|
-
});
|
|
1989
|
-
var OwnerSchema =
|
|
1990
|
-
uuid:
|
|
1991
|
-
username:
|
|
1992
|
-
nickname:
|
|
1993
|
-
avatar:
|
|
1994
|
-
});
|
|
1995
|
-
var HeadSchema =
|
|
1996
|
-
docType:
|
|
1997
|
-
editorVersion:
|
|
1998
|
-
c_para:
|
|
1999
|
-
x:
|
|
2000
|
-
y:
|
|
2001
|
-
puuid:
|
|
2002
|
-
uuid:
|
|
2003
|
-
utime:
|
|
2004
|
-
importFlag:
|
|
2005
|
-
c_spiceCmd:
|
|
2006
|
-
hasIdFlag:
|
|
2007
|
-
});
|
|
2008
|
-
var BBoxSchema =
|
|
2009
|
-
x:
|
|
2010
|
-
y:
|
|
2011
|
-
width:
|
|
2012
|
-
height:
|
|
2013
|
-
});
|
|
2014
|
-
var LayerItemSchema =
|
|
2015
|
-
name:
|
|
2016
|
-
color:
|
|
2017
|
-
visible:
|
|
2018
|
-
active:
|
|
2019
|
-
config:
|
|
2020
|
-
transparency:
|
|
2021
|
-
});
|
|
2022
|
-
var ObjectItemSchema =
|
|
2023
|
-
name:
|
|
2024
|
-
visible:
|
|
2025
|
-
locked:
|
|
2026
|
-
});
|
|
2027
|
-
var DataStrSchema =
|
|
1922
|
+
var maybeNumber = z61.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(z61.number().nullable().optional());
|
|
1923
|
+
var SzlcscSchema = z61.object({
|
|
1924
|
+
id: z61.number(),
|
|
1925
|
+
number: z61.string(),
|
|
1926
|
+
step: z61.number().optional(),
|
|
1927
|
+
min: z61.number().optional(),
|
|
1928
|
+
price: z61.number().optional(),
|
|
1929
|
+
stock: z61.number().optional(),
|
|
1930
|
+
url: z61.string().url().optional(),
|
|
1931
|
+
image: z61.string().optional().optional()
|
|
1932
|
+
});
|
|
1933
|
+
var LcscSchema = z61.object({
|
|
1934
|
+
id: z61.number(),
|
|
1935
|
+
number: z61.string(),
|
|
1936
|
+
step: z61.number().optional(),
|
|
1937
|
+
min: z61.number().optional(),
|
|
1938
|
+
price: z61.number().optional(),
|
|
1939
|
+
stock: z61.number().optional(),
|
|
1940
|
+
url: z61.string().url().optional()
|
|
1941
|
+
});
|
|
1942
|
+
var OwnerSchema = z61.object({
|
|
1943
|
+
uuid: z61.string(),
|
|
1944
|
+
username: z61.string(),
|
|
1945
|
+
nickname: z61.string(),
|
|
1946
|
+
avatar: z61.string()
|
|
1947
|
+
});
|
|
1948
|
+
var HeadSchema = z61.object({
|
|
1949
|
+
docType: z61.string(),
|
|
1950
|
+
editorVersion: z61.string(),
|
|
1951
|
+
c_para: z61.record(z61.string(), z61.string()),
|
|
1952
|
+
x: z61.number(),
|
|
1953
|
+
y: z61.number(),
|
|
1954
|
+
puuid: z61.string().optional(),
|
|
1955
|
+
uuid: z61.string(),
|
|
1956
|
+
utime: z61.number(),
|
|
1957
|
+
importFlag: z61.number(),
|
|
1958
|
+
c_spiceCmd: z61.any().optional(),
|
|
1959
|
+
hasIdFlag: z61.boolean()
|
|
1960
|
+
});
|
|
1961
|
+
var BBoxSchema = z61.object({
|
|
1962
|
+
x: z61.number(),
|
|
1963
|
+
y: z61.number(),
|
|
1964
|
+
width: z61.number(),
|
|
1965
|
+
height: z61.number()
|
|
1966
|
+
});
|
|
1967
|
+
var LayerItemSchema = z61.object({
|
|
1968
|
+
name: z61.string(),
|
|
1969
|
+
color: z61.string(),
|
|
1970
|
+
visible: z61.boolean(),
|
|
1971
|
+
active: z61.boolean(),
|
|
1972
|
+
config: z61.boolean(),
|
|
1973
|
+
transparency: z61.boolean()
|
|
1974
|
+
});
|
|
1975
|
+
var ObjectItemSchema = z61.object({
|
|
1976
|
+
name: z61.string(),
|
|
1977
|
+
visible: z61.boolean(),
|
|
1978
|
+
locked: z61.boolean()
|
|
1979
|
+
});
|
|
1980
|
+
var DataStrSchema = z61.object({
|
|
2028
1981
|
head: HeadSchema,
|
|
2029
|
-
canvas:
|
|
2030
|
-
shape:
|
|
1982
|
+
canvas: z61.string(),
|
|
1983
|
+
shape: z61.array(SingleLetterShapeSchema),
|
|
2031
1984
|
BBox: BBoxSchema,
|
|
2032
|
-
colors:
|
|
1985
|
+
colors: z61.array(z61.unknown())
|
|
2033
1986
|
});
|
|
2034
|
-
var PackageDetailDataStrSchema =
|
|
1987
|
+
var PackageDetailDataStrSchema = z61.object({
|
|
2035
1988
|
head: HeadSchema,
|
|
2036
|
-
canvas:
|
|
2037
|
-
shape:
|
|
1989
|
+
canvas: z61.string(),
|
|
1990
|
+
shape: z61.array(z61.string()).transform(
|
|
2038
1991
|
(shapes) => shapes.map((shape) => {
|
|
2039
1992
|
const [type, ...data] = shape.split("~");
|
|
2040
1993
|
return ShapeItemSchema.parse({ type, data: data.join("~") });
|
|
2041
1994
|
})
|
|
2042
|
-
).pipe(
|
|
2043
|
-
layers:
|
|
1995
|
+
).pipe(z61.array(PackageDetailShapeSchema)),
|
|
1996
|
+
layers: z61.array(z61.string()).transform(
|
|
2044
1997
|
(layers) => layers.map((layer) => {
|
|
2045
1998
|
const [name, color, visible, active, config, transparency] = layer.split("~");
|
|
2046
1999
|
return LayerItemSchema.parse({
|
|
@@ -2053,7 +2006,7 @@ var PackageDetailDataStrSchema = import_zod62.z.object({
|
|
|
2053
2006
|
});
|
|
2054
2007
|
})
|
|
2055
2008
|
),
|
|
2056
|
-
objects:
|
|
2009
|
+
objects: z61.array(z61.string()).transform(
|
|
2057
2010
|
(objects) => objects.map((obj) => {
|
|
2058
2011
|
const [name, visible, locked] = obj.split("~");
|
|
2059
2012
|
return ObjectItemSchema.parse({
|
|
@@ -2064,43 +2017,43 @@ var PackageDetailDataStrSchema = import_zod62.z.object({
|
|
|
2064
2017
|
})
|
|
2065
2018
|
),
|
|
2066
2019
|
BBox: BBoxSchema,
|
|
2067
|
-
netColors:
|
|
2020
|
+
netColors: z61.array(z61.unknown()).optional()
|
|
2068
2021
|
});
|
|
2069
|
-
var PackageDetailSchema =
|
|
2070
|
-
uuid:
|
|
2071
|
-
title:
|
|
2072
|
-
docType:
|
|
2073
|
-
updateTime:
|
|
2022
|
+
var PackageDetailSchema = z61.object({
|
|
2023
|
+
uuid: z61.string(),
|
|
2024
|
+
title: z61.string(),
|
|
2025
|
+
docType: z61.number(),
|
|
2026
|
+
updateTime: z61.number(),
|
|
2074
2027
|
owner: OwnerSchema,
|
|
2075
|
-
datastrid:
|
|
2076
|
-
writable:
|
|
2028
|
+
datastrid: z61.string(),
|
|
2029
|
+
writable: z61.boolean(),
|
|
2077
2030
|
dataStr: PackageDetailDataStrSchema
|
|
2078
2031
|
});
|
|
2079
|
-
var EasyEdaJsonSchema =
|
|
2080
|
-
uuid:
|
|
2081
|
-
title:
|
|
2082
|
-
description:
|
|
2083
|
-
docType:
|
|
2084
|
-
type:
|
|
2032
|
+
var EasyEdaJsonSchema = z61.object({
|
|
2033
|
+
uuid: z61.string(),
|
|
2034
|
+
title: z61.string(),
|
|
2035
|
+
description: z61.string(),
|
|
2036
|
+
docType: z61.number(),
|
|
2037
|
+
type: z61.number(),
|
|
2085
2038
|
szlcsc: SzlcscSchema,
|
|
2086
2039
|
lcsc: LcscSchema,
|
|
2087
2040
|
owner: OwnerSchema,
|
|
2088
|
-
tags:
|
|
2089
|
-
updateTime:
|
|
2090
|
-
updated_at:
|
|
2041
|
+
tags: z61.array(z61.string()),
|
|
2042
|
+
updateTime: z61.number(),
|
|
2043
|
+
updated_at: z61.string(),
|
|
2091
2044
|
dataStr: DataStrSchema,
|
|
2092
|
-
verify:
|
|
2093
|
-
SMT:
|
|
2094
|
-
datastrid:
|
|
2095
|
-
jlcOnSale:
|
|
2096
|
-
writable:
|
|
2097
|
-
isFavorite:
|
|
2045
|
+
verify: z61.boolean(),
|
|
2046
|
+
SMT: z61.boolean().optional(),
|
|
2047
|
+
datastrid: z61.string(),
|
|
2048
|
+
jlcOnSale: z61.number().optional(),
|
|
2049
|
+
writable: z61.boolean(),
|
|
2050
|
+
isFavorite: z61.boolean(),
|
|
2098
2051
|
packageDetail: PackageDetailSchema
|
|
2099
2052
|
});
|
|
2100
2053
|
|
|
2101
2054
|
// lib/generate-footprint-tsx.ts
|
|
2102
|
-
|
|
2103
|
-
|
|
2055
|
+
import "zod";
|
|
2056
|
+
import { mm as mm3 } from "@tscircuit/mm";
|
|
2104
2057
|
var generateFootprintTsx = (easyEdaJson) => {
|
|
2105
2058
|
const pads = easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
2106
2059
|
(shape) => shape.type === "PAD"
|
|
@@ -2110,16 +2063,16 @@ var generateFootprintTsx = (easyEdaJson) => {
|
|
|
2110
2063
|
const centerY = centerOffset.y;
|
|
2111
2064
|
const footprintElements = pads.map((pad) => {
|
|
2112
2065
|
const { center, width, height, holeRadius, number } = pad;
|
|
2113
|
-
const isPlatedHole = holeRadius !== void 0 && (
|
|
2114
|
-
const normalizedX = (
|
|
2115
|
-
const normalizedY = (
|
|
2066
|
+
const isPlatedHole = holeRadius !== void 0 && mm3(holeRadius) > 0;
|
|
2067
|
+
const normalizedX = mm3(center.x) - centerX;
|
|
2068
|
+
const normalizedY = mm3(center.y) - centerY;
|
|
2116
2069
|
if (isPlatedHole) {
|
|
2117
2070
|
return `
|
|
2118
2071
|
<platedhole
|
|
2119
2072
|
pcbX="${normalizedX.toFixed(2)}mm"
|
|
2120
2073
|
pcbY="${normalizedY.toFixed(2)}mm"
|
|
2121
|
-
hole_diameter="${(
|
|
2122
|
-
outer_diameter="${(
|
|
2074
|
+
hole_diameter="${mm3(holeRadius) * 2}mm"
|
|
2075
|
+
outer_diameter="${mm3(width)}mm"
|
|
2123
2076
|
portHints={["${number}"]}
|
|
2124
2077
|
/>`.replace(/\n/, "");
|
|
2125
2078
|
} else {
|
|
@@ -2127,8 +2080,8 @@ var generateFootprintTsx = (easyEdaJson) => {
|
|
|
2127
2080
|
<smtpad
|
|
2128
2081
|
pcbX="${normalizedX.toFixed(2)}mm"
|
|
2129
2082
|
pcbY="${normalizedY.toFixed(2)}mm"
|
|
2130
|
-
width="${(
|
|
2131
|
-
height="${(
|
|
2083
|
+
width="${mm3(width)}mm"
|
|
2084
|
+
height="${mm3(height)}mm"
|
|
2132
2085
|
shape="rect"
|
|
2133
2086
|
portHints={["${number}"]}
|
|
2134
2087
|
/>`.replace(/\n/, "");
|
|
@@ -2256,8 +2209,8 @@ var checkModelObjUrlValidity = async (url) => {
|
|
|
2256
2209
|
};
|
|
2257
2210
|
|
|
2258
2211
|
// lib/convert-easyeda-json-to-various-formats.ts
|
|
2259
|
-
|
|
2260
|
-
|
|
2212
|
+
import fs from "fs/promises";
|
|
2213
|
+
import * as path from "path";
|
|
2261
2214
|
var convertEasyEdaJsonToVariousFormats = async ({
|
|
2262
2215
|
jlcpcbPartNumberOrFilepath,
|
|
2263
2216
|
outputFilename,
|
|
@@ -2266,7 +2219,7 @@ var convertEasyEdaJsonToVariousFormats = async ({
|
|
|
2266
2219
|
let rawEasyEdaJson;
|
|
2267
2220
|
if (jlcpcbPartNumberOrFilepath.includes(".") || jlcpcbPartNumberOrFilepath.includes("/")) {
|
|
2268
2221
|
rawEasyEdaJson = JSON.parse(
|
|
2269
|
-
await
|
|
2222
|
+
await fs.readFile(jlcpcbPartNumberOrFilepath, "utf-8")
|
|
2270
2223
|
);
|
|
2271
2224
|
} else {
|
|
2272
2225
|
rawEasyEdaJson = await fetchEasyEDAComponent(jlcpcbPartNumberOrFilepath);
|
|
@@ -2292,7 +2245,7 @@ var convertEasyEdaJsonToVariousFormats = async ({
|
|
|
2292
2245
|
process.exit(1);
|
|
2293
2246
|
}
|
|
2294
2247
|
if (outputFilename.endsWith(".raweasy.json")) {
|
|
2295
|
-
await
|
|
2248
|
+
await fs.writeFile(outputFilename, JSON.stringify(rawEasyEdaJson, null, 2));
|
|
2296
2249
|
console.log(`Saved raw EasyEDA JSON: ${outputFilename}`);
|
|
2297
2250
|
return;
|
|
2298
2251
|
}
|
|
@@ -2300,16 +2253,16 @@ var convertEasyEdaJsonToVariousFormats = async ({
|
|
|
2300
2253
|
const betterEasy = EasyEdaJsonSchema.parse(rawEasyEdaJson);
|
|
2301
2254
|
const tscircuitSoup = convertEasyEdaJsonToTscircuitSoupJson(betterEasy);
|
|
2302
2255
|
if (outputFilename.endsWith(".soup.json")) {
|
|
2303
|
-
await
|
|
2256
|
+
await fs.writeFile(outputFilename, JSON.stringify(tscircuitSoup, null, 2));
|
|
2304
2257
|
console.log(`Converted to tscircuit soup JSON: ${outputFilename}`);
|
|
2305
2258
|
} else if (outputFilename.endsWith(".kicad_mod")) {
|
|
2306
2259
|
console.log("Conversion to KiCad footprint not yet implemented");
|
|
2307
2260
|
} else if (outputFilename.endsWith(".bettereasy.json")) {
|
|
2308
|
-
await
|
|
2261
|
+
await fs.writeFile(outputFilename, JSON.stringify(betterEasy, null, 2));
|
|
2309
2262
|
console.log(`Saved better EasyEDA JSON: ${outputFilename}`);
|
|
2310
2263
|
} else if (outputFilename.endsWith(".tsx") || outputFilename.endsWith(".ts")) {
|
|
2311
2264
|
const tsComp = await convertRawEasyEdaToTs(rawEasyEdaJson);
|
|
2312
|
-
await
|
|
2265
|
+
await fs.writeFile(outputFilename, tsComp);
|
|
2313
2266
|
console.log(`Saved TypeScript component: ${outputFilename}`);
|
|
2314
2267
|
} else {
|
|
2315
2268
|
console.error("Unsupported output format");
|
|
@@ -2318,25 +2271,25 @@ var convertEasyEdaJsonToVariousFormats = async ({
|
|
|
2318
2271
|
console.error("Error:", error.message);
|
|
2319
2272
|
}
|
|
2320
2273
|
};
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2274
|
+
|
|
2275
|
+
export {
|
|
2276
|
+
convertEasyEdaJsonToCircuitJson,
|
|
2277
|
+
convertEasyEdaJsonToTscircuitSoupJson,
|
|
2278
|
+
fetchEasyEDAComponent,
|
|
2279
|
+
maybeNumber,
|
|
2280
|
+
SzlcscSchema,
|
|
2281
|
+
LcscSchema,
|
|
2282
|
+
OwnerSchema,
|
|
2326
2283
|
HeadSchema,
|
|
2284
|
+
BBoxSchema,
|
|
2327
2285
|
LayerItemSchema,
|
|
2328
|
-
LcscSchema,
|
|
2329
2286
|
ObjectItemSchema,
|
|
2330
|
-
|
|
2287
|
+
DataStrSchema,
|
|
2331
2288
|
PackageDetailDataStrSchema,
|
|
2332
2289
|
PackageDetailSchema,
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
convertEasyEdaJsonToTscircuitSoupJson,
|
|
2336
|
-
convertEasyEdaJsonToVariousFormats,
|
|
2290
|
+
EasyEdaJsonSchema,
|
|
2291
|
+
normalizeManufacturerPartNumber,
|
|
2337
2292
|
convertRawEasyEdaToTs,
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
});
|
|
2342
|
-
//# sourceMappingURL=index.cjs.map
|
|
2293
|
+
convertEasyEdaJsonToVariousFormats
|
|
2294
|
+
};
|
|
2295
|
+
//# sourceMappingURL=chunk-3ZPJFTXV.js.map
|