9494
9595 & :hover {
9696 background-color : var (--vp-code-bg );
97- transition : color 0.25s , background-color 0.5s ;
97+ transition :
98+ color 0.25s ,
99+ background-color 0.5s ;
98100 }
99101}
100102 </style >
@@ -109,7 +111,7 @@ type Parameter = {
109111 displayName: string ;
110112 description? : string ;
111113 meetsReqs: boolean ;
112- requires: Parameter [] ;
114+ requires: string ;
113115 onlyIf? : string [];
114116 link? : string ;
115117};
@@ -155,33 +157,35 @@ watch(
155157 .map ((x ) => " --" + x )
156158 .join (" " );
157159 },
158- { immediate: true }
160+ { immediate: true },
159161);
160162
161163type Requirements = [" and" | " or" , ... (Requirements | string )[]];
162- function evalReq(req : Requirements ) {
164+ function evalReq(req : Requirements ): boolean {
163165 if (req [0 ] == " and" ) {
164166 return req
165167 .slice (1 )
166168 .every ((req ) =>
167- typeof req == " string" ? selections .value .includes (req ) : evalReq (req )
169+ typeof req == " string" ? selections .value .includes (req ) : evalReq (req ),
168170 );
169171 } else if (req [0 ] == " or" ) {
170172 return req
171173 .slice (1 )
172174 .some ((req ) =>
173- typeof req == " string" ? selections .value .includes (req ) : evalReq (req )
175+ typeof req == " string" ? selections .value .includes (req ) : evalReq (req ),
174176 );
177+ } else {
178+ return false ;
175179 }
176180}
177- function displayReq(req : Requirements ) {
181+ function displayReq(req : Requirements ): string | null {
178182 if (req [0 ] == " and" ) {
179183 return req
180184 .slice (1 )
181185 .map ((req ) =>
182186 typeof req == " string"
183187 ? parameters .find ((p ) => p .key == req )?.displayName
184- : " (" + displayReq (req ) + " )"
188+ : " (" + displayReq (req ) + " )" ,
185189 )
186190 .join (" and " );
187191 } else if (req [0 ] == " or" ) {
@@ -190,9 +194,11 @@ function displayReq(req: Requirements) {
190194 .map ((req ) =>
191195 typeof req == " string"
192196 ? parameters .find ((p ) => p .key == req )?.displayName
193- : " (" + displayReq (req ) + " )"
197+ : " (" + displayReq (req ) + " )" ,
194198 )
195199 .join (" or " );
200+ } else {
201+ return null ;
196202 }
197203}
198204 </script >
0 commit comments