1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-04 20:40:07 +02:00

update packages to latest version

This commit is contained in:
s2
2022-08-20 18:51:33 +02:00
parent 09663a35a5
commit 806ebf9a57
4513 changed files with 366205 additions and 92512 deletions

View File

@@ -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;
}