schematic-symbols 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1652 @@
1
+ // drawing/path.ts
2
+ function path(options) {
3
+ return { type: "path", ...options };
4
+ }
5
+
6
+ // drawing/text.ts
7
+ function text(text2, options) {
8
+ return { type: "text", text: text2, ...options };
9
+ }
10
+
11
+ // drawing/defineSymbol.ts
12
+ function defineSymbol(symbol) {
13
+ return symbol;
14
+ }
15
+
16
+ // symbols/boxresistor_horz.ts
17
+ var boxresistor_horz_default = defineSymbol({
18
+ primitives: [
19
+ path({
20
+ points: [
21
+ { x: 0, y: 0 },
22
+ { x: 0.2, y: 0 },
23
+ { x: 0.2, y: -0.12 },
24
+ { x: 0.8, y: -0.12 },
25
+ { x: 0.8, y: 0.12 },
26
+ { x: 0.2, y: 0.12 },
27
+ { x: 0.2, y: 0 }
28
+ ],
29
+ color: "primary"
30
+ }),
31
+ path({
32
+ points: [
33
+ { x: 0.8, y: 0 },
34
+ { x: 1, y: 0 }
35
+ ],
36
+ color: "primary"
37
+ }),
38
+ text("{REF}", { x: 0.5, y: -0.2, anchor: "middle_bottom" }),
39
+ text("{VAL}", { x: 0.5, y: 0.2, anchor: "middle_top" })
40
+ ],
41
+ ports: [
42
+ { x: 0, y: 0, labels: ["1", "-", "left"] },
43
+ { x: 1, y: 0, labels: ["2", "+", "right"] }
44
+ ],
45
+ center: { x: 0.5, y: 0 },
46
+ size: { width: 1, height: 0.55 }
47
+ });
48
+
49
+ // drawing/rotateSymbol.ts
50
+ import { rotate, applyToPoint } from "transformation-matrix";
51
+ var rotateAnchor = (anchor) => {
52
+ switch (anchor) {
53
+ case "middle_top":
54
+ return "middle_right";
55
+ case "middle_bottom":
56
+ return "middle_left";
57
+ }
58
+ return anchor;
59
+ };
60
+ var rotateSymbol = (symbol, overrides) => {
61
+ const transform = rotate(Math.PI / 2, symbol.center.x, symbol.center.y);
62
+ const { primitives, center, size, ports } = symbol;
63
+ const rotatedPrimitives = primitives.map((primitive) => {
64
+ primitive = { ...primitive };
65
+ switch (primitive.type) {
66
+ case "path":
67
+ return {
68
+ ...primitive,
69
+ points: primitive.points.map(
70
+ (point) => applyToPoint(transform, point)
71
+ )
72
+ };
73
+ case "text":
74
+ const rotatedPoint = applyToPoint(transform, {
75
+ x: primitive.x,
76
+ y: primitive.y
77
+ });
78
+ primitive.anchor = rotateAnchor(primitive.anchor);
79
+ return {
80
+ ...primitive,
81
+ x: rotatedPoint.x,
82
+ y: rotatedPoint.y
83
+ };
84
+ case "circle":
85
+ const rotatedCenter = applyToPoint(transform, {
86
+ x: primitive.x,
87
+ y: primitive.y
88
+ });
89
+ return {
90
+ ...primitive,
91
+ x: rotatedCenter.x,
92
+ y: rotatedCenter.y
93
+ };
94
+ case "box":
95
+ const rotatedCorner = applyToPoint(transform, {
96
+ x: primitive.x,
97
+ y: primitive.y
98
+ });
99
+ return {
100
+ ...primitive,
101
+ x: rotatedCorner.x,
102
+ y: rotatedCorner.y,
103
+ width: primitive.height,
104
+ height: primitive.width
105
+ };
106
+ }
107
+ });
108
+ const rotatedPorts = ports.map(
109
+ (port) => ({
110
+ ...port,
111
+ ...applyToPoint(transform, port)
112
+ })
113
+ );
114
+ return {
115
+ primitives: rotatedPrimitives,
116
+ center,
117
+ ports: rotatedPorts,
118
+ // TODO recompute size using overrides
119
+ size: {
120
+ width: size.height,
121
+ height: size.width
122
+ },
123
+ ...overrides
124
+ };
125
+ };
126
+
127
+ // symbols/boxresistor_vert.ts
128
+ var boxresistor_vert_default = rotateSymbol(boxresistor_horz_default);
129
+
130
+ // assets/symbols-svg-json/diode.json
131
+ var diode_default = {
132
+ paths: {
133
+ path40: {
134
+ type: "path",
135
+ points: [
136
+ {
137
+ x: 0.1413337499999998,
138
+ y: 0
139
+ },
140
+ {
141
+ x: -0.12324954999999971,
142
+ y: 0.13229169999999968
143
+ }
144
+ ],
145
+ color: "primary",
146
+ fill: false
147
+ },
148
+ path41: {
149
+ type: "path",
150
+ points: [
151
+ {
152
+ x: -0.12324954999999971,
153
+ y: -0.13229170000000323
154
+ },
155
+ {
156
+ x: 0.1413337499999998,
157
+ y: 0
158
+ }
159
+ ],
160
+ color: "primary",
161
+ fill: false
162
+ },
163
+ path42: {
164
+ type: "path",
165
+ points: [
166
+ {
167
+ x: -0.12324954999999971,
168
+ y: 0.13229169999999613
169
+ },
170
+ {
171
+ x: -0.12324954999999971,
172
+ y: -0.13229170000000323
173
+ }
174
+ ],
175
+ color: "primary",
176
+ fill: false
177
+ },
178
+ path43: {
179
+ type: "path",
180
+ points: [
181
+ {
182
+ x: 0.1413337499999998,
183
+ y: -0.13229170000000323
184
+ },
185
+ {
186
+ x: 0.1413337499999998,
187
+ y: 0.13229169999999613
188
+ }
189
+ ],
190
+ color: "primary",
191
+ fill: false
192
+ },
193
+ path44: {
194
+ type: "path",
195
+ points: [
196
+ {
197
+ x: -0.12545424999999977,
198
+ y: 0
199
+ },
200
+ {
201
+ x: -0.5201245499999998,
202
+ y: 0
203
+ }
204
+ ],
205
+ color: "primary",
206
+ fill: false
207
+ },
208
+ "path44-0": {
209
+ type: "path",
210
+ points: [
211
+ {
212
+ x: 0.5201245499999998,
213
+ y: 8519999999734296e-20
214
+ },
215
+ {
216
+ x: 0.1464164499999998,
217
+ y: 8519999999734296e-20
218
+ }
219
+ ],
220
+ color: "primary",
221
+ fill: false
222
+ }
223
+ },
224
+ texts: {
225
+ top1: {
226
+ type: "text",
227
+ text: "{REF}",
228
+ x: -0.008280249999999878,
229
+ y: -0.22980899999999949
230
+ },
231
+ bottom1: {
232
+ type: "text",
233
+ text: "{VAL}",
234
+ x: -0.0033669500000002017,
235
+ y: 0.31788159999999976
236
+ }
237
+ },
238
+ refblocks: {
239
+ left1: {
240
+ x: -0.5224022500000003,
241
+ y: -8844000000003405e-19
242
+ },
243
+ right1: {
244
+ x: 0.5158919499999999,
245
+ y: 14019999999703714e-20
246
+ }
247
+ },
248
+ bounds: {
249
+ minX: -0.5201245499999998,
250
+ maxX: 0.5201245499999998,
251
+ minY: -0.13229170000000323,
252
+ maxY: 0.13229169999999968,
253
+ width: 1.0402490999999996,
254
+ height: 0.2645834000000029,
255
+ centerX: 0,
256
+ centerY: -17763568394002505e-31
257
+ }
258
+ };
259
+
260
+ // symbols/diode_horz.ts
261
+ var { paths, texts, bounds, refblocks } = diode_default;
262
+ var diode_horz_default = defineSymbol({
263
+ primitives: [
264
+ ...Object.values(paths),
265
+ { ...texts.top1, anchor: "middle_left" },
266
+ { ...texts.bottom1, anchor: "middle_left" }
267
+ ],
268
+ ports: [
269
+ { ...refblocks.left1, labels: ["1"] },
270
+ // TODO add more "standard" labels
271
+ { ...refblocks.right1, labels: ["2"] }
272
+ // TODO add more "standard" labels
273
+ ],
274
+ size: { width: bounds.width, height: bounds.height },
275
+ center: { x: bounds.centerX, y: bounds.centerY }
276
+ });
277
+
278
+ // symbols/diode_vert.ts
279
+ var diode_vert_default = rotateSymbol(diode_horz_default);
280
+
281
+ // assets/symbols-svg-json/fuse.json
282
+ var fuse_default = {
283
+ paths: {
284
+ path10: {
285
+ type: "path",
286
+ points: [
287
+ {
288
+ x: -0.529167000000001,
289
+ y: 0
290
+ },
291
+ {
292
+ x: 0.5291669999999993,
293
+ y: 0
294
+ }
295
+ ],
296
+ color: "primary",
297
+ fill: false
298
+ },
299
+ path14: {
300
+ type: "path",
301
+ points: [
302
+ {
303
+ x: 1999999998503199e-21,
304
+ y: -0.13229169999999968
305
+ },
306
+ {
307
+ x: 0.2645849999999985,
308
+ y: -0.13229169999999968
309
+ },
310
+ {
311
+ x: 0.2645849999999985,
312
+ y: 0.13229169999999968
313
+ },
314
+ {
315
+ x: -0.26458200000000076,
316
+ y: 0.13229169999999968
317
+ },
318
+ {
319
+ x: -0.26458200000000076,
320
+ y: -0.13229169999999968
321
+ },
322
+ {
323
+ x: 1999999998503199e-21,
324
+ y: -0.13229169999999968
325
+ }
326
+ ],
327
+ color: "primary",
328
+ fill: false
329
+ }
330
+ },
331
+ texts: {
332
+ top1: {
333
+ type: "text",
334
+ text: "{REF}",
335
+ x: -0.00912720000000089,
336
+ y: -0.1995035999999999
337
+ },
338
+ bottom1: {
339
+ type: "text",
340
+ text: "{VAL}",
341
+ x: -0.17251720000000148,
342
+ y: 0.27233090000000004
343
+ }
344
+ },
345
+ refblocks: {
346
+ left1: {
347
+ x: -0.5354181000000011,
348
+ y: -0.0030468999999992974
349
+ },
350
+ right1: {
351
+ x: 0.5336915999999992,
352
+ y: 0.0011575000000014768
353
+ }
354
+ },
355
+ bounds: {
356
+ minX: -0.529167000000001,
357
+ maxX: 0.5291669999999993,
358
+ minY: -0.13229169999999968,
359
+ maxY: 0.13229169999999968,
360
+ width: 1.0583340000000003,
361
+ height: 0.26458339999999936,
362
+ centerX: -8881784197001252e-31,
363
+ centerY: 0
364
+ }
365
+ };
366
+
367
+ // symbols/fuse_horz.ts
368
+ var { paths: paths2, texts: texts2, bounds: bounds2, refblocks: refblocks2 } = fuse_default;
369
+ var fuse_horz_default = defineSymbol({
370
+ primitives: [
371
+ ...Object.values(paths2),
372
+ { ...texts2.top1, anchor: "middle_bottom" },
373
+ {
374
+ type: "text",
375
+ text: "{VAL}",
376
+ x: 0,
377
+ y: 0.2,
378
+ anchor: "middle_top"
379
+ }
380
+ ],
381
+ ports: [
382
+ { ...refblocks2.left1, labels: ["1"] },
383
+ // TODO add more "standard" labels
384
+ { ...refblocks2.right1, labels: ["2"] }
385
+ // TODO add more "standard" labels
386
+ ],
387
+ size: { width: bounds2.width, height: bounds2.height },
388
+ center: { x: bounds2.centerX, y: bounds2.centerY }
389
+ });
390
+
391
+ // symbols/fuse_vert.ts
392
+ var fuse_vert_default = rotateSymbol(fuse_horz_default);
393
+
394
+ // assets/symbols-svg-json/led.json
395
+ var led_default = {
396
+ paths: {
397
+ path45: {
398
+ type: "path",
399
+ points: [
400
+ {
401
+ x: 0.13537969999999966,
402
+ y: 0.09743664999999524
403
+ },
404
+ {
405
+ x: -0.1292036000000003,
406
+ y: 0.22972834999999847
407
+ }
408
+ ],
409
+ color: "primary",
410
+ fill: false
411
+ },
412
+ "path1-8": {
413
+ type: "path",
414
+ points: [
415
+ {
416
+ x: 0.12715889999999996,
417
+ y: 0.09766044999999579
418
+ },
419
+ {
420
+ x: 0.5260786,
421
+ y: 0.09766044999999579
422
+ }
423
+ ],
424
+ color: "primary",
425
+ fill: false
426
+ },
427
+ path46: {
428
+ type: "path",
429
+ points: [
430
+ {
431
+ x: -0.1292036000000003,
432
+ y: -0.03485505000000444
433
+ },
434
+ {
435
+ x: 0.13537969999999966,
436
+ y: 0.09743664999999524
437
+ }
438
+ ],
439
+ color: "primary",
440
+ fill: false
441
+ },
442
+ path47: {
443
+ type: "path",
444
+ points: [
445
+ {
446
+ x: -0.1292036000000003,
447
+ y: 0.22972834999999847
448
+ },
449
+ {
450
+ x: -0.1292036000000003,
451
+ y: -0.03485505000000444
452
+ }
453
+ ],
454
+ color: "primary",
455
+ fill: false
456
+ },
457
+ path48: {
458
+ type: "path",
459
+ points: [
460
+ {
461
+ x: 0.13537969999999966,
462
+ y: -0.03485505000000444
463
+ },
464
+ {
465
+ x: 0.13537969999999966,
466
+ y: 0.22972834999999847
467
+ }
468
+ ],
469
+ color: "primary",
470
+ fill: false
471
+ },
472
+ path49: {
473
+ type: "path",
474
+ points: [
475
+ {
476
+ x: -0.13124740000000035,
477
+ y: 0.09743664999999524
478
+ },
479
+ {
480
+ x: -0.5260786000000004,
481
+ y: 0.09743664999999524
482
+ }
483
+ ],
484
+ color: "primary",
485
+ fill: false
486
+ },
487
+ path25: {
488
+ type: "path",
489
+ points: [
490
+ {
491
+ x: -0.15622170000000057,
492
+ y: -0.19171255000000187
493
+ },
494
+ {
495
+ x: -0.25356400000000034,
496
+ y: -0.20859175000000363
497
+ },
498
+ {
499
+ x: -0.2192612000000005,
500
+ y: -0.11582895000000448
501
+ },
502
+ {
503
+ x: -0.15622170000000057,
504
+ y: -0.19171255000000187
505
+ }
506
+ ],
507
+ color: "primary",
508
+ fill: true
509
+ },
510
+ path78: {
511
+ type: "path",
512
+ points: [
513
+ {
514
+ x: -0.08048230000000034,
515
+ y: -0.07216775000000197
516
+ },
517
+ {
518
+ x: -0.09250580000000008,
519
+ y: -0.0811007500000045
520
+ },
521
+ {
522
+ x: -0.21426230000000057,
523
+ y: -0.17155655000000536
524
+ },
525
+ {
526
+ x: -0.21489230000000026,
527
+ y: -0.17250655000000492
528
+ }
529
+ ],
530
+ color: "primary",
531
+ fill: false
532
+ },
533
+ "path25-0": {
534
+ type: "path",
535
+ points: [
536
+ {
537
+ x: 0.021244599999999725,
538
+ y: -0.21284915000000026
539
+ },
540
+ {
541
+ x: -0.07609770000000049,
542
+ y: -0.22972835000000202
543
+ },
544
+ {
545
+ x: -0.04179490000000019,
546
+ y: -0.13696555000000288
547
+ },
548
+ {
549
+ x: 0.021244599999999725,
550
+ y: -0.21284915000000026
551
+ }
552
+ ],
553
+ color: "primary",
554
+ fill: true
555
+ },
556
+ "path78-6": {
557
+ type: "path",
558
+ points: [
559
+ {
560
+ x: 0.09698399999999996,
561
+ y: -0.09330435000000037
562
+ },
563
+ {
564
+ x: 0.08496049999999977,
565
+ y: -0.10223735000000289
566
+ },
567
+ {
568
+ x: -0.03679600000000027,
569
+ y: -0.19269315000000375
570
+ },
571
+ {
572
+ x: -0.0374260000000004,
573
+ y: -0.19364315000000332
574
+ }
575
+ ],
576
+ color: "primary",
577
+ fill: false
578
+ }
579
+ },
580
+ texts: {
581
+ bottom1: {
582
+ type: "text",
583
+ text: "{VAL}",
584
+ x: -0.010039500000000423,
585
+ y: 0.4172088499999944
586
+ },
587
+ right1: {
588
+ type: "text",
589
+ text: "{REF}",
590
+ x: 0.31416289999999947,
591
+ y: -0.13012545000000486
592
+ }
593
+ },
594
+ refblocks: {
595
+ left1: {
596
+ x: -0.5366871000000006,
597
+ y: 0.09817314999999738
598
+ },
599
+ right1: {
600
+ x: 0.5357314999999994,
601
+ y: 0.09862664999999993
602
+ }
603
+ },
604
+ bounds: {
605
+ minX: -0.5260786000000004,
606
+ maxX: 0.5260786,
607
+ minY: -0.22972835000000202,
608
+ maxY: 0.22972834999999847,
609
+ width: 1.0521572000000003,
610
+ height: 0.4594567000000005,
611
+ centerX: -2220446049250313e-31,
612
+ centerY: -17763568394002505e-31
613
+ }
614
+ };
615
+
616
+ // symbols/led_horz.ts
617
+ var { paths: paths3, texts: texts3, bounds: bounds3, refblocks: refblocks3 } = led_default;
618
+ var led_horz_default = defineSymbol({
619
+ primitives: [
620
+ ...Object.values(paths3),
621
+ { ...texts3.bottom1, anchor: "middle_left" },
622
+ { ...texts3.right1, anchor: "middle_left" }
623
+ ],
624
+ ports: [
625
+ { ...refblocks3.left1, labels: ["1", "anode", "pos"] },
626
+ { ...refblocks3.right1, labels: ["2", "cathode", "neg"] }
627
+ ],
628
+ size: { width: bounds3.width, height: bounds3.height },
629
+ center: { x: bounds3.centerX, y: bounds3.centerY + 0.1 }
630
+ });
631
+
632
+ // symbols/led_vert.ts
633
+ var led_vert_default = rotateSymbol(led_horz_default);
634
+
635
+ // assets/symbols-svg-json/mosfet_depletion_normally_on.json
636
+ var mosfet_depletion_normally_on_default = {
637
+ paths: {
638
+ path208: {
639
+ type: "path",
640
+ points: [
641
+ {
642
+ x: 0.39687494999999995,
643
+ y: -0.13228999999999935
644
+ },
645
+ {
646
+ x: 0.5291666500000005,
647
+ y: 0.13229300000000066
648
+ }
649
+ ],
650
+ color: "primary",
651
+ fill: false
652
+ },
653
+ path209: {
654
+ type: "path",
655
+ points: [
656
+ {
657
+ x: 0.26458325000000027,
658
+ y: 0.13229300000000066
659
+ },
660
+ {
661
+ x: 0.39687494999999995,
662
+ y: -0.13228999999999935
663
+ }
664
+ ],
665
+ color: "primary",
666
+ fill: false
667
+ },
668
+ path210: {
669
+ type: "path",
670
+ points: [
671
+ {
672
+ x: 0.5291666500000005,
673
+ y: 0.13229300000000066
674
+ },
675
+ {
676
+ x: 0.26458325000000027,
677
+ y: 0.13229300000000066
678
+ }
679
+ ],
680
+ color: "primary",
681
+ fill: false
682
+ },
683
+ path211: {
684
+ type: "path",
685
+ points: [
686
+ {
687
+ x: 0.26458325000000027,
688
+ y: -0.13228999999999935
689
+ },
690
+ {
691
+ x: 0.5291666500000005,
692
+ y: -0.13228999999999935
693
+ }
694
+ ],
695
+ color: "primary",
696
+ fill: false
697
+ },
698
+ path212: {
699
+ type: "path",
700
+ points: [
701
+ {
702
+ x: 0.13229165000000087,
703
+ y: 0.39687499999999964
704
+ },
705
+ {
706
+ x: 0.39687494999999995,
707
+ y: 0.39687499999999964
708
+ }
709
+ ],
710
+ color: "primary",
711
+ fill: false
712
+ },
713
+ path213: {
714
+ type: "path",
715
+ points: [
716
+ {
717
+ x: 0.39687494999999995,
718
+ y: -0.3968740000000004
719
+ },
720
+ {
721
+ x: 0.13229165000000087,
722
+ y: -0.3968740000000004
723
+ }
724
+ ],
725
+ color: "primary",
726
+ fill: false
727
+ },
728
+ path214: {
729
+ type: "path",
730
+ points: [
731
+ {
732
+ x: 0.13229165000000087,
733
+ y: -0.529166
734
+ },
735
+ {
736
+ x: 0.13229165000000087,
737
+ y: -0.1852090000000004
738
+ }
739
+ ],
740
+ color: "primary",
741
+ fill: false
742
+ },
743
+ path215: {
744
+ type: "path",
745
+ points: [
746
+ {
747
+ x: 0.13229165000000087,
748
+ y: 0.529166
749
+ },
750
+ {
751
+ x: 0.13229165000000087,
752
+ y: -9999999992515995e-22
753
+ }
754
+ ],
755
+ color: "primary",
756
+ fill: false
757
+ },
758
+ path216: {
759
+ type: "path",
760
+ points: [
761
+ {
762
+ x: 0.39687494999999995,
763
+ y: 0.39687563000000026
764
+ },
765
+ {
766
+ x: 0.39687494999999995,
767
+ y: -0.3968746999999997
768
+ }
769
+ ],
770
+ color: "primary",
771
+ fill: false
772
+ },
773
+ path217: {
774
+ type: "path",
775
+ points: [
776
+ {
777
+ x: -0.13229164999999998,
778
+ y: -0.2645850000000003
779
+ },
780
+ {
781
+ x: -0.13229164999999998,
782
+ y: 0.26458099999999973
783
+ }
784
+ ],
785
+ color: "primary",
786
+ fill: false
787
+ },
788
+ path218: {
789
+ type: "path",
790
+ points: [
791
+ {
792
+ x: -0.21166664999999885,
793
+ y: 0.264581999999999
794
+ },
795
+ {
796
+ x: -0.21166664999999885,
797
+ y: -0.26458399999999926
798
+ }
799
+ ],
800
+ color: "primary",
801
+ fill: false
802
+ },
803
+ path219: {
804
+ type: "path",
805
+ points: [
806
+ {
807
+ x: -0.5291666499999996,
808
+ y: 0.26458099999999973
809
+ },
810
+ {
811
+ x: -0.21166664999999885,
812
+ y: 0.264583
813
+ }
814
+ ],
815
+ color: "primary",
816
+ fill: false
817
+ },
818
+ path220: {
819
+ type: "path",
820
+ points: [
821
+ {
822
+ x: -0.13229164999999998,
823
+ y: 0.18520600000000087
824
+ },
825
+ {
826
+ x: 0.13229175000000026,
827
+ y: 0.18520600000000087
828
+ }
829
+ ],
830
+ color: "primary",
831
+ fill: false
832
+ },
833
+ path221: {
834
+ type: "path",
835
+ points: [
836
+ {
837
+ x: -0.13229164999999998,
838
+ y: -0.18520999999999965
839
+ },
840
+ {
841
+ x: 0.13229175000000026,
842
+ y: -0.18520999999999965
843
+ }
844
+ ],
845
+ color: "primary",
846
+ fill: false
847
+ },
848
+ path222: {
849
+ type: "path",
850
+ points: [
851
+ {
852
+ x: -0.05291665000000023,
853
+ y: -9999999992515995e-22
854
+ },
855
+ {
856
+ x: 0.13229165000000087,
857
+ y: -9999999992515995e-22
858
+ }
859
+ ],
860
+ color: "primary",
861
+ fill: false
862
+ }
863
+ },
864
+ texts: {
865
+ right1: {
866
+ type: "text",
867
+ text: "{REF}",
868
+ x: 0.5827374500000007,
869
+ y: -0.20929270999999972
870
+ },
871
+ right2: {
872
+ type: "text",
873
+ text: "{VAL}",
874
+ x: 0.58412285,
875
+ y: -0.021192649999999702
876
+ }
877
+ },
878
+ refblocks: {
879
+ top1: {
880
+ x: 0.13275345000000005,
881
+ y: -0.5440228900000008
882
+ },
883
+ bottom1: {
884
+ x: 0.13239525000000096,
885
+ y: 0.54252477
886
+ },
887
+ left1: {
888
+ x: -0.5308188500000002,
889
+ y: 0.26564980000000027
890
+ }
891
+ },
892
+ bounds: {
893
+ minX: -0.5291666499999996,
894
+ maxX: 0.5291666500000005,
895
+ minY: -0.529166,
896
+ maxY: 0.529166,
897
+ width: 1.0583333000000001,
898
+ height: 1.058332,
899
+ centerX: 4440892098500626e-31,
900
+ centerY: 0
901
+ }
902
+ };
903
+
904
+ // symbols/mosfet_depletion_normally_on_horz.ts
905
+ var { paths: paths4, texts: texts4, bounds: bounds4, refblocks: refblocks4 } = mosfet_depletion_normally_on_default;
906
+ var mosfet_depletion_normally_on_horz_default = defineSymbol({
907
+ primitives: [
908
+ ...Object.values(paths4),
909
+ { ...texts4.right1, anchor: "middle_left" },
910
+ { ...texts4.right2, anchor: "middle_left" }
911
+ ],
912
+ ports: [
913
+ { ...refblocks4.top1, labels: ["1"] },
914
+ // TODO add more "standard" labels
915
+ { ...refblocks4.bottom1, labels: ["2"] },
916
+ // TODO add more "standard" labels
917
+ { ...refblocks4.left1, labels: ["3"] }
918
+ // TODO add more "standard" labels
919
+ ],
920
+ size: { width: bounds4.width + 0.4, height: bounds4.height },
921
+ center: { x: bounds4.centerX + 0.2, y: bounds4.centerY }
922
+ });
923
+
924
+ // symbols/mosfet_depletion_normally_on_vert.ts
925
+ var rotated = rotateSymbol(mosfet_depletion_normally_on_horz_default);
926
+ var ref = rotated.primitives.find(
927
+ (p) => p.type === "text" && p.text === "{REF}"
928
+ );
929
+ var val = rotated.primitives.find(
930
+ (p) => p.type === "text" && p.text === "{VAL}"
931
+ );
932
+ ref.anchor = "middle_top";
933
+ val.anchor = "middle_top";
934
+ ref.x = val.x;
935
+ val.y += 0.15;
936
+ var mosfet_depletion_normally_on_vert_default = rotated;
937
+
938
+ // assets/symbols-svg-json/potentiometer.json
939
+ var potentiometer_default = {
940
+ paths: {
941
+ path11: {
942
+ type: "path",
943
+ points: [
944
+ {
945
+ x: -0.5291669499999998,
946
+ y: 0.1434596500000005
947
+ },
948
+ {
949
+ x: -0.26458365000000006,
950
+ y: 0.1434596500000005
951
+ }
952
+ ],
953
+ color: "primary",
954
+ fill: false
955
+ },
956
+ path12: {
957
+ type: "path",
958
+ points: [
959
+ {
960
+ x: 0.26458334999999966,
961
+ y: 0.1434596500000005
962
+ },
963
+ {
964
+ x: 0.52916695,
965
+ y: 0.1434596500000005
966
+ }
967
+ ],
968
+ color: "primary",
969
+ fill: false
970
+ },
971
+ path13: {
972
+ type: "path",
973
+ points: [
974
+ {
975
+ x: 12499999999526779e-22,
976
+ y: 0.011167849999999646
977
+ },
978
+ {
979
+ x: 0.26458424999999997,
980
+ y: 0.011167849999999646
981
+ },
982
+ {
983
+ x: 0.26458424999999997,
984
+ y: 0.2757512500000008
985
+ },
986
+ {
987
+ x: -0.26458274999999976,
988
+ y: 0.2757512500000008
989
+ },
990
+ {
991
+ x: -0.26458274999999976,
992
+ y: 0.011167849999999646
993
+ },
994
+ {
995
+ x: 12500000012849455e-22,
996
+ y: 0.011167849999999646
997
+ }
998
+ ],
999
+ color: "primary",
1000
+ fill: false
1001
+ },
1002
+ path15: {
1003
+ type: "path",
1004
+ points: [
1005
+ {
1006
+ x: 0.06517084999999989,
1007
+ y: -0.10588935
1008
+ },
1009
+ {
1010
+ x: -0.06529785000000032,
1011
+ y: -0.10588935
1012
+ },
1013
+ {
1014
+ x: -6345000000029799e-20,
1015
+ y: 0.00700125000000007
1016
+ },
1017
+ {
1018
+ x: 0.06517084999999989,
1019
+ y: -0.10588935
1020
+ }
1021
+ ],
1022
+ color: "primary",
1023
+ fill: true
1024
+ },
1025
+ path17: {
1026
+ type: "path",
1027
+ points: [
1028
+ {
1029
+ x: 25875000000041837e-20,
1030
+ y: -0.2757512500000008
1031
+ },
1032
+ {
1033
+ x: 25875000000041837e-20,
1034
+ y: -0.060545249999998774
1035
+ }
1036
+ ],
1037
+ color: "primary",
1038
+ fill: false
1039
+ }
1040
+ },
1041
+ texts: {
1042
+ bottom1: {
1043
+ type: "text",
1044
+ text: "{VAL}",
1045
+ x: -0.007583050000000924,
1046
+ y: 0.4315381500000015
1047
+ },
1048
+ right1: {
1049
+ type: "text",
1050
+ text: "{REF}",
1051
+ x: 0.12478014999999942,
1052
+ y: -0.09260654999999929
1053
+ }
1054
+ },
1055
+ refblocks: {
1056
+ left1: {
1057
+ x: -0.5449899500000002,
1058
+ y: 0.14431244999999926
1059
+ },
1060
+ right1: {
1061
+ x: 0.5378069499999998,
1062
+ y: 0.14331605000000103
1063
+ }
1064
+ },
1065
+ bounds: {
1066
+ minX: -0.5291669499999998,
1067
+ maxX: 0.52916695,
1068
+ minY: -0.2757512500000008,
1069
+ maxY: 0.2757512500000008,
1070
+ width: 1.0583338999999998,
1071
+ height: 0.5515025000000016,
1072
+ centerX: 11102230246251565e-32,
1073
+ centerY: 0
1074
+ }
1075
+ };
1076
+
1077
+ // symbols/potentiometer_horz.ts
1078
+ var { paths: paths5, texts: texts5, bounds: bounds5, refblocks: refblocks5 } = potentiometer_default;
1079
+ var potentiometer_horz_default = defineSymbol({
1080
+ primitives: [
1081
+ ...Object.values(paths5),
1082
+ { ...texts5.bottom1, y: 0.35, anchor: "middle_top" },
1083
+ { ...texts5.right1, anchor: "middle_left" }
1084
+ ],
1085
+ ports: [
1086
+ { ...refblocks5.left1, labels: ["1"] },
1087
+ // TODO add more "standard" labels
1088
+ { ...refblocks5.right1, labels: ["2"] }
1089
+ // TODO add more "standard" labels
1090
+ ],
1091
+ size: { width: bounds5.width + 0.05, height: bounds5.height },
1092
+ center: { x: bounds5.centerX, y: bounds5.centerY }
1093
+ });
1094
+
1095
+ // symbols/potentiometer_vert.ts
1096
+ var rotated2 = rotateSymbol(potentiometer_horz_default);
1097
+ var potentiometer_vert_default = rotated2;
1098
+
1099
+ // assets/symbols-svg-json/potentiometer2.json
1100
+ var potentiometer2_default = {
1101
+ paths: {
1102
+ path18: {
1103
+ type: "path",
1104
+ points: [
1105
+ {
1106
+ x: -0.5291669499999998,
1107
+ y: 8545000000008685e-19
1108
+ },
1109
+ {
1110
+ x: -0.26458365000000006,
1111
+ y: 8545000000008685e-19
1112
+ }
1113
+ ],
1114
+ color: "primary",
1115
+ fill: false
1116
+ },
1117
+ path19: {
1118
+ type: "path",
1119
+ points: [
1120
+ {
1121
+ x: 0.26458334999999966,
1122
+ y: 8545000000008685e-19
1123
+ },
1124
+ {
1125
+ x: 0.5291669499999996,
1126
+ y: 8545000000008685e-19
1127
+ }
1128
+ ],
1129
+ color: "primary",
1130
+ fill: false
1131
+ },
1132
+ path20: {
1133
+ type: "path",
1134
+ points: [
1135
+ {
1136
+ x: 12499999995085886e-22,
1137
+ y: -0.1314371999999988
1138
+ },
1139
+ {
1140
+ x: 0.26458424999999997,
1141
+ y: -0.1314371999999988
1142
+ },
1143
+ {
1144
+ x: 0.26458424999999997,
1145
+ y: 0.13314619999999877
1146
+ },
1147
+ {
1148
+ x: -0.26458274999999976,
1149
+ y: 0.13314619999999877
1150
+ },
1151
+ {
1152
+ x: -0.26458274999999976,
1153
+ y: -0.1314371999999988
1154
+ },
1155
+ {
1156
+ x: 12500000012849455e-22,
1157
+ y: -0.1314371999999988
1158
+ }
1159
+ ],
1160
+ color: "primary",
1161
+ fill: false
1162
+ },
1163
+ path23: {
1164
+ type: "path",
1165
+ points: [
1166
+ {
1167
+ x: 0.28137284999999945,
1168
+ y: 0.2822274
1169
+ },
1170
+ {
1171
+ x: 0.17906194999999903,
1172
+ y: 0.25486950000000164
1173
+ },
1174
+ {
1175
+ x: 0.2540149499999984,
1176
+ y: 0.1799165000000027
1177
+ },
1178
+ {
1179
+ x: 0.28137284999999945,
1180
+ y: 0.2822274
1181
+ }
1182
+ ],
1183
+ color: "primary",
1184
+ fill: true
1185
+ },
1186
+ path24: {
1187
+ type: "path",
1188
+ points: [
1189
+ {
1190
+ x: 0.29134274999999965,
1191
+ y: 0.2921307000000013
1192
+ },
1193
+ {
1194
+ x: 0.2577490499999997,
1195
+ y: 0.16634940000000142
1196
+ },
1197
+ {
1198
+ x: 0.16536614999999966,
1199
+ y: 0.25853690000000284
1200
+ },
1201
+ {
1202
+ x: 0.29134274999999965,
1203
+ y: 0.2921307000000013
1204
+ }
1205
+ ],
1206
+ color: "primary",
1207
+ fill: true
1208
+ },
1209
+ path26: {
1210
+ type: "path",
1211
+ points: [
1212
+ {
1213
+ x: -0.29551765000000074,
1214
+ y: -0.2921307000000013
1215
+ },
1216
+ {
1217
+ x: 0.23295514999999956,
1218
+ y: 0.2328032000000011
1219
+ }
1220
+ ],
1221
+ color: "primary",
1222
+ fill: false
1223
+ }
1224
+ },
1225
+ texts: {
1226
+ top1: {
1227
+ type: "text",
1228
+ text: "{REF}",
1229
+ x: 0.05811516999999933,
1230
+ y: -0.2009376800000009
1231
+ },
1232
+ bottom1: {
1233
+ type: "text",
1234
+ text: "{VAL}",
1235
+ x: -0.09712293000000072,
1236
+ y: 0.27857531999999985
1237
+ }
1238
+ },
1239
+ refblocks: {
1240
+ left1: {
1241
+ x: -0.5316179500000004,
1242
+ y: 0.0013439000000019519
1243
+ },
1244
+ right1: {
1245
+ x: 0.5377649500000006,
1246
+ y: 0.001956599999999753
1247
+ }
1248
+ },
1249
+ bounds: {
1250
+ minX: -0.5291669499999998,
1251
+ maxX: 0.5291669499999996,
1252
+ minY: -0.2921307000000013,
1253
+ maxY: 0.2921307000000013,
1254
+ width: 1.0583338999999994,
1255
+ height: 0.5842614000000026,
1256
+ centerX: -11102230246251565e-32,
1257
+ centerY: 0
1258
+ }
1259
+ };
1260
+
1261
+ // symbols/potentiometer2_horz.ts
1262
+ var { paths: paths6, texts: texts6, bounds: bounds6, refblocks: refblocks6 } = potentiometer2_default;
1263
+ var potentiometer2_horz_default = defineSymbol({
1264
+ primitives: [...Object.values(paths6), ...Object.values(texts6)],
1265
+ ports: [
1266
+ { ...refblocks6.left1, labels: ["1"] },
1267
+ // TODO add more "standard" labels
1268
+ { ...refblocks6.right1, labels: ["2"] }
1269
+ // TODO add more "standard" labels
1270
+ ],
1271
+ size: { width: bounds6.width, height: bounds6.height },
1272
+ center: { x: bounds6.centerX, y: bounds6.centerY }
1273
+ });
1274
+
1275
+ // symbols/potentiometer2_vert.ts
1276
+ var potentiometer2_vert_default = rotateSymbol(potentiometer2_horz_default);
1277
+
1278
+ // assets/symbols-svg-json/varistor.json
1279
+ var varistor_default = {
1280
+ paths: {
1281
+ path5: {
1282
+ type: "path",
1283
+ points: [
1284
+ {
1285
+ x: -0.5291668,
1286
+ y: 0
1287
+ },
1288
+ {
1289
+ x: -0.2645835000000005,
1290
+ y: 0
1291
+ }
1292
+ ],
1293
+ color: "primary",
1294
+ fill: false
1295
+ },
1296
+ path6: {
1297
+ type: "path",
1298
+ points: [
1299
+ {
1300
+ x: 0.2645835000000005,
1301
+ y: 0
1302
+ },
1303
+ {
1304
+ x: 0.5291668,
1305
+ y: 0
1306
+ }
1307
+ ],
1308
+ color: "primary",
1309
+ fill: false
1310
+ },
1311
+ path7: {
1312
+ type: "path",
1313
+ points: [
1314
+ {
1315
+ x: 0.2645835000000005,
1316
+ y: 0.23812500000000192
1317
+ },
1318
+ {
1319
+ x: -0.2645834999999992,
1320
+ y: -0.23812500000000014
1321
+ }
1322
+ ],
1323
+ color: "primary",
1324
+ fill: false
1325
+ },
1326
+ path8: {
1327
+ type: "path",
1328
+ points: [
1329
+ {
1330
+ x: 0.3704165000000006,
1331
+ y: 0.23812500000000192
1332
+ },
1333
+ {
1334
+ x: 0.2645835000000005,
1335
+ y: 0.23812500000000192
1336
+ }
1337
+ ],
1338
+ color: "primary",
1339
+ fill: false
1340
+ },
1341
+ path9: {
1342
+ type: "path",
1343
+ points: [
1344
+ {
1345
+ x: 1400000000817414e-21,
1346
+ y: -0.13229179999999907
1347
+ },
1348
+ {
1349
+ x: 0.2645844000000013,
1350
+ y: -0.13229179999999907
1351
+ },
1352
+ {
1353
+ x: 0.2645844000000013,
1354
+ y: 0.13229160000000206
1355
+ },
1356
+ {
1357
+ x: -0.26458259999999845,
1358
+ y: 0.13229160000000206
1359
+ },
1360
+ {
1361
+ x: -0.26458259999999845,
1362
+ y: -0.13229179999999907
1363
+ },
1364
+ {
1365
+ x: 14000000021496817e-22,
1366
+ y: -0.13229179999999907
1367
+ }
1368
+ ],
1369
+ color: "primary",
1370
+ fill: false
1371
+ }
1372
+ },
1373
+ texts: {
1374
+ top1: {
1375
+ type: "text",
1376
+ text: "{REF}",
1377
+ x: -0.06307419999999953,
1378
+ y: -0.2470063999999983
1379
+ },
1380
+ bottom1: {
1381
+ type: "text",
1382
+ text: "{VAL}",
1383
+ x: 0.0039234000000010205,
1384
+ y: 0.256324600000001
1385
+ }
1386
+ },
1387
+ refblocks: {
1388
+ left1: {
1389
+ x: -0.5438152999999999,
1390
+ y: 0.0016897000000017925
1391
+ },
1392
+ right1: {
1393
+ x: 0.5346478000000006,
1394
+ y: -6806999999984242e-19
1395
+ }
1396
+ },
1397
+ bounds: {
1398
+ minX: -0.5291668,
1399
+ maxX: 0.5291668,
1400
+ minY: -0.23812500000000014,
1401
+ maxY: 0.23812500000000192,
1402
+ width: 1.0583336,
1403
+ height: 0.47625000000000206,
1404
+ centerX: 0,
1405
+ centerY: 8881784197001252e-31
1406
+ }
1407
+ };
1408
+
1409
+ // symbols/varistor_horz.ts
1410
+ var { paths: paths7, texts: texts7, bounds: bounds7, refblocks: refblocks7 } = varistor_default;
1411
+ var varistor_horz_default = defineSymbol({
1412
+ primitives: [
1413
+ ...Object.values(paths7),
1414
+ { ...texts7.top1, anchor: "middle_left" },
1415
+ { ...texts7.bottom1, anchor: "middle_right" }
1416
+ ],
1417
+ ports: [
1418
+ {
1419
+ ...refblocks7.left1,
1420
+ labels: ["1", "-"]
1421
+ },
1422
+ {
1423
+ ...refblocks7.right1,
1424
+ labels: ["2", "+"]
1425
+ }
1426
+ ],
1427
+ size: { width: bounds7.width, height: bounds7.height },
1428
+ //{ width: 1, height: 0.24 },
1429
+ center: { x: bounds7.centerX, y: bounds7.centerY }
1430
+ });
1431
+
1432
+ // symbols/varistor_vert.ts
1433
+ var varistor_vert_default = rotateSymbol(varistor_horz_default, {});
1434
+
1435
+ // generated/symbols-index.ts
1436
+ var symbols_index_default = {
1437
+ "boxresistor_horz": boxresistor_horz_default,
1438
+ "boxresistor_vert": boxresistor_vert_default,
1439
+ "diode_horz": diode_horz_default,
1440
+ "diode_vert": diode_vert_default,
1441
+ "fuse_horz": fuse_horz_default,
1442
+ "fuse_vert": fuse_vert_default,
1443
+ "led_horz": led_horz_default,
1444
+ "led_vert": led_vert_default,
1445
+ "mosfet_depletion_normally_on_horz": mosfet_depletion_normally_on_horz_default,
1446
+ "mosfet_depletion_normally_on_vert": mosfet_depletion_normally_on_vert_default,
1447
+ "potentiometer_horz": potentiometer_horz_default,
1448
+ "potentiometer_vert": potentiometer_vert_default,
1449
+ "potentiometer2_horz": potentiometer2_horz_default,
1450
+ "potentiometer2_vert": potentiometer2_vert_default,
1451
+ "varistor_horz": varistor_horz_default,
1452
+ "varistor_vert": varistor_vert_default
1453
+ };
1454
+
1455
+ // drawing/svgPathToPoints.ts
1456
+ import { parseSVG, makeAbsolute } from "svg-path-parser";
1457
+
1458
+ // drawing/pathToSvgD.ts
1459
+ function pathToSvgD(points, closed = false) {
1460
+ const pathCommands = points.map((point, index) => `${index === 0 ? "M" : "L"}${point.x},${point.y}`).join(" ");
1461
+ return closed ? `${pathCommands} Z` : pathCommands;
1462
+ }
1463
+
1464
+ // drawing/mapColor.ts
1465
+ var mapColor = (color) => {
1466
+ switch (color) {
1467
+ case "primary":
1468
+ return "black";
1469
+ case "secondary":
1470
+ return "gray";
1471
+ default:
1472
+ return color;
1473
+ }
1474
+ };
1475
+
1476
+ // drawing/getSvg.ts
1477
+ function createDiamondElement(center, size = 0.05) {
1478
+ const { x, y } = center;
1479
+ const halfSize = size / 2;
1480
+ return `<path d="M ${x} ${y - halfSize} L ${x + halfSize} ${y} L ${x} ${y + halfSize} L ${x - halfSize} ${y} Z" fill="green" />`;
1481
+ }
1482
+ function createTextElement(primitive) {
1483
+ const { x, y, text: text2, fontSize = 0.1, anchor } = primitive;
1484
+ let textAnchor;
1485
+ let dx = 0;
1486
+ let dy = 0;
1487
+ const capHeight = fontSize * 0.75;
1488
+ switch (anchor) {
1489
+ case "top_left":
1490
+ textAnchor = "start";
1491
+ dy = fontSize;
1492
+ break;
1493
+ case "top_right":
1494
+ textAnchor = "end";
1495
+ dy = fontSize;
1496
+ break;
1497
+ case "bottom_left":
1498
+ textAnchor = "start";
1499
+ break;
1500
+ case "bottom_right":
1501
+ textAnchor = "end";
1502
+ break;
1503
+ case "center":
1504
+ textAnchor = "middle";
1505
+ dy = fontSize / 2;
1506
+ break;
1507
+ case "middle_top":
1508
+ textAnchor = "middle";
1509
+ dy = capHeight;
1510
+ break;
1511
+ case "middle_bottom":
1512
+ textAnchor = "middle";
1513
+ break;
1514
+ case "middle_left":
1515
+ textAnchor = "start";
1516
+ dy = capHeight / 2;
1517
+ break;
1518
+ case "middle_right":
1519
+ textAnchor = "end";
1520
+ dy = capHeight / 2;
1521
+ break;
1522
+ }
1523
+ return {
1524
+ text: `<text x="${x}" y="${y}" dx="${dx}" dy="${dy}" text-anchor="${textAnchor}" style="font: ${fontSize ?? 0.1}px monospace; fill: ${mapColor("primary")}">${text2}</text>`,
1525
+ anchor: `<rect x="${x - 0.025 / 2}" y="${y - 0.025 / 2}" width="0.025" height="0.025" fill="blue" />`
1526
+ };
1527
+ }
1528
+ function createPortElement(port) {
1529
+ const { x, y, labels } = port;
1530
+ const rectSize = 0.05;
1531
+ const labelFontSize = 0.08;
1532
+ const label = labels[0] || "";
1533
+ return `
1534
+ <rect x="${x - rectSize / 2}" y="${y - rectSize / 2}" width="${rectSize}" height="${rectSize}" fill="red" />
1535
+ <text x="${x - labelFontSize / 2}" y="${y + rectSize + labelFontSize / 2}" text-anchor="middle" style="font: ${labelFontSize}px monospace; fill: #833;">${label}</text>
1536
+ `;
1537
+ }
1538
+ function getInnerSvg(symbol, options = {}) {
1539
+ const { debug = false } = options;
1540
+ const { primitives, size, ports } = symbol;
1541
+ const svgElements = primitives.map((primitive) => {
1542
+ switch (primitive.type) {
1543
+ case "path":
1544
+ return `<path d="${pathToSvgD(primitive.points, primitive.closed)}" fill="${primitive.fill ? mapColor(primitive.color) : "none"}" stroke="${mapColor(primitive.color)}" stroke-width="0.02" stroke-linecap="round" stroke-linejoin="round" />`;
1545
+ case "text":
1546
+ const textElements = createTextElement(primitive);
1547
+ return textElements.text + (debug ? textElements.anchor : "");
1548
+ case "circle":
1549
+ return `<circle cx="${primitive.x}" cy="${primitive.y}" r="${primitive.radius}" fill="${mapColor("primary")}" />`;
1550
+ case "box":
1551
+ return `<rect x="${primitive.x}" y="${primitive.y}" width="${primitive.width}" height="${primitive.height}" fill="${mapColor("primary")}" />`;
1552
+ default:
1553
+ return "";
1554
+ }
1555
+ });
1556
+ const portElements = ports.map(createPortElement).join("\n ");
1557
+ const centerDiamond = createDiamondElement(symbol.center);
1558
+ return [svgElements.join("\n "), portElements, centerDiamond].join("\n");
1559
+ }
1560
+ function getSvg(symbol, options = {}) {
1561
+ const { size } = symbol;
1562
+ const innerSvg = getInnerSvg(symbol, options);
1563
+ const bufferMultiple = 1.1;
1564
+ const w = size.width * bufferMultiple;
1565
+ const h = size.height * bufferMultiple;
1566
+ const viewBox = {
1567
+ x: symbol.center.x - w / 2,
1568
+ y: symbol.center.y - h / 2,
1569
+ width: w,
1570
+ height: h
1571
+ };
1572
+ if (options.width && !options.height) {
1573
+ options.height = options.width * (viewBox.height / viewBox.width);
1574
+ } else if (!options.width && options.height) {
1575
+ options.width = options.height * (viewBox.width / viewBox.height);
1576
+ } else if (!options.width && !options.height) {
1577
+ options.width = viewBox.width;
1578
+ options.height = viewBox.height;
1579
+ }
1580
+ return `<svg width="${options.width}" height="${options.height}" viewBox="${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}" xmlns="http://www.w3.org/2000/svg">${innerSvg}</svg>`;
1581
+ }
1582
+
1583
+ // drawing/resizeSymbol.ts
1584
+ function resizeSymbol(symbol, newSize) {
1585
+ const { width: oldWidth, height: oldHeight } = symbol.size;
1586
+ let scaleX = 1, scaleY = 1;
1587
+ if (newSize.width && newSize.height) {
1588
+ scaleX = newSize.width / oldWidth;
1589
+ scaleY = newSize.height / oldHeight;
1590
+ } else if (newSize.width) {
1591
+ scaleX = scaleY = newSize.width / oldWidth;
1592
+ } else if (newSize.height) {
1593
+ scaleX = scaleY = newSize.height / oldHeight;
1594
+ }
1595
+ const resizedPrimitives = symbol.primitives.map((primitive) => {
1596
+ switch (primitive.type) {
1597
+ case "path":
1598
+ return {
1599
+ ...primitive,
1600
+ points: primitive.points.map((p) => ({
1601
+ x: p.x * scaleX,
1602
+ y: p.y * scaleY
1603
+ }))
1604
+ };
1605
+ case "text":
1606
+ case "circle":
1607
+ return {
1608
+ ...primitive,
1609
+ x: primitive.x * scaleX,
1610
+ y: primitive.y * scaleY
1611
+ };
1612
+ case "box":
1613
+ return {
1614
+ ...primitive,
1615
+ x: primitive.x * scaleX,
1616
+ y: primitive.y * scaleY,
1617
+ width: primitive.width * scaleX,
1618
+ height: primitive.height * scaleY
1619
+ };
1620
+ default:
1621
+ return primitive;
1622
+ }
1623
+ });
1624
+ return {
1625
+ ...symbol,
1626
+ primitives: resizedPrimitives,
1627
+ center: {
1628
+ x: symbol.center.x * scaleX,
1629
+ y: symbol.center.y * scaleY
1630
+ },
1631
+ ports: symbol.ports.map((port) => ({
1632
+ ...port,
1633
+ x: port.x * scaleX,
1634
+ y: port.y * scaleY
1635
+ })),
1636
+ size: {
1637
+ width: oldWidth * scaleX,
1638
+ height: oldHeight * scaleY
1639
+ }
1640
+ };
1641
+ }
1642
+
1643
+ // index.ts
1644
+ var BASE_SYMBOLS = Object.fromEntries(Object.keys(symbols_index_default).map((k) => [k, k]));
1645
+ export {
1646
+ BASE_SYMBOLS,
1647
+ getInnerSvg,
1648
+ getSvg,
1649
+ resizeSymbol,
1650
+ symbols_index_default as symbols
1651
+ };
1652
+ //# sourceMappingURL=index.js.map