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