schematex 0.6.6 → 0.6.8

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 (105) hide show
  1. package/README.md +115 -3
  2. package/README.zh-CN.md +783 -0
  3. package/dist/ai/ai-sdk.cjs +11 -11
  4. package/dist/ai/ai-sdk.d.cts +4 -4
  5. package/dist/ai/ai-sdk.d.ts +4 -4
  6. package/dist/ai/ai-sdk.js +6 -6
  7. package/dist/ai/index.cjs +17 -17
  8. package/dist/ai/index.d.cts +3 -3
  9. package/dist/ai/index.d.ts +3 -3
  10. package/dist/ai/index.js +6 -6
  11. package/dist/{api-QFMTlIi7.d.ts → api-DIJM_mqp.d.ts} +1 -1
  12. package/dist/{api-DA4-U-jn.d.cts → api-JaBtsUT8.d.cts} +1 -1
  13. package/dist/browser.cjs +12 -12
  14. package/dist/browser.d.cts +3 -3
  15. package/dist/browser.d.ts +3 -3
  16. package/dist/browser.js +6 -6
  17. package/dist/{chunk-KJZCRHNR.js → chunk-2TUZ3QJA.js} +623 -9
  18. package/dist/chunk-2TUZ3QJA.js.map +1 -0
  19. package/dist/{chunk-EUVUO3CL.cjs → chunk-34O3C6OC.cjs} +2 -2
  20. package/dist/{chunk-EUVUO3CL.cjs.map → chunk-34O3C6OC.cjs.map} +1 -1
  21. package/dist/{chunk-MLLARXOI.cjs → chunk-AGBY7KLL.cjs} +131 -27
  22. package/dist/chunk-AGBY7KLL.cjs.map +1 -0
  23. package/dist/{chunk-EPKIJEH7.js → chunk-C7V57V6O.js} +54 -8
  24. package/dist/chunk-C7V57V6O.js.map +1 -0
  25. package/dist/{chunk-CMZKAASF.cjs → chunk-EDXDFKYO.cjs} +16 -8
  26. package/dist/chunk-EDXDFKYO.cjs.map +1 -0
  27. package/dist/{chunk-FOPOOV2P.js → chunk-J2TT7PGI.js} +127 -23
  28. package/dist/chunk-J2TT7PGI.js.map +1 -0
  29. package/dist/{chunk-DO2DDHTQ.cjs → chunk-J3EPFZPX.cjs} +623 -8
  30. package/dist/chunk-J3EPFZPX.cjs.map +1 -0
  31. package/dist/{chunk-KCHUQXS3.js → chunk-JTGTWBAD.js} +2 -2
  32. package/dist/{chunk-KCHUQXS3.js.map → chunk-JTGTWBAD.js.map} +1 -1
  33. package/dist/{chunk-7DAIEDQP.js → chunk-MPCSWRZC.js} +75 -13
  34. package/dist/chunk-MPCSWRZC.js.map +1 -0
  35. package/dist/{chunk-3HZW6K5I.js → chunk-QZ2OBNAS.js} +14 -6
  36. package/dist/chunk-QZ2OBNAS.js.map +1 -0
  37. package/dist/{chunk-SUIDD2C5.cjs → chunk-SHMG7BVF.cjs} +54 -8
  38. package/dist/chunk-SHMG7BVF.cjs.map +1 -0
  39. package/dist/{chunk-XYHCAJMI.cjs → chunk-UHPGWO77.cjs} +75 -12
  40. package/dist/chunk-UHPGWO77.cjs.map +1 -0
  41. package/dist/{diagnostics-CSznf_sl.d.cts → diagnostics-BKRow1ur.d.cts} +14 -0
  42. package/dist/{diagnostics-CSznf_sl.d.ts → diagnostics-BKRow1ur.d.ts} +14 -0
  43. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  44. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  45. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  46. package/dist/diagrams/blockdiagram/index.js +1 -1
  47. package/dist/diagrams/circuit/index.cjs +11 -7
  48. package/dist/diagrams/circuit/index.d.cts +4 -2
  49. package/dist/diagrams/circuit/index.d.ts +4 -2
  50. package/dist/diagrams/circuit/index.js +1 -1
  51. package/dist/diagrams/ecomap/index.d.cts +1 -1
  52. package/dist/diagrams/ecomap/index.d.ts +1 -1
  53. package/dist/diagrams/entity/index.d.cts +1 -1
  54. package/dist/diagrams/entity/index.d.ts +1 -1
  55. package/dist/diagrams/fishbone/index.d.cts +1 -1
  56. package/dist/diagrams/fishbone/index.d.ts +1 -1
  57. package/dist/diagrams/flowchart/index.d.cts +2 -2
  58. package/dist/diagrams/flowchart/index.d.ts +2 -2
  59. package/dist/diagrams/genogram/index.d.cts +1 -1
  60. package/dist/diagrams/genogram/index.d.ts +1 -1
  61. package/dist/diagrams/ladder/index.d.cts +1 -1
  62. package/dist/diagrams/ladder/index.d.ts +1 -1
  63. package/dist/diagrams/logic/index.d.cts +1 -1
  64. package/dist/diagrams/logic/index.d.ts +1 -1
  65. package/dist/diagrams/orgchart/index.cjs +10 -6
  66. package/dist/diagrams/orgchart/index.d.cts +27 -2
  67. package/dist/diagrams/orgchart/index.d.ts +27 -2
  68. package/dist/diagrams/orgchart/index.js +1 -1
  69. package/dist/diagrams/pedigree/index.d.cts +1 -1
  70. package/dist/diagrams/pedigree/index.d.ts +1 -1
  71. package/dist/diagrams/phylo/index.d.cts +1 -1
  72. package/dist/diagrams/phylo/index.d.ts +1 -1
  73. package/dist/diagrams/sld/index.cjs +7 -7
  74. package/dist/diagrams/sld/index.d.cts +1 -1
  75. package/dist/diagrams/sld/index.d.ts +1 -1
  76. package/dist/diagrams/sld/index.js +1 -1
  77. package/dist/diagrams/sociogram/index.d.cts +1 -1
  78. package/dist/diagrams/sociogram/index.d.ts +1 -1
  79. package/dist/diagrams/timing/index.d.cts +1 -1
  80. package/dist/diagrams/timing/index.d.ts +1 -1
  81. package/dist/diagrams/venn/index.d.cts +1 -1
  82. package/dist/diagrams/venn/index.d.ts +1 -1
  83. package/dist/{index-CDpYuU7l.d.cts → index-DU2h1Y-a.d.cts} +1 -1
  84. package/dist/{index-jTwjudTW.d.ts → index-Dq3Mfxay.d.ts} +1 -1
  85. package/dist/index.cjs +35 -35
  86. package/dist/index.d.cts +4 -4
  87. package/dist/index.d.ts +4 -4
  88. package/dist/index.js +8 -8
  89. package/dist/react.cjs +6 -6
  90. package/dist/react.d.cts +2 -2
  91. package/dist/react.d.ts +2 -2
  92. package/dist/react.js +5 -5
  93. package/dist/{tools-CbuSbW6B.d.cts → tools-A0HRZ8jj.d.ts} +11 -2
  94. package/dist/{tools-D344vOzR.d.ts → tools-OzOQnlnV.d.cts} +11 -2
  95. package/package.json +2 -2
  96. package/dist/chunk-3HZW6K5I.js.map +0 -1
  97. package/dist/chunk-7DAIEDQP.js.map +0 -1
  98. package/dist/chunk-CMZKAASF.cjs.map +0 -1
  99. package/dist/chunk-DO2DDHTQ.cjs.map +0 -1
  100. package/dist/chunk-EPKIJEH7.js.map +0 -1
  101. package/dist/chunk-FOPOOV2P.js.map +0 -1
  102. package/dist/chunk-KJZCRHNR.js.map +0 -1
  103. package/dist/chunk-MLLARXOI.cjs.map +0 -1
  104. package/dist/chunk-SUIDD2C5.cjs.map +0 -1
  105. package/dist/chunk-XYHCAJMI.cjs.map +0 -1
@@ -851,6 +851,461 @@ var disconnect_switch = {
851
851
  lineWire(38, 0, 48, 0)
852
852
  ].join("")
853
853
  };
854
+ var varistor = {
855
+ length: 40,
856
+ anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
857
+ svg: () => [
858
+ lineWire(0, 0, 6, 0),
859
+ `<rect x="6" y="-8" width="28" height="16" fill="white" ${BODY}/>`,
860
+ // voltage-dependence diagonal through the body
861
+ `<line x1="9" y1="9" x2="31" y2="-9" ${BODY}/>`,
862
+ `<text x="12" y="-1" class="schematex-circuit-pol">U</text>`,
863
+ lineWire(34, 0, 40, 0)
864
+ ].join("")
865
+ };
866
+ var fuse_slow = {
867
+ length: 30,
868
+ anchors: { start: { x: 0, y: 0 }, end: { x: 30, y: 0 } },
869
+ svg: () => [
870
+ lineWire(0, 0, 5, 0),
871
+ `<rect x="5" y="-5" width="20" height="10" rx="5" fill="none" ${BODY}/>`,
872
+ `<line x1="5" y1="0" x2="25" y2="0" ${BODY}/>`,
873
+ `<text x="11" y="-8" class="schematex-circuit-pol">T</text>`,
874
+ lineWire(25, 0, 30, 0)
875
+ ].join("")
876
+ };
877
+ var inductor_iron = {
878
+ length: 40,
879
+ anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
880
+ svg: () => [
881
+ `<path d="M 0,0 L 5,0 A 5,5 0 0 1 15,0 A 5,5 0 0 1 25,0 A 5,5 0 0 1 35,0 L 40,0" fill="none" ${BODY}/>`,
882
+ // iron core: two parallel lines above the humps
883
+ `<line x1="6" y1="-8" x2="34" y2="-8" ${BODY}/>`,
884
+ `<line x1="6" y1="-11" x2="34" y2="-11" ${BODY}/>`
885
+ ].join("")
886
+ };
887
+ var inductor_ferrite = {
888
+ length: 40,
889
+ anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
890
+ svg: () => [
891
+ `<path d="M 0,0 L 5,0 A 5,5 0 0 1 15,0 A 5,5 0 0 1 25,0 A 5,5 0 0 1 35,0 L 40,0" fill="none" ${BODY}/>`,
892
+ // ferrite core: one heavy line above the humps
893
+ `<line x1="6" y1="-9" x2="34" y2="-9" stroke-width="2.5" ${BODY}/>`
894
+ ].join("")
895
+ };
896
+ var ferrite_bead = {
897
+ length: 30,
898
+ anchors: { start: { x: 0, y: 0 }, end: { x: 30, y: 0 } },
899
+ svg: () => [
900
+ lineWire(0, 0, 7, 0),
901
+ `<rect x="7" y="-6" width="16" height="12" rx="2" ${FILL}/>`,
902
+ lineWire(23, 0, 30, 0)
903
+ ].join("")
904
+ };
905
+ var varactor = {
906
+ length: 32,
907
+ anchors: { start: { x: 0, y: 0 }, end: { x: 32, y: 0 } },
908
+ svg: () => [
909
+ lineWire(0, 0, 8, 0),
910
+ `<polygon points="8,-8 8,8 20,0" ${FILL}/>`,
911
+ // cathode bar + parallel capacitor plate (voltage-variable capacitance)
912
+ `<line x1="20" y1="-8" x2="20" y2="8" ${BODY}/>`,
913
+ `<line x1="24" y1="-8" x2="24" y2="8" ${BODY}/>`,
914
+ lineWire(24, 0, 32, 0)
915
+ ].join("")
916
+ };
917
+ var tvs_diode = {
918
+ length: 36,
919
+ anchors: { start: { x: 0, y: 0 }, end: { x: 36, y: 0 } },
920
+ svg: () => [
921
+ lineWire(0, 0, 6, 0),
922
+ // two triangles back-to-back onto a shared bar (bidirectional clamp)
923
+ `<polygon points="6,-8 6,8 16,0" ${FILL}/>`,
924
+ `<polygon points="30,-8 30,8 20,0" ${FILL}/>`,
925
+ `<line x1="18" y1="-9" x2="18" y2="9" ${BODY}/>`,
926
+ lineWire(30, 0, 36, 0)
927
+ ].join("")
928
+ };
929
+ var bridge_rectifier = {
930
+ length: 48,
931
+ netlistPins: ["ac1", "ac2", "dcp", "dcn"],
932
+ anchors: {
933
+ start: { x: 0, y: 0 },
934
+ end: { x: 48, y: 0 },
935
+ ac1: { x: 0, y: 0 },
936
+ // left corner
937
+ ac2: { x: 48, y: 0 },
938
+ // right corner
939
+ dcp: { x: 24, y: -24 },
940
+ // top corner (+)
941
+ dcn: { x: 24, y: 24 }
942
+ // bottom corner (−)
943
+ },
944
+ svg: () => [
945
+ `<polygon points="0,0 24,-24 48,0 24,24" fill="white" ${BODY}/>`,
946
+ // four diode triangles, all conducting toward DC+ (top)
947
+ `<polygon points="8,-10 15,-10 11,-3" ${FILL}/>`,
948
+ `<polygon points="33,-10 40,-10 36,-3" ${FILL}/>`,
949
+ `<polygon points="8,10 15,10 11,3" ${FILL}/>`,
950
+ `<polygon points="33,10 40,10 36,3" ${FILL}/>`,
951
+ `<text x="24" y="-10" text-anchor="middle" class="schematex-circuit-pol">+</text>`,
952
+ `<text x="24" y="20" text-anchor="middle" class="schematex-circuit-pol">\u2212</text>`
953
+ ].join("")
954
+ };
955
+ var darlington_npn = {
956
+ length: 40,
957
+ netlistPins: ["c", "b", "e"],
958
+ anchors: {
959
+ start: { x: 0, y: 0 },
960
+ end: { x: 40, y: -16 },
961
+ base: { x: 0, y: 0 },
962
+ collector: { x: 40, y: -16 },
963
+ emitter: { x: 40, y: 16 },
964
+ b: { x: 0, y: 0 },
965
+ c: { x: 40, y: -16 },
966
+ e: { x: 40, y: 16 }
967
+ },
968
+ svg: () => [
969
+ `<circle cx="20" cy="0" r="16" fill="white" ${BODY}/>`,
970
+ lineWire(0, 0, 10, 0),
971
+ `<line x1="10" y1="-9" x2="10" y2="9" ${BODY}/>`,
972
+ // shared base plate
973
+ // Q1: base → collector, base → Q2 base node
974
+ `<line x1="10" y1="-5" x2="26" y2="-11" ${BODY}/>`,
975
+ `<line x1="10" y1="4" x2="19" y2="7" ${BODY}/>`,
976
+ // Q2: emitter out (NPN arrow outward)
977
+ `<line x1="19" y1="7" x2="28" y2="11" ${BODY}/>`,
978
+ `<polygon points="28,11 21,9 23,15" ${FILL}/>`,
979
+ lineWire(26, -11, 40, -16),
980
+ lineWire(28, 11, 40, 16)
981
+ ].join("")
982
+ };
983
+ var darlington_pnp = {
984
+ length: 40,
985
+ netlistPins: ["c", "b", "e"],
986
+ anchors: {
987
+ start: { x: 0, y: 0 },
988
+ end: { x: 40, y: -16 },
989
+ base: { x: 0, y: 0 },
990
+ collector: { x: 40, y: -16 },
991
+ emitter: { x: 40, y: 16 },
992
+ b: { x: 0, y: 0 },
993
+ c: { x: 40, y: -16 },
994
+ e: { x: 40, y: 16 }
995
+ },
996
+ svg: () => [
997
+ `<circle cx="20" cy="0" r="16" fill="white" ${BODY}/>`,
998
+ lineWire(0, 0, 10, 0),
999
+ `<line x1="10" y1="-9" x2="10" y2="9" ${BODY}/>`,
1000
+ `<line x1="10" y1="-5" x2="26" y2="-11" ${BODY}/>`,
1001
+ `<line x1="10" y1="4" x2="19" y2="7" ${BODY}/>`,
1002
+ `<line x1="19" y1="7" x2="28" y2="11" ${BODY}/>`,
1003
+ // PNP arrow pointing inward (toward base node)
1004
+ `<polygon points="12,5 19,7 14,11" ${FILL}/>`,
1005
+ lineWire(26, -11, 40, -16),
1006
+ lineWire(28, 11, 40, 16)
1007
+ ].join("")
1008
+ };
1009
+ var nmos_depletion = {
1010
+ length: 40,
1011
+ netlistPins: ["d", "g", "s"],
1012
+ anchors: {
1013
+ start: { x: 0, y: 0 },
1014
+ end: { x: 40, y: -16 },
1015
+ gate: { x: 0, y: 0 },
1016
+ drain: { x: 40, y: -16 },
1017
+ source: { x: 40, y: 16 },
1018
+ g: { x: 0, y: 0 },
1019
+ d: { x: 40, y: -16 },
1020
+ s: { x: 40, y: 16 }
1021
+ },
1022
+ svg: () => [
1023
+ lineWire(0, 0, 14, 0),
1024
+ `<line x1="14" y1="-12" x2="14" y2="12" ${BODY}/>`,
1025
+ // gate plate
1026
+ // solid channel bar (depletion mode) vs the segmented enhancement bar
1027
+ `<line x1="18" y1="-10" x2="18" y2="10" ${BODY}/>`,
1028
+ `<line x1="18" y1="-8" x2="32" y2="-8" ${BODY}/>`,
1029
+ lineWire(32, -8, 40, -16),
1030
+ `<line x1="18" y1="8" x2="32" y2="8" ${BODY}/>`,
1031
+ lineWire(32, 8, 40, 16),
1032
+ `<polygon points="22,0 18,-4 18,4" ${FILL}/>`
1033
+ ].join("")
1034
+ };
1035
+ var igbt = {
1036
+ length: 40,
1037
+ netlistPins: ["c", "g", "e"],
1038
+ anchors: {
1039
+ start: { x: 0, y: 0 },
1040
+ end: { x: 40, y: -16 },
1041
+ gate: { x: 0, y: 0 },
1042
+ collector: { x: 40, y: -16 },
1043
+ emitter: { x: 40, y: 16 },
1044
+ g: { x: 0, y: 0 },
1045
+ c: { x: 40, y: -16 },
1046
+ e: { x: 40, y: 16 }
1047
+ },
1048
+ svg: () => [
1049
+ lineWire(0, 0, 10, 0),
1050
+ `<line x1="10" y1="-12" x2="10" y2="12" ${BODY}/>`,
1051
+ // insulated gate plate
1052
+ `<line x1="14" y1="-10" x2="14" y2="10" ${BODY}/>`,
1053
+ // channel
1054
+ `<line x1="14" y1="-8" x2="32" y2="-8" ${BODY}/>`,
1055
+ lineWire(32, -8, 40, -16),
1056
+ `<line x1="14" y1="8" x2="28" y2="8" ${BODY}/>`,
1057
+ // IGBT emitter arrow (BJT-like, pointing out)
1058
+ `<polygon points="28,8 22,5 23,11" ${FILL}/>`,
1059
+ lineWire(28, 8, 40, 16)
1060
+ ].join("")
1061
+ };
1062
+ var scr = {
1063
+ length: 36,
1064
+ netlistPins: ["a", "k", "g"],
1065
+ anchors: {
1066
+ start: { x: 0, y: 0 },
1067
+ end: { x: 36, y: 0 },
1068
+ a: { x: 0, y: 0 },
1069
+ k: { x: 36, y: 0 },
1070
+ g: { x: 30, y: 16 },
1071
+ gate: { x: 30, y: 16 }
1072
+ },
1073
+ svg: () => [
1074
+ lineWire(0, 0, 8, 0),
1075
+ `<polygon points="8,-8 8,8 22,0" ${FILL}/>`,
1076
+ `<line x1="22" y1="-8" x2="22" y2="8" ${BODY}/>`,
1077
+ lineWire(22, 0, 36, 0),
1078
+ // gate lead off the cathode side
1079
+ `<line x1="22" y1="4" x2="30" y2="12" ${BODY}/>`,
1080
+ lineWire(30, 12, 30, 16)
1081
+ ].join("")
1082
+ };
1083
+ var triac = {
1084
+ length: 40,
1085
+ netlistPins: ["mt1", "mt2", "g"],
1086
+ anchors: {
1087
+ start: { x: 0, y: 0 },
1088
+ end: { x: 40, y: 0 },
1089
+ mt1: { x: 0, y: 0 },
1090
+ mt2: { x: 40, y: 0 },
1091
+ g: { x: 6, y: 16 },
1092
+ gate: { x: 6, y: 16 }
1093
+ },
1094
+ svg: () => [
1095
+ lineWire(0, 0, 8, 0),
1096
+ // two triangles back-to-back, offset vertically (bidirectional)
1097
+ `<polygon points="8,-9 8,3 22,-3" ${FILL}/>`,
1098
+ `<polygon points="32,-3 32,9 18,3" ${FILL}/>`,
1099
+ `<line x1="8" y1="-9" x2="8" y2="3" ${BODY}/>`,
1100
+ `<line x1="32" y1="-3" x2="32" y2="9" ${BODY}/>`,
1101
+ lineWire(32, 0, 40, 0),
1102
+ // gate lead
1103
+ `<line x1="10" y1="6" x2="6" y2="12" ${BODY}/>`,
1104
+ lineWire(6, 12, 6, 16)
1105
+ ].join("")
1106
+ };
1107
+ var diac = {
1108
+ length: 36,
1109
+ anchors: { start: { x: 0, y: 0 }, end: { x: 36, y: 0 } },
1110
+ svg: () => [
1111
+ lineWire(0, 0, 6, 0),
1112
+ // two triangles back-to-back, no gate (bidirectional trigger)
1113
+ `<polygon points="6,-9 6,3 20,-3" ${FILL}/>`,
1114
+ `<polygon points="30,-3 30,9 16,3" ${FILL}/>`,
1115
+ `<line x1="6" y1="-9" x2="6" y2="3" ${BODY}/>`,
1116
+ `<line x1="30" y1="-3" x2="30" y2="9" ${BODY}/>`,
1117
+ lineWire(30, 0, 36, 0)
1118
+ ].join("")
1119
+ };
1120
+ var phototransistor = {
1121
+ length: 40,
1122
+ netlistPins: ["c", "b", "e"],
1123
+ anchors: {
1124
+ start: { x: 0, y: 0 },
1125
+ end: { x: 40, y: -16 },
1126
+ base: { x: 0, y: 0 },
1127
+ collector: { x: 40, y: -16 },
1128
+ emitter: { x: 40, y: 16 },
1129
+ b: { x: 0, y: 0 },
1130
+ c: { x: 40, y: -16 },
1131
+ e: { x: 40, y: 16 }
1132
+ },
1133
+ svg: () => [
1134
+ `<circle cx="20" cy="0" r="16" fill="white" ${BODY}/>`,
1135
+ `<line x1="14" y1="-10" x2="14" y2="10" ${BODY}/>`,
1136
+ lineWire(0, 0, 14, 0),
1137
+ `<line x1="14" y1="-6" x2="30" y2="-12" ${BODY}/>`,
1138
+ lineWire(30, -12, 40, -16),
1139
+ `<line x1="14" y1="6" x2="30" y2="12" ${BODY}/>`,
1140
+ lineWire(30, 12, 40, 16),
1141
+ `<polygon points="30,12 24,10 26,16" ${FILL}/>`,
1142
+ // inward light arrows striking the base
1143
+ `<path d="M 2,-20 L 9,-13 M 9,-15 L 9,-13 L 7,-13" fill="none" ${BODY}/>`,
1144
+ `<path d="M 7,-22 L 14,-15 M 14,-17 L 14,-15 L 12,-15" fill="none" ${BODY}/>`
1145
+ ].join("")
1146
+ };
1147
+ var optocoupler = {
1148
+ length: 56,
1149
+ netlistPins: ["a", "k", "c", "e"],
1150
+ anchors: {
1151
+ start: { x: 0, y: 0 },
1152
+ end: { x: 56, y: 0 },
1153
+ a: { x: 0, y: -12 },
1154
+ k: { x: 0, y: 12 },
1155
+ c: { x: 56, y: -12 },
1156
+ e: { x: 56, y: 12 }
1157
+ },
1158
+ svg: () => [
1159
+ `<rect x="10" y="-22" width="36" height="44" fill="none" class="schematex-circuit-body" stroke-dasharray="4,3"/>`,
1160
+ // LED (left): anode top, cathode bottom — drawn pointing down
1161
+ lineWire(0, -12, 16, -12),
1162
+ lineWire(0, 12, 16, 12),
1163
+ `<polygon points="16,-6 24,-6 20,2" ${FILL}/>`,
1164
+ `<line x1="16" y1="2" x2="24" y2="2" ${BODY}/>`,
1165
+ // isolation light arrows
1166
+ `<path d="M 26,-4 L 32,-4 M 30,-6 L 32,-4 L 30,-2" fill="none" ${BODY}/>`,
1167
+ `<path d="M 26,2 L 32,2 M 30,0 L 32,2 L 30,4" fill="none" ${BODY}/>`,
1168
+ // phototransistor (right)
1169
+ `<line x1="36" y1="-8" x2="36" y2="8" ${BODY}/>`,
1170
+ `<line x1="36" y1="-4" x2="46" y2="-12" ${BODY}/>`,
1171
+ lineWire(46, -12, 56, -12),
1172
+ `<line x1="36" y1="4" x2="46" y2="12" ${BODY}/>`,
1173
+ lineWire(46, 12, 56, 12),
1174
+ `<polygon points="46,12 40,10 42,16" ${FILL}/>`
1175
+ ].join("")
1176
+ };
1177
+ var schmitt_buffer = {
1178
+ length: 44,
1179
+ netlistPins: ["in", "out"],
1180
+ anchors: {
1181
+ start: { x: 0, y: 0 },
1182
+ end: { x: 44, y: 0 },
1183
+ in: { x: 0, y: 0 },
1184
+ out: { x: 44, y: 0 }
1185
+ },
1186
+ svg: () => [
1187
+ lineWire(0, 0, 6, 0),
1188
+ `<polygon points="6,-14 6,14 38,0" fill="white" ${BODY}/>`,
1189
+ // hysteresis glyph inside
1190
+ `<path d="M 12,4 L 18,4 L 18,-4 L 24,-4 M 14,-2 L 20,-2 L 20,6 L 26,6" fill="none" ${BODY}/>`,
1191
+ lineWire(38, 0, 44, 0)
1192
+ ].join("")
1193
+ };
1194
+ var tri_state_buffer = {
1195
+ length: 44,
1196
+ netlistPins: ["in", "out", "en"],
1197
+ anchors: {
1198
+ start: { x: 0, y: 0 },
1199
+ end: { x: 44, y: 0 },
1200
+ in: { x: 0, y: 0 },
1201
+ out: { x: 44, y: 0 },
1202
+ en: { x: 19, y: -14 },
1203
+ enable: { x: 19, y: -14 }
1204
+ },
1205
+ svg: () => [
1206
+ lineWire(0, 0, 6, 0),
1207
+ `<polygon points="6,-14 6,14 38,0" fill="white" ${BODY}/>`,
1208
+ // enable pin on top
1209
+ `<line x1="19" y1="-7" x2="19" y2="-14" ${BODY}/>`,
1210
+ lineWire(38, 0, 44, 0)
1211
+ ].join("")
1212
+ };
1213
+ var instrumentation_amp = {
1214
+ length: 50,
1215
+ netlistPins: ["inp", "inn", "out"],
1216
+ anchors: {
1217
+ start: { x: 0, y: 0 },
1218
+ end: { x: 50, y: 0 },
1219
+ inp: { x: 0, y: -12 },
1220
+ inn: { x: 0, y: 12 },
1221
+ out: { x: 50, y: 0 }
1222
+ },
1223
+ svg: () => [
1224
+ lineWire(0, -12, 4, -12),
1225
+ lineWire(0, 12, 4, 12),
1226
+ `<polygon points="4,-22 4,22 50,0" fill="white" ${BODY}/>`,
1227
+ // double left edge marks the instrumentation (3-opamp) block
1228
+ `<line x1="8" y1="-20" x2="8" y2="20" ${BODY}/>`,
1229
+ `<text x="6" y="-7" class="schematex-circuit-pol">+</text>`,
1230
+ `<text x="6" y="15" class="schematex-circuit-pol">\u2212</text>`,
1231
+ `<text x="18" y="4" class="schematex-circuit-pol">INA</text>`
1232
+ ].join("")
1233
+ };
1234
+ var dc_dc_converter = {
1235
+ length: 50,
1236
+ netlistPins: ["vin", "gin", "vout", "gout"],
1237
+ anchors: {
1238
+ start: { x: 0, y: 0 },
1239
+ end: { x: 50, y: 0 },
1240
+ vin: { x: 0, y: -12 },
1241
+ gin: { x: 0, y: 12 },
1242
+ vout: { x: 50, y: -12 },
1243
+ gout: { x: 50, y: 12 }
1244
+ },
1245
+ svg: () => [
1246
+ lineWire(0, -12, 8, -12),
1247
+ lineWire(0, 12, 8, 12),
1248
+ `<rect x="8" y="-20" width="34" height="40" fill="white" ${BODY}/>`,
1249
+ `<line x1="14" y1="14" x2="36" y2="-14" ${BODY}/>`,
1250
+ `<text x="12" y="-8" class="schematex-circuit-pol">DC</text>`,
1251
+ `<text x="24" y="17" class="schematex-circuit-pol">DC</text>`,
1252
+ lineWire(42, -12, 50, -12),
1253
+ lineWire(42, 12, 50, 12)
1254
+ ].join("")
1255
+ };
1256
+ var switch_dpdt = {
1257
+ length: 52,
1258
+ netlistPins: ["p1", "nc1", "no1", "p2", "nc2", "no2"],
1259
+ anchors: {
1260
+ start: { x: 0, y: 0 },
1261
+ end: { x: 52, y: 0 },
1262
+ p1: { x: 0, y: -16 },
1263
+ nc1: { x: 52, y: -28 },
1264
+ no1: { x: 52, y: -8 },
1265
+ p2: { x: 0, y: 16 },
1266
+ nc2: { x: 52, y: 4 },
1267
+ no2: { x: 52, y: 24 }
1268
+ },
1269
+ svg: () => [
1270
+ // pole 1 (upper)
1271
+ lineWire(0, -16, 10, -16),
1272
+ `<circle cx="10" cy="-16" r="2" ${FILL}/>`,
1273
+ `<line x1="10" y1="-16" x2="40" y2="-26" ${BODY}/>`,
1274
+ `<circle cx="42" cy="-28" r="2" ${FILL}/>`,
1275
+ lineWire(42, -28, 52, -28),
1276
+ `<circle cx="42" cy="-8" r="2" ${FILL}/>`,
1277
+ lineWire(42, -8, 52, -8),
1278
+ // pole 2 (lower)
1279
+ lineWire(0, 16, 10, 16),
1280
+ `<circle cx="10" cy="16" r="2" ${FILL}/>`,
1281
+ `<line x1="10" y1="16" x2="40" y2="6" ${BODY}/>`,
1282
+ `<circle cx="42" cy="4" r="2" ${FILL}/>`,
1283
+ lineWire(42, 4, 52, 4),
1284
+ `<circle cx="42" cy="24" r="2" ${FILL}/>`,
1285
+ lineWire(42, 24, 52, 24),
1286
+ // ganged actuator (dashed link between the two arms)
1287
+ `<line x1="25" y1="-21" x2="25" y2="11" class="schematex-circuit-body" stroke-dasharray="3,3"/>`
1288
+ ].join("")
1289
+ };
1290
+ var oscilloscope = {
1291
+ length: 40,
1292
+ anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
1293
+ svg: () => [
1294
+ lineWire(0, 0, 8, 0),
1295
+ `<circle cx="20" cy="0" r="12" fill="white" ${BODY}/>`,
1296
+ // sine trace
1297
+ `<path d="M 12,2 Q 16,-9 20,0 Q 24,9 28,-2" fill="none" ${BODY}/>`,
1298
+ lineWire(32, 0, 40, 0)
1299
+ ].join("")
1300
+ };
1301
+ var port = {
1302
+ length: 16,
1303
+ anchors: { start: { x: 0, y: 0 }, end: { x: 16, y: 0 } },
1304
+ svg: () => [
1305
+ lineWire(0, 0, 6, 0),
1306
+ `<circle cx="11" cy="0" r="5" fill="white" ${BODY}/>`
1307
+ ].join("")
1308
+ };
854
1309
  var SYMBOLS = {
855
1310
  resistor,
856
1311
  capacitor,
@@ -913,7 +1368,32 @@ var SYMBOLS = {
913
1368
  contactor,
914
1369
  solenoid_valve,
915
1370
  thermal_overload,
916
- disconnect_switch
1371
+ disconnect_switch,
1372
+ // Previously-missing glyphs (v0.6.7) — passives / diodes / power semis / ICs
1373
+ varistor,
1374
+ fuse_slow,
1375
+ inductor_iron,
1376
+ inductor_ferrite,
1377
+ ferrite_bead,
1378
+ varactor,
1379
+ tvs_diode,
1380
+ bridge_rectifier,
1381
+ darlington_npn,
1382
+ darlington_pnp,
1383
+ nmos_depletion,
1384
+ igbt,
1385
+ scr,
1386
+ triac,
1387
+ diac,
1388
+ phototransistor,
1389
+ optocoupler,
1390
+ schmitt_buffer,
1391
+ tri_state_buffer,
1392
+ instrumentation_amp,
1393
+ dc_dc_converter,
1394
+ switch_dpdt,
1395
+ oscilloscope,
1396
+ port
917
1397
  // Lamp reuses buzzer slot? No, needs its own entry but our CircuitComponentType
918
1398
  // doesn't have "lamp". We map it via parser alias to "buzzer" or add specifically.
919
1399
  };
@@ -1028,6 +1508,7 @@ function parseNetlist(body, title2) {
1028
1508
  const netByName = /* @__PURE__ */ new Map();
1029
1509
  const pinMap = {};
1030
1510
  let autoGnd = 0;
1511
+ const underspecified = [];
1031
1512
  const ensureNet = (name) => {
1032
1513
  let n = netByName.get(name);
1033
1514
  if (!n) {
@@ -1119,10 +1600,11 @@ function parseNetlist(body, title2) {
1119
1600
  );
1120
1601
  }
1121
1602
  if (netRefs.length < pinOrder.length) {
1122
- throw new NetlistParseError(
1123
- `Component ${id} (${cType}) expects ${pinOrder.length} nets, got ${netRefs.length}`,
1124
- lineIdx + 1
1125
- );
1603
+ const got = netRefs.length;
1604
+ for (let k = got; k < pinOrder.length; k++) {
1605
+ netRefs.push(`${id}_nc${k + 1}`);
1606
+ }
1607
+ underspecified.push({ id, type: cType, expected: pinOrder.length, got });
1126
1608
  }
1127
1609
  const pins = {};
1128
1610
  for (let p = 0; p < pinOrder.length; p++) {
@@ -1168,7 +1650,7 @@ function parseNetlist(body, title2) {
1168
1650
  }
1169
1651
  }
1170
1652
  const nets = Array.from(netByName.values());
1171
- return {
1653
+ const ast = {
1172
1654
  type: "circuit",
1173
1655
  title: title2,
1174
1656
  components,
@@ -1176,6 +1658,8 @@ function parseNetlist(body, title2) {
1176
1658
  pinMap,
1177
1659
  mode: "netlist"
1178
1660
  };
1661
+ if (underspecified.length) ast.recovered = { underspecified };
1662
+ return ast;
1179
1663
  }
1180
1664
 
1181
1665
  // src/diagrams/circuit/parser.ts
@@ -1524,6 +2008,135 @@ function parseCircuit(text2) {
1524
2008
  };
1525
2009
  }
1526
2010
 
2011
+ // src/diagrams/circuit/lint.ts
2012
+ var INTENTIONAL_SINGLE_PIN = /* @__PURE__ */ new Set([
2013
+ "ground",
2014
+ "gnd_signal",
2015
+ "gnd_chassis",
2016
+ "gnd_digital",
2017
+ "vcc",
2018
+ "antenna",
2019
+ "no_connect",
2020
+ "test_point",
2021
+ "label",
2022
+ "port"
2023
+ ]);
2024
+ var SOURCE_TYPES = /* @__PURE__ */ new Set([
2025
+ "voltage_source",
2026
+ "ac_source",
2027
+ "battery",
2028
+ "current_source"
2029
+ ]);
2030
+ var GROUND_TYPES = /* @__PURE__ */ new Set([
2031
+ "ground",
2032
+ "gnd_signal",
2033
+ "gnd_chassis",
2034
+ "gnd_digital"
2035
+ ]);
2036
+ var NC_NET = /_nc\d+$/;
2037
+ function componentIdOfAnchor(anchor) {
2038
+ const dot = anchor.lastIndexOf(".");
2039
+ return dot < 0 ? anchor : anchor.slice(0, dot);
2040
+ }
2041
+ function editDistanceWithin(a, b, max) {
2042
+ if (Math.abs(a.length - b.length) > max) return false;
2043
+ const prev = new Array(b.length + 1);
2044
+ const curr = new Array(b.length + 1);
2045
+ for (let j = 0; j <= b.length; j++) prev[j] = j;
2046
+ for (let i = 1; i <= a.length; i++) {
2047
+ curr[0] = i;
2048
+ let rowMin = curr[0];
2049
+ for (let j = 1; j <= b.length; j++) {
2050
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
2051
+ curr[j] = Math.min(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost);
2052
+ if (curr[j] < rowMin) rowMin = curr[j];
2053
+ }
2054
+ if (rowMin > max) return false;
2055
+ for (let j = 0; j <= b.length; j++) prev[j] = curr[j];
2056
+ }
2057
+ return prev[b.length] <= max;
2058
+ }
2059
+ function lintCircuit(text2) {
2060
+ let ast;
2061
+ try {
2062
+ ast = parseCircuit(text2);
2063
+ } catch {
2064
+ return [];
2065
+ }
2066
+ const out = [];
2067
+ const idCounts = /* @__PURE__ */ new Map();
2068
+ for (const c of ast.components) {
2069
+ if (c.id.startsWith("_")) continue;
2070
+ idCounts.set(c.id, (idCounts.get(c.id) ?? 0) + 1);
2071
+ }
2072
+ for (const [id, n] of idCounts) {
2073
+ if (n > 1) {
2074
+ out.push({
2075
+ severity: "error",
2076
+ code: "CIRCUIT_DUPLICATE_ID",
2077
+ message: `component id "${id}" is declared ${n} times; each reference designator must be unique`,
2078
+ hint: `Rename the duplicates (e.g. ${id}, ${id}B). With a repeated id only the last line's connections are kept.`,
2079
+ fatal: false
2080
+ });
2081
+ }
2082
+ }
2083
+ for (const u of ast.recovered?.underspecified ?? []) {
2084
+ out.push({
2085
+ severity: "warning",
2086
+ code: "CIRCUIT_PIN_UNDERSPECIFIED",
2087
+ message: `component ${u.id} (${u.type}) needs ${u.expected} nets but got ${u.got}; the missing terminal(s) were left floating`,
2088
+ hint: `Give ${u.id} all ${u.expected} net connections (e.g. a transformer is \`${u.id} p1 p2 s1 s2 type=transformer\`). Unconnected pins are drawn but not wired.`,
2089
+ fatal: false
2090
+ });
2091
+ }
2092
+ if (ast.mode !== "netlist") return out;
2093
+ const compById = /* @__PURE__ */ new Map();
2094
+ for (const c of ast.components) compById.set(c.id, c);
2095
+ const hasGround = ast.nets.some((n) => n.id === "GND") || ast.components.some((c) => GROUND_TYPES.has(c.componentType));
2096
+ const sources = ast.components.filter((c) => SOURCE_TYPES.has(c.componentType));
2097
+ if (sources.length > 0 && !hasGround) {
2098
+ out.push({
2099
+ severity: "warning",
2100
+ code: "CIRCUIT_NO_GROUND",
2101
+ message: `circuit has ${sources.length} source(s) (e.g. ${sources[0].id}) but no ground reference; node voltages are undefined`,
2102
+ hint: `Tie a return node to ground \u2014 name a net \`0\`/\`GND\` (e.g. \`${sources[0].id} ${sources[0].id.toLowerCase()}_out 0\`) or add a ground symbol.`,
2103
+ fatal: false
2104
+ });
2105
+ }
2106
+ const wired = ast.nets.filter(
2107
+ (n) => n.anchors.length >= 2 && !NC_NET.test(n.id)
2108
+ );
2109
+ for (const net of ast.nets) {
2110
+ if (net.id === "GND") continue;
2111
+ if (NC_NET.test(net.id)) continue;
2112
+ if (net.anchors.length !== 1) continue;
2113
+ const comp = compById.get(componentIdOfAnchor(net.anchors[0]));
2114
+ if (comp && INTENTIONAL_SINGLE_PIN.has(comp.componentType)) continue;
2115
+ const lower = net.id.toLowerCase();
2116
+ const typoTarget = wired.find(
2117
+ (w) => w.id.toLowerCase() !== lower && Math.max(w.id.length, net.id.length) >= 3 && editDistanceWithin(lower, w.id.toLowerCase(), 1)
2118
+ );
2119
+ if (typoTarget) {
2120
+ out.push({
2121
+ severity: "warning",
2122
+ code: "CIRCUIT_NET_TYPO",
2123
+ message: `net "${net.id}" connects to only one pin and is one character from "${typoTarget.id}" \u2014 likely a misspelled connection`,
2124
+ hint: `If they are the same node, rename "${net.id}" to "${typoTarget.id}" so the pins join.`,
2125
+ fatal: false
2126
+ });
2127
+ } else {
2128
+ out.push({
2129
+ severity: "warning",
2130
+ code: "CIRCUIT_FLOATING_NET",
2131
+ message: `net "${net.id}" connects to only one pin (${net.anchors[0]}); nothing else joins this node`,
2132
+ hint: `Wire "${net.id}" to another pin, or mark the pin as intentionally open with a no-connect.`,
2133
+ fatal: false
2134
+ });
2135
+ }
2136
+ }
2137
+ return out;
2138
+ }
2139
+
1527
2140
  // src/diagrams/circuit/layout.ts
1528
2141
  function rotationDeg(d) {
1529
2142
  return d === "right" ? 0 : d === "down" ? 90 : d === "left" ? 180 : 270;
@@ -2070,6 +2683,7 @@ var circuit = {
2070
2683
  return first.startsWith("circuit");
2071
2684
  },
2072
2685
  parse: parseCircuit,
2686
+ lint: lintCircuit,
2073
2687
  render(text2, config) {
2074
2688
  const ast = parseCircuit(text2);
2075
2689
  return renderCircuit(ast, config);
@@ -2081,8 +2695,9 @@ exports.SYMBOLS = SYMBOLS;
2081
2695
  exports.circuit = circuit;
2082
2696
  exports.layoutCircuit = layoutCircuit;
2083
2697
  exports.layoutCircuitNetlist = layoutCircuitNetlist;
2698
+ exports.lintCircuit = lintCircuit;
2084
2699
  exports.parseCircuit = parseCircuit;
2085
2700
  exports.parseNetlist = parseNetlist;
2086
2701
  exports.renderCircuit = renderCircuit;
2087
- //# sourceMappingURL=chunk-DO2DDHTQ.cjs.map
2088
- //# sourceMappingURL=chunk-DO2DDHTQ.cjs.map
2702
+ //# sourceMappingURL=chunk-J3EPFZPX.cjs.map
2703
+ //# sourceMappingURL=chunk-J3EPFZPX.cjs.map