mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-10-06 19:30:09 +02:00
update packages to latest version
This commit is contained in:
128
node_modules/clean-css/lib/optimizer/configuration/break-up.js
generated
vendored
128
node_modules/clean-css/lib/optimizer/configuration/break-up.js
generated
vendored
@@ -20,13 +20,13 @@ function _anyIsInherit(values) {
|
||||
}
|
||||
|
||||
function _colorFilter(validator) {
|
||||
return function (value) {
|
||||
return function(value) {
|
||||
return value[1] == 'invert' || validator.isColor(value[1]) || validator.isPrefixed(value[1]);
|
||||
};
|
||||
}
|
||||
|
||||
function _styleFilter(validator) {
|
||||
return function (value) {
|
||||
return function(value) {
|
||||
return value[1] != 'inherit' && validator.isStyleKeyword(value[1]) && !validator.isColorFunction(value[1]);
|
||||
};
|
||||
}
|
||||
@@ -40,27 +40,26 @@ function _wrapDefault(name, property, configuration) {
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue[0]],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue[1]]
|
||||
]);
|
||||
} else if (descriptor.doubleValues && descriptor.defaultValue.length == 1) {
|
||||
} if (descriptor.doubleValues && descriptor.defaultValue.length == 1) {
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, name],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue[0]]
|
||||
]);
|
||||
} else {
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, name],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue]
|
||||
]);
|
||||
}
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, name],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue]
|
||||
]);
|
||||
}
|
||||
|
||||
function _widthFilter(validator) {
|
||||
return function (value) {
|
||||
return value[1] != 'inherit' &&
|
||||
(validator.isWidth(value[1]) || validator.isUnit(value[1]) || validator.isDynamicUnit(value[1])) &&
|
||||
!validator.isStyleKeyword(value[1]) &&
|
||||
!validator.isColorFunction(value[1]);
|
||||
return function(value) {
|
||||
return value[1] != 'inherit'
|
||||
&& (validator.isWidth(value[1]) || validator.isUnit(value[1]) || validator.isDynamicUnit(value[1]))
|
||||
&& !validator.isStyleKeyword(value[1])
|
||||
&& !validator.isColorFunction(value[1]);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -88,6 +87,7 @@ function animation(property, configuration, validator) {
|
||||
var l;
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
// eslint-disable-next-line max-len
|
||||
duration.value = timing.value = delay.value = iteration.value = direction.value = fill.value = play.value = name.value = property.value;
|
||||
return components;
|
||||
}
|
||||
@@ -108,7 +108,9 @@ function animation(property, configuration, validator) {
|
||||
} else if ((validator.isGlobal(value[1]) || validator.isTimingFunction(value[1])) && !timingSet) {
|
||||
timing.value = [value];
|
||||
timingSet = true;
|
||||
} else if ((validator.isAnimationIterationCountKeyword(value[1]) || validator.isPositiveNumber(value[1])) && !iterationSet) {
|
||||
} else if ((validator.isAnimationIterationCountKeyword(value[1])
|
||||
|| validator.isPositiveNumber(value[1]))
|
||||
&& !iterationSet) {
|
||||
iteration.value = [value];
|
||||
iterationSet = true;
|
||||
} else if (validator.isAnimationDirectionKeyword(value[1]) && !directionSet) {
|
||||
@@ -152,7 +154,7 @@ function background(property, configuration, validator) {
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
// NOTE: 'inherit' is not a valid value for background-attachment
|
||||
color.value = image.value = repeat.value = position.value = size.value = origin.value = clip.value = property.value;
|
||||
color.value = image.value = repeat.value = position.value = size.value = origin.value = clip.value = property.value;
|
||||
return components;
|
||||
}
|
||||
|
||||
@@ -183,7 +185,10 @@ function background(property, configuration, validator) {
|
||||
repeatSet = true;
|
||||
}
|
||||
anyValueSet = true;
|
||||
} else if (validator.isBackgroundPositionKeyword(value[1]) || validator.isBackgroundSizeKeyword(value[1]) || validator.isUnit(value[1]) || validator.isDynamicUnit(value[1])) {
|
||||
} else if (validator.isBackgroundPositionKeyword(value[1])
|
||||
|| validator.isBackgroundSizeKeyword(value[1])
|
||||
|| validator.isUnit(value[1])
|
||||
|| validator.isDynamicUnit(value[1])) {
|
||||
if (i > 0) {
|
||||
var previousValue = values[i - 1];
|
||||
|
||||
@@ -193,15 +198,13 @@ function background(property, configuration, validator) {
|
||||
size.value = [previousValue, value];
|
||||
i -= 2;
|
||||
} else {
|
||||
if (!positionSet)
|
||||
position.value = [];
|
||||
if (!positionSet) { position.value = []; }
|
||||
|
||||
position.value.unshift(value);
|
||||
positionSet = true;
|
||||
}
|
||||
} else {
|
||||
if (!positionSet)
|
||||
position.value = [];
|
||||
if (!positionSet) { position.value = []; }
|
||||
|
||||
position.value.unshift(value);
|
||||
positionSet = true;
|
||||
@@ -216,8 +219,7 @@ function background(property, configuration, validator) {
|
||||
}
|
||||
}
|
||||
|
||||
if (clipSet && !originSet)
|
||||
origin.value = clip.value.slice(0);
|
||||
if (clipSet && !originSet) { origin.value = clip.value.slice(0); }
|
||||
|
||||
if (!anyValueSet) {
|
||||
throw new InvalidPropertyError('Invalid background value at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
@@ -242,15 +244,15 @@ function borderRadius(property, configuration) {
|
||||
}
|
||||
|
||||
var target = _wrapDefault(property.name, property, configuration);
|
||||
target.value = splitAt > -1 ?
|
||||
values.slice(0, splitAt) :
|
||||
values.slice(0);
|
||||
target.value = splitAt > -1
|
||||
? values.slice(0, splitAt)
|
||||
: values.slice(0);
|
||||
target.components = fourValues(target, configuration);
|
||||
|
||||
var remainder = _wrapDefault(property.name, property, configuration);
|
||||
remainder.value = splitAt > -1 ?
|
||||
values.slice(splitAt + 1) :
|
||||
values.slice(0);
|
||||
remainder.value = splitAt > -1
|
||||
? values.slice(splitAt + 1)
|
||||
: values.slice(0);
|
||||
remainder.components = fourValues(remainder, configuration);
|
||||
|
||||
for (var j = 0; j < 4; j++) {
|
||||
@@ -281,7 +283,6 @@ function font(property, configuration, validator) {
|
||||
var isVariantValid;
|
||||
var isWeightSet = false;
|
||||
var isWeightValid;
|
||||
var isSizeSet = false;
|
||||
var appendableFamilyName = false;
|
||||
|
||||
if (!values[index]) {
|
||||
@@ -293,7 +294,11 @@ function font(property, configuration, validator) {
|
||||
return components;
|
||||
}
|
||||
|
||||
if (values.length == 1 && (validator.isFontKeyword(values[0][1]) || validator.isGlobal(values[0][1]) || validator.isPrefixed(values[0][1]))) {
|
||||
if (values.length == 1
|
||||
&& (validator.isFontKeyword(values[0][1])
|
||||
|| validator.isGlobal(values[0][1])
|
||||
|| validator.isPrefixed(values[0][1]))
|
||||
) {
|
||||
values[0][1] = Marker.INTERNAL + values[0][1];
|
||||
style.value = variant.value = weight.value = stretch.value = size.value = height.value = family.value = values;
|
||||
return components;
|
||||
@@ -326,7 +331,14 @@ function font(property, configuration, validator) {
|
||||
} else if (isStretchValid && !isStretchSet) {
|
||||
stretch.value = [values[index]];
|
||||
isStretchSet = true;
|
||||
} else if (isStyleValid && isStyleSet || isVariantValid && isVariantSet || isWeightValid && isWeightSet || isStretchValid && isStretchSet) {
|
||||
} else if (isStyleValid
|
||||
&& isStyleSet
|
||||
|| isVariantValid
|
||||
&& isVariantSet
|
||||
|| isWeightValid
|
||||
&& isWeightSet
|
||||
|| isStretchValid
|
||||
&& isStretchSet) {
|
||||
throw new InvalidPropertyError('Invalid font style / variant / weight / stretch value at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
} else {
|
||||
break;
|
||||
@@ -336,9 +348,10 @@ function font(property, configuration, validator) {
|
||||
}
|
||||
|
||||
// now comes font-size ...
|
||||
if (validator.isFontSizeKeyword(values[index][1]) || validator.isUnit(values[index][1]) && !validator.isDynamicUnit(values[index][1])) {
|
||||
if (validator.isFontSizeKeyword(values[index][1])
|
||||
|| validator.isUnit(values[index][1])
|
||||
&& !validator.isDynamicUnit(values[index][1])) {
|
||||
size.value = [values[index]];
|
||||
isSizeSet = true;
|
||||
index++;
|
||||
} else {
|
||||
throw new InvalidPropertyError('Missing font size at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
@@ -349,7 +362,12 @@ function font(property, configuration, validator) {
|
||||
}
|
||||
|
||||
// ... and perhaps line-height
|
||||
if (isSizeSet && values[index] && values[index][1] == Marker.FORWARD_SLASH && values[index + 1] && (validator.isLineHeightKeyword(values[index + 1][1]) || validator.isUnit(values[index + 1][1]) || validator.isNumber(values[index + 1][1]))) {
|
||||
if (values[index]
|
||||
&& values[index][1] == Marker.FORWARD_SLASH
|
||||
&& values[index + 1]
|
||||
&& (validator.isLineHeightKeyword(values[index + 1][1])
|
||||
|| validator.isUnit(values[index + 1][1])
|
||||
|| validator.isNumber(values[index + 1][1]))) {
|
||||
height.value = [values[index + 1]];
|
||||
index++;
|
||||
index++;
|
||||
@@ -388,7 +406,10 @@ function _anyIsFontSize(values, validator) {
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
value = values[i];
|
||||
|
||||
if (validator.isFontSizeKeyword(value[1]) || validator.isUnit(value[1]) && !validator.isDynamicUnit(value[1]) || validator.isFunction(value[1])) {
|
||||
if (validator.isFontSizeKeyword(value[1])
|
||||
|| validator.isUnit(value[1])
|
||||
&& !validator.isDynamicUnit(value[1])
|
||||
|| validator.isFunction(value[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -416,15 +437,11 @@ function fourValues(property, configuration) {
|
||||
var components = [];
|
||||
var value = property.value;
|
||||
|
||||
if (value.length < 1)
|
||||
return [];
|
||||
if (value.length < 1) { return []; }
|
||||
|
||||
if (value.length < 2)
|
||||
value[1] = value[0].slice(0);
|
||||
if (value.length < 3)
|
||||
value[2] = value[0].slice(0);
|
||||
if (value.length < 4)
|
||||
value[3] = value[1].slice(0);
|
||||
if (value.length < 2) { value[1] = value[0].slice(0); }
|
||||
if (value.length < 3) { value[2] = value[0].slice(0); }
|
||||
if (value.length < 4) { value[3] = value[1].slice(0); }
|
||||
|
||||
for (var i = componentNames.length - 1; i >= 0; i--) {
|
||||
var component = wrapSingle([
|
||||
@@ -439,19 +456,17 @@ function fourValues(property, configuration) {
|
||||
}
|
||||
|
||||
function multiplex(splitWith) {
|
||||
return function (property, configuration, validator) {
|
||||
return function(property, configuration, validator) {
|
||||
var splitsAt = [];
|
||||
var values = property.value;
|
||||
var i, j, l, m;
|
||||
|
||||
// find split commas
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
if (values[i][1] == ',')
|
||||
splitsAt.push(i);
|
||||
if (values[i][1] == ',') { splitsAt.push(i); }
|
||||
}
|
||||
|
||||
if (splitsAt.length === 0)
|
||||
return splitWith(property, configuration, validator);
|
||||
if (splitsAt.length === 0) { return splitWith(property, configuration, validator); }
|
||||
|
||||
var splitComponents = [];
|
||||
|
||||
@@ -463,7 +478,9 @@ function multiplex(splitWith) {
|
||||
var _property = _wrapDefault(property.name, property, configuration);
|
||||
_property.value = values.slice(from, to);
|
||||
|
||||
splitComponents.push(splitWith(_property, configuration, validator));
|
||||
if (_property.value.length > 0) {
|
||||
splitComponents.push(splitWith(_property, configuration, validator));
|
||||
}
|
||||
}
|
||||
|
||||
var components = splitComponents[0];
|
||||
@@ -582,16 +599,11 @@ function widthStyleColor(property, configuration, validator) {
|
||||
for (var i = 0; i < 3; i++) {
|
||||
var component = components[i];
|
||||
|
||||
if (component.name.indexOf('color') > 0)
|
||||
color = component;
|
||||
else if (component.name.indexOf('style') > 0)
|
||||
style = component;
|
||||
else
|
||||
width = component;
|
||||
if (component.name.indexOf('color') > 0) { color = component; } else if (component.name.indexOf('style') > 0) { style = component; } else { width = component; }
|
||||
}
|
||||
|
||||
if ((property.value.length == 1 && property.value[0][1] == 'inherit') ||
|
||||
(property.value.length == 3 && property.value[0][1] == 'inherit' && property.value[1][1] == 'inherit' && property.value[2][1] == 'inherit')) {
|
||||
if ((property.value.length == 1 && property.value[0][1] == 'inherit')
|
||||
|| (property.value.length == 3 && property.value[0][1] == 'inherit' && property.value[1][1] == 'inherit' && property.value[2][1] == 'inherit')) {
|
||||
color.value = style.value = width.value = [property.value[0]];
|
||||
return components;
|
||||
}
|
||||
|
120
node_modules/clean-css/lib/optimizer/configuration/can-override.js
generated
vendored
120
node_modules/clean-css/lib/optimizer/configuration/can-override.js
generated
vendored
@@ -1,9 +1,10 @@
|
||||
var understandable = require('./properties/understandable');
|
||||
|
||||
function animationIterationCount(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isAnimationIterationCountKeyword(value2) || validator.isPositiveNumber(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isAnimationIterationCountKeyword(value2) || validator.isPositiveNumber(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,9 +12,10 @@ function animationIterationCount(validator, value1, value2) {
|
||||
}
|
||||
|
||||
function animationName(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isAnimationNameKeyword(value2) || validator.isIdentifier(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isAnimationNameKeyword(value2) || validator.isIdentifier(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,17 +35,17 @@ function areSameFunction(validator, value1, value2) {
|
||||
|
||||
if (validator.isFunction(function1Value) || validator.isFunction(function2Value)) {
|
||||
return function1Name === function2Name && areSameFunction(validator, function1Value, function2Value);
|
||||
} else {
|
||||
return function1Name === function2Name;
|
||||
}
|
||||
return function1Name === function2Name;
|
||||
}
|
||||
|
||||
function backgroundPosition(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isBackgroundPositionKeyword(value2) || validator.isGlobal(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isBackgroundPositionKeyword(value2) || validator.isGlobal(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if (validator.isBackgroundPositionKeyword(value2) || validator.isGlobal(value2)) {
|
||||
} if (validator.isBackgroundPositionKeyword(value2) || validator.isGlobal(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,11 +53,12 @@ function backgroundPosition(validator, value1, value2) {
|
||||
}
|
||||
|
||||
function backgroundSize(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isBackgroundSizeKeyword(value2) || validator.isGlobal(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isBackgroundSizeKeyword(value2) || validator.isGlobal(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if (validator.isBackgroundSizeKeyword(value2) || validator.isGlobal(value2)) {
|
||||
} if (validator.isBackgroundSizeKeyword(value2) || validator.isGlobal(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -65,15 +68,15 @@ function backgroundSize(validator, value1, value2) {
|
||||
function color(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isColor(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if (!validator.colorOpacity && (validator.isRgbColor(value1) || validator.isHslColor(value1))) {
|
||||
} if (!validator.colorOpacity && (validator.isRgbColor(value1) || validator.isHslColor(value1))) {
|
||||
return false;
|
||||
} else if (!validator.colorOpacity && (validator.isRgbColor(value2) || validator.isHslColor(value2))) {
|
||||
} if (!validator.colorOpacity && (validator.isRgbColor(value2) || validator.isHslColor(value2))) {
|
||||
return false;
|
||||
} else if (!validator.colorHexAlpha && (validator.isHexAlphaColor(value1) || validator.isHexAlphaColor(value2))) {
|
||||
} if (!validator.colorHexAlpha && (validator.isHexAlphaColor(value1) || validator.isHexAlphaColor(value2))) {
|
||||
return false;
|
||||
} else if (validator.isColor(value1) && validator.isColor(value2)) {
|
||||
} if (validator.isColor(value1) && validator.isColor(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,7 +84,7 @@ function color(validator, value1, value2) {
|
||||
}
|
||||
|
||||
function components(overrideCheckers) {
|
||||
return function (validator, value1, value2, position) {
|
||||
return function(validator, value1, value2, position) {
|
||||
return overrideCheckers[position](validator, value1, value2);
|
||||
};
|
||||
}
|
||||
@@ -93,11 +96,11 @@ function fontFamily(validator, value1, value2) {
|
||||
function image(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isImage(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if (validator.isImage(value2)) {
|
||||
} if (validator.isImage(value2)) {
|
||||
return true;
|
||||
} else if (validator.isImage(value1)) {
|
||||
} if (validator.isImage(value1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ function keyword(propertyName) {
|
||||
return function(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isKeyword(propertyName)(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -118,9 +121,10 @@ function keyword(propertyName) {
|
||||
|
||||
function keywordWithGlobal(propertyName) {
|
||||
return function(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isKeyword(propertyName)(value2) || validator.isGlobal(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isKeyword(propertyName)(value2) || validator.isGlobal(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -131,7 +135,7 @@ function keywordWithGlobal(propertyName) {
|
||||
function propertyName(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isIdentifier(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -139,15 +143,18 @@ function propertyName(validator, value1, value2) {
|
||||
}
|
||||
|
||||
function sameFunctionOrValue(validator, value1, value2) {
|
||||
return areSameFunction(validator, value1, value2) ?
|
||||
true :
|
||||
value1 === value2;
|
||||
return areSameFunction(validator, value1, value2)
|
||||
? true
|
||||
: value1 === value2;
|
||||
}
|
||||
|
||||
function textShadow(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isUnit(value2) || validator.isColor(value2) || validator.isGlobal(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isUnit(value2)
|
||||
|| validator.isColor(value2)
|
||||
|| validator.isGlobal(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -157,15 +164,18 @@ function textShadow(validator, value1, value2) {
|
||||
function time(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isTime(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if (validator.isTime(value1) && !validator.isTime(value2)) {
|
||||
} if (validator.isTime(value1) && !validator.isTime(value2)) {
|
||||
return false;
|
||||
} else if (validator.isTime(value2)) {
|
||||
} if (validator.isTime(value2)) {
|
||||
return true;
|
||||
} else if (validator.isTime(value1)) {
|
||||
} if (validator.isTime(value1)) {
|
||||
return false;
|
||||
} else if (validator.isFunction(value1) && !validator.isPrefixed(value1) && validator.isFunction(value2) && !validator.isPrefixed(value2)) {
|
||||
} if (validator.isFunction(value1)
|
||||
&& !validator.isPrefixed(value1)
|
||||
&& validator.isFunction(value2)
|
||||
&& !validator.isPrefixed(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -173,9 +183,10 @@ function time(validator, value1, value2) {
|
||||
}
|
||||
|
||||
function timingFunction(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isTimingFunction(value2) || validator.isGlobal(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isTimingFunction(value2) || validator.isGlobal(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -185,15 +196,18 @@ function timingFunction(validator, value1, value2) {
|
||||
function unit(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isUnit(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if (validator.isUnit(value1) && !validator.isUnit(value2)) {
|
||||
} if (validator.isUnit(value1) && !validator.isUnit(value2)) {
|
||||
return false;
|
||||
} else if (validator.isUnit(value2)) {
|
||||
} if (validator.isUnit(value2)) {
|
||||
return true;
|
||||
} else if (validator.isUnit(value1)) {
|
||||
} if (validator.isUnit(value1)) {
|
||||
return false;
|
||||
} else if (validator.isFunction(value1) && !validator.isPrefixed(value1) && validator.isFunction(value2) && !validator.isPrefixed(value2)) {
|
||||
} if (validator.isFunction(value1)
|
||||
&& !validator.isPrefixed(value1)
|
||||
&& validator.isFunction(value2)
|
||||
&& !validator.isPrefixed(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -209,17 +223,25 @@ function unitOrKeywordWithGlobal(propertyName) {
|
||||
}
|
||||
|
||||
function unitOrNumber(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !(validator.isUnit(value2) || validator.isNumber(value2))) {
|
||||
if (!understandable(validator, value1, value2, 0, true)
|
||||
&& !(validator.isUnit(value2)
|
||||
|| validator.isNumber(value2))) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
} else if ((validator.isUnit(value1) || validator.isNumber(value1)) && !(validator.isUnit(value2) || validator.isNumber(value2))) {
|
||||
} if ((validator.isUnit(value1)
|
||||
|| validator.isNumber(value1))
|
||||
&& !(validator.isUnit(value2)
|
||||
|| validator.isNumber(value2))) {
|
||||
return false;
|
||||
} else if (validator.isUnit(value2) || validator.isNumber(value2)) {
|
||||
} if (validator.isUnit(value2) || validator.isNumber(value2)) {
|
||||
return true;
|
||||
} else if (validator.isUnit(value1) || validator.isNumber(value1)) {
|
||||
} if (validator.isUnit(value1) || validator.isNumber(value1)) {
|
||||
return false;
|
||||
} else if (validator.isFunction(value1) && !validator.isPrefixed(value1) && validator.isFunction(value2) && !validator.isPrefixed(value2)) {
|
||||
} if (validator.isFunction(value1)
|
||||
&& !validator.isPrefixed(value1)
|
||||
&& validator.isFunction(value2)
|
||||
&& !validator.isPrefixed(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -229,7 +251,7 @@ function unitOrNumber(validator, value1, value2) {
|
||||
function zIndex(validator, value1, value2) {
|
||||
if (!understandable(validator, value1, value2, 0, true) && !validator.isZIndex(value2)) {
|
||||
return false;
|
||||
} else if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
} if (validator.isVariable(value1) && validator.isVariable(value2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
85
node_modules/clean-css/lib/optimizer/configuration/restore.js
generated
vendored
85
node_modules/clean-css/lib/optimizer/configuration/restore.js
generated
vendored
@@ -7,8 +7,7 @@ function isInheritOnly(values) {
|
||||
for (var i = 0, l = values.length; i < l; i++) {
|
||||
var value = values[i][1];
|
||||
|
||||
if (value != 'inherit' && value != Marker.COMMA && value != Marker.FORWARD_SLASH)
|
||||
return false;
|
||||
if (value != 'inherit' && value != Marker.COMMA && value != Marker.FORWARD_SLASH) { return false; }
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -27,12 +26,16 @@ function background(property, configuration, lastInMultiplex) {
|
||||
var descriptor = configuration[component.name];
|
||||
|
||||
if (descriptor.doubleValues && descriptor.defaultValue.length == 1) {
|
||||
return component.value[0][1] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][1] == descriptor.defaultValue[0] : true);
|
||||
} else if (descriptor.doubleValues && descriptor.defaultValue.length != 1) {
|
||||
return component.value[0][1] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][1] : component.value[0][1]) == descriptor.defaultValue[1];
|
||||
} else {
|
||||
return component.value[0][1] == descriptor.defaultValue;
|
||||
return component.value[0][1] == descriptor.defaultValue[0]
|
||||
&& (component.value[1]
|
||||
? component.value[1][1] == descriptor.defaultValue[0]
|
||||
: true);
|
||||
} if (descriptor.doubleValues && descriptor.defaultValue.length != 1) {
|
||||
return component.value[0][1] == descriptor.defaultValue[0]
|
||||
&& ((component.value[1] ? component.value[1][1] : component.value[0][1])
|
||||
== descriptor.defaultValue[1]);
|
||||
}
|
||||
return component.value[0][1] == descriptor.defaultValue;
|
||||
}
|
||||
|
||||
for (var i = components.length - 1; i >= 0; i--) {
|
||||
@@ -46,9 +49,9 @@ function background(property, configuration, lastInMultiplex) {
|
||||
needsOne = component.value[0][1] == originComponent.value[0][1];
|
||||
|
||||
needsBoth = !needsOne && (
|
||||
(isOriginDefault && !isDefault) ||
|
||||
(!isOriginDefault && !isDefault) ||
|
||||
(!isOriginDefault && isDefault && component.value[0][1] != originComponent.value[0][1]));
|
||||
(isOriginDefault && !isDefault)
|
||||
|| (!isOriginDefault && !isDefault)
|
||||
|| (!isOriginDefault && isDefault && component.value[0][1] != originComponent.value[0][1]));
|
||||
|
||||
if (needsOne) {
|
||||
restoreValue(originComponent);
|
||||
@@ -64,8 +67,8 @@ function background(property, configuration, lastInMultiplex) {
|
||||
|
||||
needsOne = !isPositionDefault && isDefault;
|
||||
|
||||
needsBoth = !needsOne &&
|
||||
(isPositionDefault && !isDefault || !isPositionDefault && !isDefault);
|
||||
needsBoth = !needsOne
|
||||
&& (isPositionDefault && !isDefault || !isPositionDefault && !isDefault);
|
||||
|
||||
if (needsOne) {
|
||||
restoreValue(positionComponent);
|
||||
@@ -79,26 +82,22 @@ function background(property, configuration, lastInMultiplex) {
|
||||
|
||||
i--;
|
||||
} else {
|
||||
if (isDefault || configuration[component.name].multiplexLastOnly && !lastInMultiplex)
|
||||
continue;
|
||||
if (isDefault || configuration[component.name].multiplexLastOnly && !lastInMultiplex) { continue; }
|
||||
|
||||
restoreValue(component);
|
||||
}
|
||||
}
|
||||
|
||||
if (restored.length === 0 && property.value.length == 1 && property.value[0][1] == '0')
|
||||
restored.push(property.value[0]);
|
||||
if (restored.length === 0 && property.value.length == 1 && property.value[0][1] == '0') { restored.push(property.value[0]); }
|
||||
|
||||
if (restored.length === 0)
|
||||
restored.push([Token.PROPERTY_VALUE, configuration[property.name].defaultValue]);
|
||||
if (restored.length === 0) { restored.push([Token.PROPERTY_VALUE, configuration[property.name].defaultValue]); }
|
||||
|
||||
if (isInheritOnly(restored))
|
||||
return [restored[0]];
|
||||
if (isInheritOnly(restored)) { return [restored[0]]; }
|
||||
|
||||
return restored;
|
||||
}
|
||||
|
||||
function borderRadius(property, configuration) {
|
||||
function borderRadius(property) {
|
||||
if (property.multiplex) {
|
||||
var horizontal = shallowClone(property);
|
||||
var vertical = shallowClone(property);
|
||||
@@ -118,21 +117,19 @@ function borderRadius(property, configuration) {
|
||||
vertical.components.push(verticalComponent);
|
||||
}
|
||||
|
||||
var horizontalValues = fourValues(horizontal, configuration);
|
||||
var verticalValues = fourValues(vertical, configuration);
|
||||
var horizontalValues = fourValues(horizontal);
|
||||
var verticalValues = fourValues(vertical);
|
||||
|
||||
if (horizontalValues.length == verticalValues.length &&
|
||||
horizontalValues[0][1] == verticalValues[0][1] &&
|
||||
(horizontalValues.length > 1 ? horizontalValues[1][1] == verticalValues[1][1] : true) &&
|
||||
(horizontalValues.length > 2 ? horizontalValues[2][1] == verticalValues[2][1] : true) &&
|
||||
(horizontalValues.length > 3 ? horizontalValues[3][1] == verticalValues[3][1] : true)) {
|
||||
if (horizontalValues.length == verticalValues.length
|
||||
&& horizontalValues[0][1] == verticalValues[0][1]
|
||||
&& (horizontalValues.length > 1 ? horizontalValues[1][1] == verticalValues[1][1] : true)
|
||||
&& (horizontalValues.length > 2 ? horizontalValues[2][1] == verticalValues[2][1] : true)
|
||||
&& (horizontalValues.length > 3 ? horizontalValues[3][1] == verticalValues[3][1] : true)) {
|
||||
return horizontalValues;
|
||||
} else {
|
||||
return horizontalValues.concat([[Token.PROPERTY_VALUE, Marker.FORWARD_SLASH]]).concat(verticalValues);
|
||||
}
|
||||
} else {
|
||||
return fourValues(property, configuration);
|
||||
return horizontalValues.concat([[Token.PROPERTY_VALUE, Marker.FORWARD_SLASH]]).concat(verticalValues);
|
||||
}
|
||||
return fourValues(property);
|
||||
}
|
||||
|
||||
function font(property, configuration) {
|
||||
@@ -197,19 +194,17 @@ function fourValues(property) {
|
||||
|
||||
if (value1[1] == value2[1] && value1[1] == value3[1] && value1[1] == value4[1]) {
|
||||
return [value1];
|
||||
} else if (value1[1] == value3[1] && value2[1] == value4[1]) {
|
||||
} if (value1[1] == value3[1] && value2[1] == value4[1]) {
|
||||
return [value1, value2];
|
||||
} else if (value2[1] == value4[1]) {
|
||||
} if (value2[1] == value4[1]) {
|
||||
return [value1, value2, value3];
|
||||
} else {
|
||||
return [value1, value2, value3, value4];
|
||||
}
|
||||
return [value1, value2, value3, value4];
|
||||
}
|
||||
|
||||
function multiplex(restoreWith) {
|
||||
return function (property, configuration) {
|
||||
if (!property.multiplex)
|
||||
return restoreWith(property, configuration, true);
|
||||
return function(property, configuration) {
|
||||
if (!property.multiplex) { return restoreWith(property, configuration, true); }
|
||||
|
||||
var multiplexSize = 0;
|
||||
var restored = [];
|
||||
@@ -218,8 +213,7 @@ function multiplex(restoreWith) {
|
||||
|
||||
// At this point we don't know what's the multiplex size, e.g. how many background layers are there
|
||||
for (i = 0, l = property.components[0].value.length; i < l; i++) {
|
||||
if (property.components[0].value[i][1] == Marker.COMMA)
|
||||
multiplexSize++;
|
||||
if (property.components[0].value[i][1] == Marker.COMMA) { multiplexSize++; }
|
||||
}
|
||||
|
||||
for (i = 0; i <= multiplexSize; i++) {
|
||||
@@ -248,8 +242,7 @@ function multiplex(restoreWith) {
|
||||
var _restored = restoreWith(_property, configuration, lastInMultiplex);
|
||||
Array.prototype.push.apply(restored, _restored);
|
||||
|
||||
if (i < multiplexSize)
|
||||
restored.push([Token.PROPERTY_VALUE, Marker.COMMA]);
|
||||
if (i < multiplexSize) { restored.push([Token.PROPERTY_VALUE, Marker.COMMA]); }
|
||||
}
|
||||
|
||||
return restored;
|
||||
@@ -269,11 +262,9 @@ function withoutDefaults(property, configuration) {
|
||||
}
|
||||
}
|
||||
|
||||
if (restored.length === 0)
|
||||
restored.push([Token.PROPERTY_VALUE, configuration[property.name].defaultValue]);
|
||||
if (restored.length === 0) { restored.push([Token.PROPERTY_VALUE, configuration[property.name].defaultValue]); }
|
||||
|
||||
if (isInheritOnly(restored))
|
||||
return [restored[0]];
|
||||
if (isInheritOnly(restored)) { return [restored[0]]; }
|
||||
|
||||
return restored;
|
||||
}
|
||||
|
Reference in New Issue
Block a user