MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / _parseScrollModifiers

Function _parseScrollModifiers

www/js/_hyperscript-max.js:6249–6281  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

6247 }
6248 };
6249 function _parseScrollModifiers(parser) {
6250 parser.matchToken("the");
6251 var verticalPosition = parser.matchAnyToken("top", "middle", "bottom");
6252 var horizontalPosition = parser.matchAnyToken("left", "center", "right");
6253 if (verticalPosition || horizontalPosition) {
6254 parser.requireToken("of");
6255 }
6256 var target = parser.requireElement("unaryExpression");
6257 var plusOrMinus = parser.matchAnyOpToken("+", "-");
6258 var offset;
6259 if (plusOrMinus) {
6260 parser.pushFollow("px");
6261 try {
6262 offset = parser.requireElement("expression");
6263 } finally {
6264 parser.popFollow();
6265 }
6266 }
6267 parser.matchToken("px");
6268 var container;
6269 if (parser.matchToken("in")) {
6270 container = parser.requireElement("unaryExpression");
6271 }
6272 var smoothness = parser.matchAnyToken("smoothly", "instantly");
6273 var scrollOptions = { block: "start", inline: "nearest" };
6274 var blockMap = { top: "start", bottom: "end", middle: "center" };
6275 var inlineMap = { left: "start", center: "center", right: "end" };
6276 var behaviorMap = { smoothly: "smooth", instantly: "instant" };
6277 if (verticalPosition) scrollOptions.block = blockMap[verticalPosition.value];
6278 if (horizontalPosition) scrollOptions.inline = inlineMap[horizontalPosition.value];
6279 if (smoothness) scrollOptions.behavior = behaviorMap[smoothness.value];
6280 return { target, offset, plusOrMinus, scrollOptions, container };
6281 }
6282 function _parseSmoothness(parser) {
6283 var smoothness = parser.matchAnyToken("smoothly", "instantly");
6284 if (!smoothness) return void 0;

Callers 2

parseMethod · 0.70
parseMethod · 0.70

Calls 7

matchTokenMethod · 0.45
matchAnyTokenMethod · 0.45
requireTokenMethod · 0.45
requireElementMethod · 0.45
matchAnyOpTokenMethod · 0.45
pushFollowMethod · 0.45
popFollowMethod · 0.45

Tested by

no test coverage detected