@tscircuit/pcb-viewer 1.0.0 → 1.0.1

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.
Files changed (74) hide show
  1. package/dist/PCBViewer.d.ts +5 -0
  2. package/dist/PCBViewer.js +602 -0
  3. package/dist/PCBViewer.js.map +1 -0
  4. package/dist/assets/alphabet.d.ts +47 -0
  5. package/{src/assets/alphabet.ts → dist/assets/alphabet.js} +41 -24
  6. package/dist/assets/alphabet.js.map +1 -0
  7. package/dist/assets/attiny-eagle.d.ts +133 -0
  8. package/{src/assets/attiny-eagle.ts → dist/assets/attiny-eagle.js} +156 -130
  9. package/dist/assets/attiny-eagle.js.map +1 -0
  10. package/dist/components/CanvasElementsRenderer.d.ts +8 -0
  11. package/dist/components/CanvasElementsRenderer.js +583 -0
  12. package/dist/components/CanvasElementsRenderer.js.map +1 -0
  13. package/dist/components/CanvasPrimitiveRenderer.d.ts +9 -0
  14. package/dist/components/CanvasPrimitiveRenderer.js +540 -0
  15. package/dist/components/CanvasPrimitiveRenderer.js.map +1 -0
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.js +606 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/lib/Drawer.d.ts +146 -0
  20. package/dist/lib/Drawer.js +395 -0
  21. package/dist/lib/Drawer.js.map +1 -0
  22. package/dist/lib/colors.d.ts +154 -0
  23. package/{src/lib/colors.ts → dist/lib/colors.js} +37 -13
  24. package/dist/lib/colors.js.map +1 -0
  25. package/dist/lib/convert-element-to-primitive.d.ts +6 -0
  26. package/dist/lib/convert-element-to-primitive.js +53 -0
  27. package/dist/lib/convert-element-to-primitive.js.map +1 -0
  28. package/dist/lib/convert-text-to-lines.d.ts +5 -0
  29. package/dist/lib/convert-text-to-lines.js +114 -0
  30. package/dist/lib/convert-text-to-lines.js.map +1 -0
  31. package/dist/lib/draw-eagle.d.ts +7 -0
  32. package/dist/lib/draw-eagle.js +63 -0
  33. package/dist/lib/draw-eagle.js.map +1 -0
  34. package/dist/lib/draw-primitives.d.ts +12 -0
  35. package/dist/lib/draw-primitives.js +181 -0
  36. package/dist/lib/draw-primitives.js.map +1 -0
  37. package/dist/lib/types.d.ts +43 -0
  38. package/dist/lib/types.js +18 -0
  39. package/dist/lib/types.js.map +1 -0
  40. package/dist/lib/util/scale-only.d.ts +5 -0
  41. package/dist/lib/util/scale-only.js +34 -0
  42. package/dist/lib/util/scale-only.js.map +1 -0
  43. package/dist/pages/eagle.d.ts +3 -0
  44. package/dist/pages/eagle.js +1276 -0
  45. package/dist/pages/eagle.js.map +1 -0
  46. package/dist/pages/index.d.ts +3 -0
  47. package/dist/pages/index.js +401 -0
  48. package/dist/pages/index.js.map +1 -0
  49. package/dist/pages/primitives.d.ts +3 -0
  50. package/dist/pages/primitives.js +581 -0
  51. package/dist/pages/primitives.js.map +1 -0
  52. package/dist/pages/viewer.d.ts +14 -0
  53. package/dist/pages/viewer.js +621 -0
  54. package/dist/pages/viewer.js.map +1 -0
  55. package/package.json +17 -7
  56. package/.github/workflows/npm-semantic-release.yml +0 -29
  57. package/next-env.d.ts +0 -5
  58. package/release.config.js +0 -16
  59. package/src/PCBViewer.tsx +0 -24
  60. package/src/components/CanvasElementsRenderer.tsx +0 -15
  61. package/src/components/CanvasPrimitiveRenderer.tsx +0 -25
  62. package/src/index.tsx +0 -2
  63. package/src/lib/Drawer.ts +0 -168
  64. package/src/lib/convert-element-to-primitive.ts +0 -31
  65. package/src/lib/convert-text-to-lines.ts +0 -31
  66. package/src/lib/draw-eagle.ts +0 -45
  67. package/src/lib/draw-primitives.ts +0 -69
  68. package/src/lib/types.ts +0 -54
  69. package/src/lib/util/scale-only.ts +0 -7
  70. package/src/pages/eagle.tsx +0 -20
  71. package/src/pages/index.tsx +0 -23
  72. package/src/pages/primitives.tsx +0 -64
  73. package/src/pages/viewer.tsx +0 -43
  74. package/tsconfig.json +0 -21
@@ -0,0 +1,1276 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+
25
+ // src/pages/eagle.tsx
26
+ var eagle_exports = {};
27
+ __export(eagle_exports, {
28
+ default: () => eagle_default
29
+ });
30
+ module.exports = __toCommonJS(eagle_exports);
31
+ var import_react = __toESM(require("react"));
32
+
33
+ // src/assets/attiny-eagle.ts
34
+ var attiny_eagle_default = {
35
+ version: "7.1.0",
36
+ settings: {
37
+ alwaysvectorfont: "no",
38
+ verticaltext: "up"
39
+ },
40
+ grid: {
41
+ distance: 0.1,
42
+ unitdist: "inch",
43
+ unit: "inch",
44
+ style: "lines",
45
+ multiple: 1,
46
+ display: "no",
47
+ altdistance: 0.01,
48
+ altunitdist: "inch",
49
+ altunit: "inch"
50
+ },
51
+ layers: [
52
+ {
53
+ number: 1,
54
+ name: "Top",
55
+ color: 4,
56
+ fill: 1,
57
+ visible: "yes",
58
+ active: "yes"
59
+ },
60
+ {
61
+ number: 16,
62
+ name: "Bottom",
63
+ color: 1,
64
+ fill: 1,
65
+ visible: "yes",
66
+ active: "yes"
67
+ },
68
+ {
69
+ number: 17,
70
+ name: "Pads",
71
+ color: 2,
72
+ fill: 1,
73
+ visible: "yes",
74
+ active: "yes"
75
+ },
76
+ {
77
+ number: 18,
78
+ name: "Vias",
79
+ color: 2,
80
+ fill: 1,
81
+ visible: "yes",
82
+ active: "yes"
83
+ },
84
+ {
85
+ number: 19,
86
+ name: "Unrouted",
87
+ color: 6,
88
+ fill: 1,
89
+ visible: "yes",
90
+ active: "yes"
91
+ },
92
+ {
93
+ number: 20,
94
+ name: "Dimension",
95
+ color: 15,
96
+ fill: 1,
97
+ visible: "yes",
98
+ active: "yes"
99
+ },
100
+ {
101
+ number: 21,
102
+ name: "tPlace",
103
+ color: 7,
104
+ fill: 1,
105
+ visible: "yes",
106
+ active: "yes"
107
+ },
108
+ {
109
+ number: 22,
110
+ name: "bPlace",
111
+ color: 7,
112
+ fill: 1,
113
+ visible: "yes",
114
+ active: "yes"
115
+ },
116
+ {
117
+ number: 23,
118
+ name: "tOrigins",
119
+ color: 15,
120
+ fill: 1,
121
+ visible: "yes",
122
+ active: "yes"
123
+ },
124
+ {
125
+ number: 24,
126
+ name: "bOrigins",
127
+ color: 15,
128
+ fill: 1,
129
+ visible: "yes",
130
+ active: "yes"
131
+ },
132
+ {
133
+ number: 25,
134
+ name: "tNames",
135
+ color: 7,
136
+ fill: 1,
137
+ visible: "yes",
138
+ active: "yes"
139
+ },
140
+ {
141
+ number: 26,
142
+ name: "bNames",
143
+ color: 7,
144
+ fill: 1,
145
+ visible: "yes",
146
+ active: "yes"
147
+ },
148
+ {
149
+ number: 27,
150
+ name: "tValues",
151
+ color: 7,
152
+ fill: 1,
153
+ visible: "yes",
154
+ active: "yes"
155
+ },
156
+ {
157
+ number: 28,
158
+ name: "bValues",
159
+ color: 7,
160
+ fill: 1,
161
+ visible: "yes",
162
+ active: "yes"
163
+ },
164
+ {
165
+ number: 29,
166
+ name: "tStop",
167
+ color: 7,
168
+ fill: 3,
169
+ visible: "yes",
170
+ active: "yes"
171
+ },
172
+ {
173
+ number: 30,
174
+ name: "bStop",
175
+ color: 7,
176
+ fill: 6,
177
+ visible: "no",
178
+ active: "yes"
179
+ },
180
+ {
181
+ number: 31,
182
+ name: "tCream",
183
+ color: 7,
184
+ fill: 4,
185
+ visible: "yes",
186
+ active: "yes"
187
+ },
188
+ {
189
+ number: 32,
190
+ name: "bCream",
191
+ color: 7,
192
+ fill: 5,
193
+ visible: "no",
194
+ active: "yes"
195
+ },
196
+ {
197
+ number: 33,
198
+ name: "tFinish",
199
+ color: 6,
200
+ fill: 3,
201
+ visible: "no",
202
+ active: "yes"
203
+ },
204
+ {
205
+ number: 34,
206
+ name: "bFinish",
207
+ color: 6,
208
+ fill: 6,
209
+ visible: "no",
210
+ active: "yes"
211
+ },
212
+ {
213
+ number: 35,
214
+ name: "tGlue",
215
+ color: 7,
216
+ fill: 4,
217
+ visible: "no",
218
+ active: "yes"
219
+ },
220
+ {
221
+ number: 36,
222
+ name: "bGlue",
223
+ color: 7,
224
+ fill: 5,
225
+ visible: "no",
226
+ active: "yes"
227
+ },
228
+ {
229
+ number: 37,
230
+ name: "tTest",
231
+ color: 7,
232
+ fill: 1,
233
+ visible: "no",
234
+ active: "yes"
235
+ },
236
+ {
237
+ number: 38,
238
+ name: "bTest",
239
+ color: 7,
240
+ fill: 1,
241
+ visible: "no",
242
+ active: "yes"
243
+ },
244
+ {
245
+ number: 39,
246
+ name: "tKeepout",
247
+ color: 4,
248
+ fill: 11,
249
+ visible: "yes",
250
+ active: "yes"
251
+ },
252
+ {
253
+ number: 40,
254
+ name: "bKeepout",
255
+ color: 1,
256
+ fill: 11,
257
+ visible: "yes",
258
+ active: "yes"
259
+ },
260
+ {
261
+ number: 41,
262
+ name: "tRestrict",
263
+ color: 4,
264
+ fill: 10,
265
+ visible: "yes",
266
+ active: "yes"
267
+ },
268
+ {
269
+ number: 42,
270
+ name: "bRestrict",
271
+ color: 1,
272
+ fill: 10,
273
+ visible: "yes",
274
+ active: "yes"
275
+ },
276
+ {
277
+ number: 43,
278
+ name: "vRestrict",
279
+ color: 2,
280
+ fill: 10,
281
+ visible: "yes",
282
+ active: "yes"
283
+ },
284
+ {
285
+ number: 44,
286
+ name: "Drills",
287
+ color: 7,
288
+ fill: 1,
289
+ visible: "no",
290
+ active: "yes"
291
+ },
292
+ {
293
+ number: 45,
294
+ name: "Holes",
295
+ color: 7,
296
+ fill: 1,
297
+ visible: "no",
298
+ active: "yes"
299
+ },
300
+ {
301
+ number: 46,
302
+ name: "Milling",
303
+ color: 3,
304
+ fill: 1,
305
+ visible: "no",
306
+ active: "yes"
307
+ },
308
+ {
309
+ number: 47,
310
+ name: "Measures",
311
+ color: 7,
312
+ fill: 1,
313
+ visible: "no",
314
+ active: "yes"
315
+ },
316
+ {
317
+ number: 48,
318
+ name: "Document",
319
+ color: 7,
320
+ fill: 1,
321
+ visible: "yes",
322
+ active: "yes"
323
+ },
324
+ {
325
+ number: 49,
326
+ name: "Reference",
327
+ color: 7,
328
+ fill: 1,
329
+ visible: "yes",
330
+ active: "yes"
331
+ },
332
+ {
333
+ number: 51,
334
+ name: "tDocu",
335
+ color: 7,
336
+ fill: 1,
337
+ visible: "yes",
338
+ active: "yes"
339
+ },
340
+ {
341
+ number: 52,
342
+ name: "bDocu",
343
+ color: 7,
344
+ fill: 1,
345
+ visible: "yes",
346
+ active: "yes"
347
+ },
348
+ {
349
+ number: 90,
350
+ name: "Modules",
351
+ color: 5,
352
+ fill: 1,
353
+ visible: "yes",
354
+ active: "yes"
355
+ },
356
+ {
357
+ number: 91,
358
+ name: "Nets",
359
+ color: 2,
360
+ fill: 1,
361
+ visible: "yes",
362
+ active: "yes"
363
+ },
364
+ {
365
+ number: 92,
366
+ name: "Busses",
367
+ color: 1,
368
+ fill: 1,
369
+ visible: "yes",
370
+ active: "yes"
371
+ },
372
+ {
373
+ number: 93,
374
+ name: "Pins",
375
+ color: 2,
376
+ fill: 1,
377
+ visible: "yes",
378
+ active: "yes"
379
+ },
380
+ {
381
+ number: 94,
382
+ name: "Symbols",
383
+ color: 4,
384
+ fill: 1,
385
+ visible: "yes",
386
+ active: "yes"
387
+ },
388
+ {
389
+ number: 95,
390
+ name: "Names",
391
+ color: 7,
392
+ fill: 1,
393
+ visible: "yes",
394
+ active: "yes"
395
+ },
396
+ {
397
+ number: 96,
398
+ name: "Values",
399
+ color: 7,
400
+ fill: 1,
401
+ visible: "yes",
402
+ active: "yes"
403
+ },
404
+ {
405
+ number: 97,
406
+ name: "Info",
407
+ color: 7,
408
+ fill: 1,
409
+ visible: "yes",
410
+ active: "yes"
411
+ },
412
+ {
413
+ number: 98,
414
+ name: "Guide",
415
+ color: 6,
416
+ fill: 1,
417
+ visible: "yes",
418
+ active: "yes"
419
+ }
420
+ ],
421
+ library: {
422
+ packages: [
423
+ {
424
+ circle: [
425
+ {
426
+ x: -4.44,
427
+ y: 4.4,
428
+ radius: 0.1,
429
+ width: 0.2,
430
+ layer: 21
431
+ }
432
+ ],
433
+ wire: [
434
+ {
435
+ x1: -1.9475,
436
+ y1: 4.425,
437
+ x2: 1.9475,
438
+ y2: 4.425,
439
+ width: 0.127,
440
+ layer: 21
441
+ },
442
+ {
443
+ x1: -1.9475,
444
+ y1: -4.425,
445
+ x2: 1.9475,
446
+ y2: -4.425,
447
+ width: 0.127,
448
+ layer: 21
449
+ },
450
+ {
451
+ x1: -3.705,
452
+ y1: 4.5725,
453
+ x2: 3.705,
454
+ y2: 4.5725,
455
+ width: 0.05,
456
+ layer: 39
457
+ },
458
+ {
459
+ x1: -3.705,
460
+ y1: -4.5725,
461
+ x2: 3.705,
462
+ y2: -4.5725,
463
+ width: 0.05,
464
+ layer: 39
465
+ },
466
+ {
467
+ x1: -3.705,
468
+ y1: 4.5725,
469
+ x2: -3.705,
470
+ y2: -4.5725,
471
+ width: 0.05,
472
+ layer: 39
473
+ },
474
+ {
475
+ x1: 3.705,
476
+ y1: 4.5725,
477
+ x2: 3.705,
478
+ y2: -4.5725,
479
+ width: 0.05,
480
+ layer: 39
481
+ }
482
+ ],
483
+ text: [
484
+ {
485
+ "#text": ">VALUE",
486
+ x: -3.965,
487
+ y: -4.602,
488
+ size: 1.27,
489
+ layer: 27,
490
+ align: "top-left"
491
+ },
492
+ {
493
+ "#text": ">NAME",
494
+ x: -3.965,
495
+ y: 4.602,
496
+ size: 1.27,
497
+ layer: 25
498
+ }
499
+ ],
500
+ smd: [
501
+ {
502
+ name: 1,
503
+ x: -2.47,
504
+ y: 3.81,
505
+ dx: 1.97,
506
+ dy: 0.59,
507
+ layer: 1,
508
+ roundness: 25
509
+ },
510
+ {
511
+ name: 2,
512
+ x: -2.47,
513
+ y: 2.54,
514
+ dx: 1.97,
515
+ dy: 0.59,
516
+ layer: 1,
517
+ roundness: 25
518
+ },
519
+ {
520
+ name: 3,
521
+ x: -2.47,
522
+ y: 1.27,
523
+ dx: 1.97,
524
+ dy: 0.59,
525
+ layer: 1,
526
+ roundness: 25
527
+ },
528
+ {
529
+ name: 4,
530
+ x: -2.47,
531
+ y: 0,
532
+ dx: 1.97,
533
+ dy: 0.59,
534
+ layer: 1,
535
+ roundness: 25
536
+ },
537
+ {
538
+ name: 5,
539
+ x: -2.47,
540
+ y: -1.27,
541
+ dx: 1.97,
542
+ dy: 0.59,
543
+ layer: 1,
544
+ roundness: 25
545
+ },
546
+ {
547
+ name: 6,
548
+ x: -2.47,
549
+ y: -2.54,
550
+ dx: 1.97,
551
+ dy: 0.59,
552
+ layer: 1,
553
+ roundness: 25
554
+ },
555
+ {
556
+ name: 7,
557
+ x: -2.47,
558
+ y: -3.81,
559
+ dx: 1.97,
560
+ dy: 0.59,
561
+ layer: 1,
562
+ roundness: 25
563
+ },
564
+ {
565
+ name: 8,
566
+ x: 2.47,
567
+ y: -3.81,
568
+ dx: 1.97,
569
+ dy: 0.59,
570
+ layer: 1,
571
+ roundness: 25
572
+ },
573
+ {
574
+ name: 9,
575
+ x: 2.47,
576
+ y: -2.54,
577
+ dx: 1.97,
578
+ dy: 0.59,
579
+ layer: 1,
580
+ roundness: 25
581
+ },
582
+ {
583
+ name: 10,
584
+ x: 2.47,
585
+ y: -1.27,
586
+ dx: 1.97,
587
+ dy: 0.59,
588
+ layer: 1,
589
+ roundness: 25
590
+ },
591
+ {
592
+ name: 11,
593
+ x: 2.47,
594
+ y: 0,
595
+ dx: 1.97,
596
+ dy: 0.59,
597
+ layer: 1,
598
+ roundness: 25
599
+ },
600
+ {
601
+ name: 12,
602
+ x: 2.47,
603
+ y: 1.27,
604
+ dx: 1.97,
605
+ dy: 0.59,
606
+ layer: 1,
607
+ roundness: 25
608
+ },
609
+ {
610
+ name: 13,
611
+ x: 2.47,
612
+ y: 2.54,
613
+ dx: 1.97,
614
+ dy: 0.59,
615
+ layer: 1,
616
+ roundness: 25
617
+ },
618
+ {
619
+ name: 14,
620
+ x: 2.47,
621
+ y: 3.81,
622
+ dx: 1.97,
623
+ dy: 0.59,
624
+ layer: 1,
625
+ roundness: 25
626
+ }
627
+ ],
628
+ name: "SOIC127P599X175-14N",
629
+ rect: []
630
+ }
631
+ ],
632
+ devicesets: [
633
+ {
634
+ description: "MCU 8-bit ATtiny AVR CISC 8KB Flash 1.8V/2.5V/3.3V/5V 14-Pin SOIC W Tray",
635
+ gates: [
636
+ {
637
+ name: "G$1",
638
+ symbol: "ATTINY841-SSU",
639
+ x: 0,
640
+ y: 0
641
+ }
642
+ ],
643
+ devices: [
644
+ {
645
+ connects: [
646
+ {
647
+ gate: "G$1",
648
+ pin: "GND",
649
+ pad: 14
650
+ },
651
+ {
652
+ gate: "G$1",
653
+ pin: "PA0",
654
+ pad: 13
655
+ },
656
+ {
657
+ gate: "G$1",
658
+ pin: "PA1",
659
+ pad: 12
660
+ },
661
+ {
662
+ gate: "G$1",
663
+ pin: "PA2",
664
+ pad: 11
665
+ },
666
+ {
667
+ gate: "G$1",
668
+ pin: "PA3",
669
+ pad: 10
670
+ },
671
+ {
672
+ gate: "G$1",
673
+ pin: "PA4",
674
+ pad: 9
675
+ },
676
+ {
677
+ gate: "G$1",
678
+ pin: "PA5",
679
+ pad: 8
680
+ },
681
+ {
682
+ gate: "G$1",
683
+ pin: "PA6",
684
+ pad: 7
685
+ },
686
+ {
687
+ gate: "G$1",
688
+ pin: "PA7",
689
+ pad: 6
690
+ },
691
+ {
692
+ gate: "G$1",
693
+ pin: "PB0",
694
+ pad: 2
695
+ },
696
+ {
697
+ gate: "G$1",
698
+ pin: "PB1",
699
+ pad: 3
700
+ },
701
+ {
702
+ gate: "G$1",
703
+ pin: "PB2",
704
+ pad: 5
705
+ },
706
+ {
707
+ gate: "G$1",
708
+ pin: "PB3",
709
+ pad: 4
710
+ },
711
+ {
712
+ gate: "G$1",
713
+ pin: "VCC",
714
+ pad: 1
715
+ }
716
+ ],
717
+ name: "",
718
+ package: "SOIC127P599X175-14N"
719
+ }
720
+ ],
721
+ name: "ATTINY841-SSU",
722
+ prefix: "U"
723
+ }
724
+ ],
725
+ symbols: [
726
+ {
727
+ wire: [
728
+ {
729
+ x1: 10.16,
730
+ y1: 15.24,
731
+ x2: 10.16,
732
+ y2: -17.78,
733
+ width: 0.1524,
734
+ layer: 94
735
+ },
736
+ {
737
+ x1: 10.16,
738
+ y1: -17.78,
739
+ x2: -10.16,
740
+ y2: -17.78,
741
+ width: 0.1524,
742
+ layer: 94
743
+ },
744
+ {
745
+ x1: -10.16,
746
+ y1: -17.78,
747
+ x2: -10.16,
748
+ y2: 15.24,
749
+ width: 0.1524,
750
+ layer: 94
751
+ },
752
+ {
753
+ x1: -10.16,
754
+ y1: 15.24,
755
+ x2: 10.16,
756
+ y2: 15.24,
757
+ width: 0.1524,
758
+ layer: 94
759
+ }
760
+ ],
761
+ text: [
762
+ {
763
+ "#text": ">NAME",
764
+ x: -10.16,
765
+ y: 16.002,
766
+ size: 1.778,
767
+ layer: 95
768
+ },
769
+ {
770
+ "#text": ">VALUE",
771
+ x: -10.16,
772
+ y: -20.32,
773
+ size: 1.778,
774
+ layer: 96
775
+ }
776
+ ],
777
+ pin: [
778
+ {
779
+ name: "VCC",
780
+ x: 15.24,
781
+ y: 12.7,
782
+ length: "middle",
783
+ direction: "pwr",
784
+ rot: "R180"
785
+ },
786
+ {
787
+ name: "PB0",
788
+ x: 15.24,
789
+ y: 2.54,
790
+ length: "middle",
791
+ rot: "R180"
792
+ },
793
+ {
794
+ name: "PA0",
795
+ x: -15.24,
796
+ y: 7.62,
797
+ length: "middle"
798
+ },
799
+ {
800
+ name: "GND",
801
+ x: 15.24,
802
+ y: -15.24,
803
+ length: "middle",
804
+ direction: "pwr",
805
+ rot: "R180"
806
+ },
807
+ {
808
+ name: "PB1",
809
+ x: 15.24,
810
+ y: 0,
811
+ length: "middle",
812
+ rot: "R180"
813
+ },
814
+ {
815
+ name: "PB2",
816
+ x: 15.24,
817
+ y: -2.54,
818
+ length: "middle",
819
+ rot: "R180"
820
+ },
821
+ {
822
+ name: "PB3",
823
+ x: 15.24,
824
+ y: -5.08,
825
+ length: "middle",
826
+ rot: "R180"
827
+ },
828
+ {
829
+ name: "PA6",
830
+ x: -15.24,
831
+ y: -7.62,
832
+ length: "middle"
833
+ },
834
+ {
835
+ name: "PA7",
836
+ x: -15.24,
837
+ y: -10.16,
838
+ length: "middle"
839
+ },
840
+ {
841
+ name: "PA1",
842
+ x: -15.24,
843
+ y: 5.08,
844
+ length: "middle"
845
+ },
846
+ {
847
+ name: "PA2",
848
+ x: -15.24,
849
+ y: 2.54,
850
+ length: "middle"
851
+ },
852
+ {
853
+ name: "PA3",
854
+ x: -15.24,
855
+ y: 0,
856
+ length: "middle"
857
+ },
858
+ {
859
+ name: "PA4",
860
+ x: -15.24,
861
+ y: -2.54,
862
+ length: "middle"
863
+ },
864
+ {
865
+ name: "PA5",
866
+ x: -15.24,
867
+ y: -5.08,
868
+ length: "middle"
869
+ }
870
+ ],
871
+ name: "ATTINY841-SSU"
872
+ }
873
+ ]
874
+ }
875
+ };
876
+
877
+ // src/lib/draw-eagle.ts
878
+ var import_transformation_matrix = require("transformation-matrix");
879
+ var drawEagle = (drawer, eagle) => {
880
+ const pkg = eagle.library.packages[0];
881
+ if (eagle.grid.unit === "inch") {
882
+ drawer.transform = (0, import_transformation_matrix.compose)(
883
+ (0, import_transformation_matrix.fromDefinition)(
884
+ (0, import_transformation_matrix.fromTransformAttribute)("translate(200, 200) scale(30,-30)")
885
+ )
886
+ );
887
+ }
888
+ const layerMap = {};
889
+ for (const layer of eagle.layers) {
890
+ layerMap[layer.number] = layer;
891
+ }
892
+ for (const smd of pkg.smd || []) {
893
+ drawer.equip({
894
+ color: layerMap[smd.layer].name
895
+ });
896
+ drawer.rect(smd.x - smd.dx / 2, smd.y - smd.dy / 2, smd.dx, smd.dy);
897
+ }
898
+ for (const wire of pkg.wire || []) {
899
+ drawer.equip({
900
+ size: wire.width,
901
+ shape: "circle",
902
+ color: layerMap[wire.layer].name
903
+ });
904
+ drawer.moveTo(wire.x1, wire.y1);
905
+ drawer.lineTo(wire.x2, wire.y2);
906
+ }
907
+ for (const circle of pkg.circle || []) {
908
+ drawer.equip({ color: layerMap[circle.layer].name });
909
+ drawer.circle(circle.x, circle.y, circle.radius);
910
+ }
911
+ };
912
+
913
+ // src/lib/util/scale-only.ts
914
+ var scaleOnly = (mat, value) => {
915
+ if (Math.abs(mat.a) !== Math.abs(mat.d))
916
+ throw new Error("Cannot scale non-uniformly");
917
+ return value * Math.abs(mat.a);
918
+ };
919
+
920
+ // src/lib/Drawer.ts
921
+ var import_transformation_matrix2 = require("transformation-matrix");
922
+
923
+ // src/lib/colors.ts
924
+ var colors_default = {
925
+ "3d_viewer": {
926
+ background_bottom: "rgb(102, 102, 128)",
927
+ background_top: "rgb(204, 204, 230)",
928
+ board: "rgb(51, 43, 23)",
929
+ copper: "rgb(179, 156, 0)",
930
+ silkscreen_bottom: "rgb(230, 230, 230)",
931
+ silkscreen_top: "rgb(230, 230, 230)",
932
+ soldermask: "rgb(20, 51, 36)",
933
+ solderpaste: "rgb(128, 128, 128)"
934
+ },
935
+ board: {
936
+ anchor: "rgb(255, 38, 226)",
937
+ aux_items: "rgb(255, 255, 255)",
938
+ b_adhes: "rgb(0, 0, 132)",
939
+ b_crtyd: "rgb(255, 38, 226)",
940
+ b_fab: "rgb(88, 93, 132)",
941
+ b_mask: "rgba(2, 255, 238, 0.400)",
942
+ b_paste: "rgb(0, 194, 194)",
943
+ b_silks: "rgb(232, 178, 167)",
944
+ background: "rgb(0, 16, 35)",
945
+ cmts_user: "rgb(89, 148, 220)",
946
+ copper: {
947
+ b: "rgb(77, 127, 196)",
948
+ f: "rgb(200, 52, 52)",
949
+ in1: "rgb(127, 200, 127)",
950
+ in10: "rgb(237, 124, 51)",
951
+ in11: "rgb(91, 195, 235)",
952
+ in12: "rgb(247, 111, 142)",
953
+ in13: "rgb(167, 165, 198)",
954
+ in14: "rgb(40, 204, 217)",
955
+ in15: "rgb(232, 178, 167)",
956
+ in16: "rgb(242, 237, 161)",
957
+ in17: "rgb(237, 124, 51)",
958
+ in18: "rgb(91, 195, 235)",
959
+ in19: "rgb(247, 111, 142)",
960
+ in2: "rgb(206, 125, 44)",
961
+ in20: "rgb(167, 165, 198)",
962
+ in21: "rgb(40, 204, 217)",
963
+ in22: "rgb(232, 178, 167)",
964
+ in23: "rgb(242, 237, 161)",
965
+ in24: "rgb(237, 124, 51)",
966
+ in25: "rgb(91, 195, 235)",
967
+ in26: "rgb(247, 111, 142)",
968
+ in27: "rgb(167, 165, 198)",
969
+ in28: "rgb(40, 204, 217)",
970
+ in29: "rgb(232, 178, 167)",
971
+ in3: "rgb(79, 203, 203)",
972
+ in30: "rgb(242, 237, 161)",
973
+ in4: "rgb(219, 98, 139)",
974
+ in5: "rgb(167, 165, 198)",
975
+ in6: "rgb(40, 204, 217)",
976
+ in7: "rgb(232, 178, 167)",
977
+ in8: "rgb(242, 237, 161)",
978
+ in9: "rgb(141, 203, 129)"
979
+ },
980
+ cursor: "rgb(255, 255, 255)",
981
+ drc: "rgb(194, 194, 194)",
982
+ drc_error: "rgba(215, 91, 107, 0.800)",
983
+ drc_exclusion: "rgb(255, 255, 255)",
984
+ drc_warning: "rgba(255, 208, 66, 0.902)",
985
+ dwgs_user: "rgb(194, 194, 194)",
986
+ eco1_user: "rgb(180, 219, 210)",
987
+ eco2_user: "rgb(216, 200, 82)",
988
+ edge_cuts: "rgb(208, 210, 205)",
989
+ f_adhes: "rgb(132, 0, 132)",
990
+ f_crtyd: "rgb(255, 0, 245)",
991
+ f_fab: "rgb(175, 175, 175)",
992
+ f_mask: "rgba(216, 100, 255, 0.400)",
993
+ f_paste: "rgba(180, 160, 154, 0.902)",
994
+ f_silks: "rgb(242, 237, 161)",
995
+ footprint_text_back: "rgb(0, 0, 132)",
996
+ footprint_text_front: "rgb(194, 194, 194)",
997
+ footprint_text_invisible: "rgb(132, 132, 132)",
998
+ grid: "rgb(132, 132, 132)",
999
+ grid_axes: "rgb(194, 194, 194)",
1000
+ margin: "rgb(255, 38, 226)",
1001
+ microvia: "rgb(0, 132, 132)",
1002
+ no_connect: "rgb(0, 0, 132)",
1003
+ pad_back: "rgb(77, 127, 196)",
1004
+ pad_front: "rgb(200, 52, 52)",
1005
+ pad_plated_hole: "rgb(194, 194, 0)",
1006
+ pad_through_hole: "rgb(227, 183, 46)",
1007
+ plated_hole: "rgb(26, 196, 210)",
1008
+ ratsnest: "rgba(245, 255, 213, 0.702)",
1009
+ select_overlay: "rgb(4, 255, 67)",
1010
+ through_via: "rgb(236, 236, 236)",
1011
+ user_1: "rgb(194, 194, 194)",
1012
+ user_2: "rgb(89, 148, 220)",
1013
+ user_3: "rgb(180, 219, 210)",
1014
+ user_4: "rgb(216, 200, 82)",
1015
+ user_5: "rgb(194, 194, 194)",
1016
+ user_6: "rgb(89, 148, 220)",
1017
+ user_7: "rgb(180, 219, 210)",
1018
+ user_8: "rgb(216, 200, 82)",
1019
+ user_9: "rgb(232, 178, 167)",
1020
+ via_blind_buried: "rgb(187, 151, 38)",
1021
+ via_hole: "rgb(227, 183, 46)",
1022
+ via_micro: "rgb(0, 132, 132)",
1023
+ via_through: "rgb(236, 236, 236)",
1024
+ worksheet: "rgb(200, 114, 171)"
1025
+ },
1026
+ gerbview: {
1027
+ axes: "rgb(0, 0, 132)",
1028
+ background: "rgb(0, 0, 0)",
1029
+ dcodes: "rgb(255, 255, 255)",
1030
+ grid: "rgb(132, 132, 132)",
1031
+ layers: [
1032
+ "rgb(132, 0, 0)",
1033
+ "rgb(194, 194, 0)",
1034
+ "rgb(194, 0, 194)",
1035
+ "rgb(194, 0, 0)",
1036
+ "rgb(0, 132, 132)",
1037
+ "rgb(0, 132, 0)",
1038
+ "rgb(0, 0, 132)",
1039
+ "rgb(132, 132, 132)",
1040
+ "rgb(132, 0, 132)",
1041
+ "rgb(194, 194, 194)",
1042
+ "rgb(132, 0, 132)",
1043
+ "rgb(132, 0, 0)",
1044
+ "rgb(132, 132, 0)",
1045
+ "rgb(194, 194, 194)",
1046
+ "rgb(0, 0, 132)",
1047
+ "rgb(0, 132, 0)",
1048
+ "rgb(132, 0, 0)",
1049
+ "rgb(194, 194, 0)",
1050
+ "rgb(194, 0, 194)",
1051
+ "rgb(194, 0, 0)",
1052
+ "rgb(0, 132, 132)",
1053
+ "rgb(0, 132, 0)",
1054
+ "rgb(0, 0, 132)",
1055
+ "rgb(132, 132, 132)",
1056
+ "rgb(132, 0, 132)",
1057
+ "rgb(194, 194, 194)",
1058
+ "rgb(132, 0, 132)",
1059
+ "rgb(132, 0, 0)",
1060
+ "rgb(132, 132, 0)",
1061
+ "rgb(194, 194, 194)",
1062
+ "rgb(0, 0, 132)",
1063
+ "rgb(0, 132, 0)",
1064
+ "rgb(132, 0, 0)",
1065
+ "rgb(194, 194, 0)",
1066
+ "rgb(194, 0, 194)",
1067
+ "rgb(194, 0, 0)",
1068
+ "rgb(0, 132, 132)",
1069
+ "rgb(0, 132, 0)",
1070
+ "rgb(0, 0, 132)",
1071
+ "rgb(132, 132, 132)",
1072
+ "rgb(132, 0, 132)",
1073
+ "rgb(194, 194, 194)",
1074
+ "rgb(132, 0, 132)",
1075
+ "rgb(132, 0, 0)",
1076
+ "rgb(132, 132, 0)",
1077
+ "rgb(194, 194, 194)",
1078
+ "rgb(0, 0, 132)",
1079
+ "rgb(0, 132, 0)",
1080
+ "rgb(132, 0, 0)",
1081
+ "rgb(194, 194, 0)",
1082
+ "rgb(194, 0, 194)",
1083
+ "rgb(194, 0, 0)",
1084
+ "rgb(0, 132, 132)",
1085
+ "rgb(0, 132, 0)",
1086
+ "rgb(0, 0, 132)",
1087
+ "rgb(132, 132, 132)",
1088
+ "rgb(132, 0, 132)",
1089
+ "rgb(194, 194, 194)",
1090
+ "rgb(132, 0, 132)",
1091
+ "rgb(132, 0, 0)"
1092
+ ],
1093
+ negative_objects: "rgb(132, 132, 132)",
1094
+ worksheet: "rgb(0, 0, 132)"
1095
+ },
1096
+ palette: [
1097
+ "rgb(132, 0, 0)",
1098
+ "rgb(194, 194, 0)",
1099
+ "rgb(194, 0, 194)",
1100
+ "rgb(194, 0, 0)",
1101
+ "rgb(0, 132, 132)",
1102
+ "rgb(0, 132, 0)",
1103
+ "rgb(0, 0, 132)",
1104
+ "rgb(132, 132, 132)",
1105
+ "rgb(132, 0, 132)",
1106
+ "rgb(194, 194, 194)",
1107
+ "rgb(132, 0, 132)",
1108
+ "rgb(132, 0, 0)",
1109
+ "rgb(132, 132, 0)",
1110
+ "rgb(194, 194, 194)",
1111
+ "rgb(0, 0, 132)",
1112
+ "rgb(0, 132, 0)"
1113
+ ],
1114
+ schematic: {
1115
+ anchor: "rgb(0, 0, 255)",
1116
+ aux_items: "rgb(0, 0, 0)",
1117
+ background: "rgb(33, 33, 33)",
1118
+ brightened: "rgb(204, 204, 204)",
1119
+ bus: "rgb(0, 96, 192)",
1120
+ bus_junction: "rgb(0, 96, 192)",
1121
+ component_body: "rgb(44, 44, 44)",
1122
+ component_outline: "rgb(192, 0, 0)",
1123
+ cursor: "rgb(224, 224, 224)",
1124
+ erc_error: "rgba(192, 48, 48, 0.800)",
1125
+ erc_warning: "rgba(192, 140, 0, 0.800)",
1126
+ fields: "rgb(128, 0, 160)",
1127
+ grid: "rgb(60, 60, 60)",
1128
+ grid_axes: "rgb(60, 60, 60)",
1129
+ hidden: "rgb(194, 194, 194)",
1130
+ junction: "rgb(0, 160, 0)",
1131
+ label_global: "rgb(0, 160, 224)",
1132
+ label_hier: "rgb(160, 160, 0)",
1133
+ label_local: "rgb(192, 192, 192)",
1134
+ net_name: "rgb(224, 224, 224)",
1135
+ no_connect: "rgb(97, 43, 224)",
1136
+ note: "rgb(192, 192, 0)",
1137
+ override_item_colors: false,
1138
+ pin: "rgb(192, 0, 0)",
1139
+ pin_name: "rgb(192, 192, 192)",
1140
+ pin_number: "rgb(192, 0, 0)",
1141
+ reference: "rgb(192, 192, 192)",
1142
+ shadow: "rgba(102, 179, 255, 0.800)",
1143
+ sheet: "rgb(128, 0, 160)",
1144
+ sheet_background: "rgba(255, 255, 255, 0.000)",
1145
+ sheet_fields: "rgb(160, 160, 0)",
1146
+ sheet_filename: "rgb(160, 160, 0)",
1147
+ sheet_label: "rgb(160, 160, 0)",
1148
+ sheet_name: "rgb(0, 160, 204)",
1149
+ value: "rgb(192, 192, 192)",
1150
+ wire: "rgb(0, 160, 0)",
1151
+ worksheet: "rgb(192, 0, 0)"
1152
+ }
1153
+ };
1154
+
1155
+ // src/lib/Drawer.ts
1156
+ var LAYER_NAME_TO_COLOR = {
1157
+ red: "red",
1158
+ black: "black",
1159
+ green: "green",
1160
+ top: colors_default.board.copper.f,
1161
+ keepout: colors_default.board.background,
1162
+ tkeepout: colors_default.board.b_crtyd,
1163
+ tplace: colors_default.board.b_silks,
1164
+ ...colors_default.board
1165
+ };
1166
+ var Drawer = class {
1167
+ constructor(canvas) {
1168
+ this.canvas = canvas;
1169
+ this.canvas = canvas;
1170
+ this.ctx = canvas.getContext("2d");
1171
+ this.transform = (0, import_transformation_matrix2.identity)();
1172
+ this.transform.d *= -1;
1173
+ this.transform = (0, import_transformation_matrix2.compose)(this.transform, (0, import_transformation_matrix2.translate)(0, -500));
1174
+ }
1175
+ clear() {
1176
+ const { ctx, canvas } = this;
1177
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1178
+ }
1179
+ equip(aperature) {
1180
+ this.aperture = {
1181
+ fontSize: 0,
1182
+ shape: "circle",
1183
+ mode: "add",
1184
+ size: 0,
1185
+ color: "red",
1186
+ ...aperature
1187
+ };
1188
+ }
1189
+ rect(x, y, w, h) {
1190
+ const [x1$, y1$] = (0, import_transformation_matrix2.applyToPoint)(this.transform, [x, y]);
1191
+ const [x2$, y2$] = (0, import_transformation_matrix2.applyToPoint)(this.transform, [x + w, y + h]);
1192
+ this.applyAperture();
1193
+ this.ctx.fillRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
1194
+ }
1195
+ circle(x, y, r) {
1196
+ const r$ = scaleOnly(this.transform, r);
1197
+ const [x$, y$] = (0, import_transformation_matrix2.applyToPoint)(this.transform, [x, y]);
1198
+ this.applyAperture();
1199
+ this.ctx.beginPath();
1200
+ this.ctx.arc(x$, y$, r$ * 2, 0, 2 * Math.PI);
1201
+ this.ctx.fill();
1202
+ this.ctx.closePath();
1203
+ }
1204
+ text(text, x, y) {
1205
+ const [x$, y$] = (0, import_transformation_matrix2.applyToPoint)(this.transform, [x, y]);
1206
+ this.applyAperture();
1207
+ this.ctx.fillText(text, x$, y$);
1208
+ }
1209
+ applyAperture() {
1210
+ const { ctx, transform, aperture } = this;
1211
+ const { size, mode, color, fontSize } = aperture;
1212
+ ctx.lineWidth = scaleOnly(transform, size);
1213
+ ctx.lineCap = "round";
1214
+ if (mode === "add") {
1215
+ let colorString = color[0] === "#" || color.startsWith("rgb") ? color : LAYER_NAME_TO_COLOR[color.toLowerCase()] ? LAYER_NAME_TO_COLOR[color.toLowerCase()] : null;
1216
+ if (colorString === null) {
1217
+ console.warn(`Color mapping for "${color}" not found`);
1218
+ colorString = "white";
1219
+ }
1220
+ ctx.fillStyle = colorString;
1221
+ ctx.strokeStyle = colorString;
1222
+ } else {
1223
+ ctx.globalCompositeOperation = "destination-out";
1224
+ ctx.fillStyle = "rgba(0,0,0,1)";
1225
+ ctx.strokeStyle = "rgba(0,0,0,1)";
1226
+ }
1227
+ ctx.font = `${scaleOnly(transform, fontSize)}px sans-serif`;
1228
+ }
1229
+ moveTo(x, y) {
1230
+ this.lastPoint = { x, y };
1231
+ }
1232
+ lineTo(x, y) {
1233
+ const [x$, y$] = (0, import_transformation_matrix2.applyToPoint)(this.transform, [x, y]);
1234
+ const { size, shape, mode } = this.aperture;
1235
+ const size$ = scaleOnly(this.transform, size);
1236
+ let { lastPoint, ctx } = this;
1237
+ const lastPoint$ = (0, import_transformation_matrix2.applyToPoint)(this.transform, lastPoint);
1238
+ this.applyAperture();
1239
+ if (shape === "square")
1240
+ ctx.fillRect(
1241
+ lastPoint$.x - size$ / 2,
1242
+ lastPoint$.y - size$ / 2,
1243
+ size$,
1244
+ size$
1245
+ );
1246
+ ctx.beginPath();
1247
+ ctx.moveTo(lastPoint$.x, lastPoint$.y);
1248
+ ctx.lineTo(x$, y$);
1249
+ ctx.stroke();
1250
+ ctx.closePath();
1251
+ if (shape === "square")
1252
+ ctx.fillRect(x$ - size$ / 2, y$ - size$ / 2, size$, size$);
1253
+ this.lastPoint = { x, y };
1254
+ }
1255
+ };
1256
+
1257
+ // src/pages/eagle.tsx
1258
+ var eagle_default = () => {
1259
+ const ref = (0, import_react.useRef)();
1260
+ let [width, height] = [500, 500];
1261
+ (0, import_react.useEffect)(() => {
1262
+ const drawer = new Drawer(ref.current);
1263
+ drawer.clear();
1264
+ drawEagle(drawer, attiny_eagle_default);
1265
+ }, []);
1266
+ return /* @__PURE__ */ import_react.default.createElement("div", {
1267
+ style: { backgroundColor: "black" }
1268
+ }, /* @__PURE__ */ import_react.default.createElement("canvas", {
1269
+ ref,
1270
+ width,
1271
+ height
1272
+ }));
1273
+ };
1274
+ // Annotate the CommonJS export names for ESM import in node:
1275
+ 0 && (module.exports = {});
1276
+ //# sourceMappingURL=eagle.js.map