From a7a589b785fc5b2c95c65edb98c353bce9021ff3 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 18 Dec 2017 12:17:42 +0300 Subject: [PATCH] csslint: CSS Grid Layout - actual implementation --- vendor-overwrites/csslint/csslint-worker.js | 75 ++++++++++++++------- 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/vendor-overwrites/csslint/csslint-worker.js b/vendor-overwrites/csslint/csslint-worker.js index bebc053a..314c4b03 100644 --- a/vendor-overwrites/csslint/csslint-worker.js +++ b/vendor-overwrites/csslint/csslint-worker.js @@ -2696,7 +2696,7 @@ Parser.prototype = function() { //see if there's a simple match } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, - Tokens.ANGLE, Tokens.TIME, + Tokens.ANGLE, Tokens.TIME, Tokens.DIMENSION, Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) { value = tokenStream.token().value; @@ -3519,7 +3519,7 @@ var Properties = module.exports = { "color-rendering" : "auto | optimizeSpeed | optimizeQuality", "column-count" : " | auto", //https://www.w3.org/TR/css3-multicol/ "column-fill" : "auto | balance", - "column-gap" : "normal | | ", + "column-gap" : "", "column-rule" : " || || ", "column-rule-color" : "", "column-rule-style" : "", @@ -3559,21 +3559,21 @@ var Properties = module.exports = { "filter" : " | none", "fit" : "fill | hidden | meet | slice", "fit-position" : 1, - "flex" : "", + "flex" : "", "flex-basis" : "", "flex-direction" : "row | row-reverse | column | column-reverse", "flex-flow" : " || ", "flex-grow" : "", "flex-shrink" : "", "flex-wrap" : "nowrap | wrap | wrap-reverse", - "-webkit-flex" : "", + "-webkit-flex" : "", "-webkit-flex-basis" : "", "-webkit-flex-direction" : "row | row-reverse | column | column-reverse", "-webkit-flex-flow" : " || ", "-webkit-flex-grow" : "", "-webkit-flex-shrink" : "", "-webkit-flex-wrap" : "nowrap | wrap | wrap-reverse", - "-ms-flex" : "", + "-ms-flex" : "", "-ms-flex-align" : "start | end | center | stretch | baseline", "-ms-flex-direction" : "row | row-reverse | column | column-reverse", "-ms-flex-order" : "", @@ -3601,36 +3601,28 @@ var Properties = module.exports = { "font-weight" : "", //G - "gap" : "[ | normal ]{1,2}", + "gap" : " ?", "glyph-orientation-horizontal" : "", "glyph-orientation-vertical" : "auto | ", "grid" : " | / [ auto-flow && dense? ] ? | [ auto-flow && dense? ] ? / ", "grid-area" : " [ / ]{0,3}", - "grid-auto-columns" : "+", + "grid-auto-columns" : "", "grid-auto-flow" : "[ row | column ] || dense", - "grid-auto-position" : 1, - "grid-auto-rows" : "+", - "grid-cell-stacking" : "columns | rows | layer", + "grid-auto-rows" : "", "grid-column" : " [ / ]?", - "grid-columns" : 1, - "grid-column-align" : "start | end | center | stretch", - "grid-column-sizing" : 1, "grid-column-start" : "", "grid-column-end" : "", - "grid-column-span" : "", - "grid-flow" : "none | rows | columns", - "grid-layer" : "", "grid-row" : " [ / ]?", - "grid-rows" : 1, - "grid-row-align" : "start | end | center | stretch", "grid-row-start" : "", "grid-row-end" : "", - "grid-row-span" : "", - "grid-row-sizing" : 1, "grid-template" : "none | [ / ] | [ ? ? ? ]+ [ / ]?", "grid-template-areas" : "none | +", - "grid-template-columns" : "none | | ", - "grid-template-rows" : "none | | ", + "grid-template-columns" : "", + "grid-template-rows" : "", + //G - deprecated aliases + "grid-row-gap" : "", + "grid-column-gap" : "", + "grid-gap" : " ?", //H "hanging-punctuation" : 1, @@ -3766,7 +3758,7 @@ var Properties = module.exports = { "right" : "", "rotation" : 1, "rotation-point" : 1, - "row-gap" : "normal | | ", + "row-gap" : "", "ruby-align" : 1, "ruby-overhang" : 1, "ruby-position" : 1, @@ -4140,6 +4132,7 @@ function PropertyValuePart(text, line, col, optionalHint) { case "vw": case "vmax": case "vmin": + case "fr": this.type = "length"; break; @@ -6191,6 +6184,10 @@ copy(ValidationTypes, { "drop-shadow() | grayscale() | hue-rotate() | invert() | " + "opacity() | saturate() | sepia()", + "": function(part) { + return part.type === "function" || part.type === "grid" && part.value >= 0; + }, + "": "", "": "row | row-reverse | column | column-reverse", @@ -6243,6 +6240,10 @@ copy(ValidationTypes, { return part.type === "identifier" || part.wasIdent; }, + "": function(part) { + return (part.type === "identifier" || part.wasIdent) && !/^span$/i.test(part.value); + }, + "": function(part) { return this[""](part) && !this[""](part); }, @@ -6283,6 +6284,10 @@ copy(ValidationTypes, { (String(part) === "0" || part.type === "function" || (part.value) >= 0); }, + "": function(part) { + return this[""](part) && (part.type === "function" || part.value > 0); + }, + "": function(part) { return part.type === "number" || this[""](part); }, @@ -6392,7 +6397,7 @@ copy(ValidationTypes, { "": "[ | ]+", // https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-property - "": + "": "none | [ ? || ]", "": "[ | ]#", @@ -6443,6 +6448,28 @@ copy(ValidationTypes, { "[ full-width | proportional-width ] || " + "ruby", + "": "+", + "": "+", + "": "none | [ / ] | [ ? ? ? ]+ [ / ]?", + "": "none | | ", + "": "", + "": "auto | | [ && ? ] | [ span && [ || ] ]", + "": "repeat( [ auto-fill | auto-fit ] , [ ? ]+ ? )", + "": "[ ? [ | ] ]* ? [ ? [ | ] ]* ?", + "": "[ ? ]+ ?", + "": "", + "": "repeat( [ ] , [ ? ]+ ? )", + "": " | minmax( , ) | minmax( , )", + "": " | min-content | max-content | auto", + "": " | ", + "": "[ * ]", + "": " | | min-content | max-content | auto", + "": "[ ? [ | ] ]+ ?", + "": "repeat( [ ] , [ ? ]+ ? )", + "": " | minmax( , ) | fit-content( )", + "": "normal | | ", + "": "", + "": "normal | | ? [ | left | right ]",