format: prettify entire project

This commit is contained in:
Rim
2025-04-02 06:50:39 -04:00
parent 86f0782a98
commit 7ccc0be712
1711 changed files with 755867 additions and 235931 deletions

View File

@ -1,16 +1,25 @@
var functionNoVendorRegexStr = '[A-Z]+(\\-|[A-Z]|[0-9])+\\(.*?\\)';
var functionVendorRegexStr = '\\-(\\-|[A-Z]|[0-9])+\\(.*?\\)';
var variableRegexStr = 'var\\(\\-\\-[^\\)]+\\)';
var functionAnyRegexStr = '(' + variableRegexStr + '|' + functionNoVendorRegexStr + '|' + functionVendorRegexStr + ')';
var functionAnyRegexStr =
'(' +
variableRegexStr +
'|' +
functionNoVendorRegexStr +
'|' +
functionVendorRegexStr +
')';
var calcRegex = new RegExp('^(\\-moz\\-|\\-webkit\\-)?calc\\([^\\)]+\\)$', 'i');
var decimalRegex = /[0-9]/;
var functionAnyRegex = new RegExp('^' + functionAnyRegexStr + '$', 'i');
var hslColorRegex = /^hsl\(\s{0,31}[\-\.]?\d+\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+%\s{0,31}\)|hsla\(\s{0,31}[\-\.]?\d+\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+\s{0,31}\)$/i;
var hslColorRegex =
/^hsl\(\s{0,31}[\-\.]?\d+\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+%\s{0,31}\)|hsla\(\s{0,31}[\-\.]?\d+\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+\s{0,31}\)$/i;
var identifierRegex = /^(\-[a-z0-9_][a-z0-9\-_]*|[a-z][a-z0-9\-_]*)$/i;
var namedEntityRegex = /^[a-z]+$/i;
var prefixRegex = /^-([a-z0-9]|-)*$/i;
var rgbColorRegex = /^rgb\(\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31}\)|rgba\(\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\.\d]+\s{0,31}\)$/i;
var rgbColorRegex =
/^rgb\(\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31}\)|rgba\(\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\.\d]+\s{0,31}\)$/i;
var timingFunctionRegex = /^(cubic\-bezier|steps)\([^\)]+\)$/;
var validTimeUnits = ['ms', 's'];
var urlRegex = /^url\([\s\S]+\)$/i;
@ -26,11 +35,7 @@ var MINUS_SIGN = '-';
var PLUS_SIGN = '+';
var Keywords = {
'^': [
'inherit',
'initial',
'unset'
],
'^': ['inherit', 'initial', 'unset'],
'*-style': [
'auto',
'dashed',
@ -42,7 +47,7 @@ var Keywords = {
'none',
'outset',
'ridge',
'solid'
'solid',
],
'*-timing-function': [
'ease',
@ -51,56 +56,28 @@ var Keywords = {
'ease-out',
'linear',
'step-end',
'step-start'
'step-start',
],
'animation-direction': [
'alternate',
'alternate-reverse',
'normal',
'reverse'
],
'animation-fill-mode': [
'backwards',
'both',
'forwards',
'none'
],
'animation-iteration-count': [
'infinite'
],
'animation-name': [
'none'
],
'animation-play-state': [
'paused',
'running'
],
'background-attachment': [
'fixed',
'inherit',
'local',
'scroll'
'reverse',
],
'animation-fill-mode': ['backwards', 'both', 'forwards', 'none'],
'animation-iteration-count': ['infinite'],
'animation-name': ['none'],
'animation-play-state': ['paused', 'running'],
'background-attachment': ['fixed', 'inherit', 'local', 'scroll'],
'background-clip': [
'border-box',
'content-box',
'inherit',
'padding-box',
'text'
],
'background-origin': [
'border-box',
'content-box',
'inherit',
'padding-box'
],
'background-position': [
'bottom',
'center',
'left',
'right',
'top'
'text',
],
'background-origin': ['border-box', 'content-box', 'inherit', 'padding-box'],
'background-position': ['bottom', 'center', 'left', 'right', 'top'],
'background-repeat': [
'no-repeat',
'inherit',
@ -108,31 +85,14 @@ var Keywords = {
'repeat-x',
'repeat-y',
'round',
'space'
'space',
],
'background-size': [
'auto',
'cover',
'contain'
],
'border-collapse': [
'collapse',
'inherit',
'separate'
],
'bottom': [
'auto'
],
'clear': [
'both',
'left',
'none',
'right'
],
'color': [
'transparent'
],
'cursor': [
'background-size': ['auto', 'cover', 'contain'],
'border-collapse': ['collapse', 'inherit', 'separate'],
bottom: ['auto'],
clear: ['both', 'left', 'none', 'right'],
color: ['transparent'],
cursor: [
'all-scroll',
'auto',
'col-resize',
@ -155,9 +115,9 @@ var Keywords = {
'text',
'vertical-text',
'w-resize',
'wait'
'wait',
],
'display': [
display: [
'block',
'inline',
'inline-block',
@ -172,24 +132,18 @@ var Keywords = {
'table-footer-group',
'table-header-group',
'table-row',
'table-row-group'
'table-row-group',
],
'float': [
'left',
'none',
'right'
],
'left': [
'auto'
],
'font': [
float: ['left', 'none', 'right'],
left: ['auto'],
font: [
'caption',
'icon',
'menu',
'message-box',
'small-caption',
'status-bar',
'unset'
'unset',
],
'font-size': [
'large',
@ -200,7 +154,7 @@ var Keywords = {
'x-large',
'x-small',
'xx-large',
'xx-small'
'xx-small',
],
'font-stretch': [
'condensed',
@ -211,17 +165,10 @@ var Keywords = {
'semi-condensed',
'semi-expanded',
'ultra-condensed',
'ultra-expanded'
],
'font-style': [
'italic',
'normal',
'oblique'
],
'font-variant': [
'normal',
'small-caps'
'ultra-expanded',
],
'font-style': ['italic', 'normal', 'oblique'],
'font-variant': ['normal', 'small-caps'],
'font-weight': [
'100',
'200',
@ -235,15 +182,10 @@ var Keywords = {
'bold',
'bolder',
'lighter',
'normal'
],
'line-height': [
'normal'
],
'list-style-position': [
'inside',
'outside'
'normal',
],
'line-height': ['normal'],
'list-style-position': ['inside', 'outside'],
'list-style-type': [
'armenian',
'circle',
@ -260,43 +202,21 @@ var Keywords = {
'square',
'upper-alpha',
'upper-latin',
'upper-roman'
],
'overflow': [
'auto',
'hidden',
'scroll',
'visible'
],
'position': [
'absolute',
'fixed',
'relative',
'static'
],
'right': [
'auto'
'upper-roman',
],
overflow: ['auto', 'hidden', 'scroll', 'visible'],
position: ['absolute', 'fixed', 'relative', 'static'],
right: ['auto'],
'text-align': [
'center',
'justify',
'left',
'left|right', // this is the default value of list-style-type, see comment in compactable.js
'right'
],
'text-decoration': [
'line-through',
'none',
'overline',
'underline'
],
'text-overflow': [
'clip',
'ellipsis'
],
'top': [
'auto'
'right',
],
'text-decoration': ['line-through', 'none', 'overline', 'underline'],
'text-overflow': ['clip', 'ellipsis'],
top: ['auto'],
'vertical-align': [
'baseline',
'bottom',
@ -305,25 +225,11 @@ var Keywords = {
'super',
'text-bottom',
'text-top',
'top'
'top',
],
'visibility': [
'collapse',
'hidden',
'visible'
],
'white-space': [
'normal',
'nowrap',
'pre'
],
'width': [
'inherit',
'initial',
'medium',
'thick',
'thin'
]
visibility: ['collapse', 'hidden', 'visible'],
'white-space': ['normal', 'nowrap', 'pre'],
width: ['inherit', 'initial', 'medium', 'thick', 'thin'],
};
var Units = [
@ -342,17 +248,17 @@ var Units = [
'vm',
'vmax',
'vmin',
'vw'
'vw',
];
function isColor(value) {
return value != 'auto' &&
(
isKeyword('color')(value) ||
return (
value != 'auto' &&
(isKeyword('color')(value) ||
isHexColor(value) ||
isColorFunction(value) ||
isNamedEntity(value)
);
isNamedEntity(value))
);
}
function isColorFunction(value) {
@ -368,7 +274,12 @@ function isFunction(value) {
}
function isHexColor(value) {
return threeValueColorRegex.test(value) || fourValueColorRegex.test(value) || sixValueColorRegex.test(value) || eightValueColorRegex.test(value);
return (
threeValueColorRegex.test(value) ||
fourValueColorRegex.test(value) ||
sixValueColorRegex.test(value) ||
eightValueColorRegex.test(value)
);
}
function isHslColor(value) {
@ -384,7 +295,7 @@ function isImage(value) {
}
function isKeyword(propertyName) {
return function(value) {
return function (value) {
return Keywords[propertyName].indexOf(value) > -1;
};
}
@ -406,8 +317,7 @@ function isPrefixed(value) {
}
function isPositiveNumber(value) {
return isNumber(value) &&
parseFloat(value) >= 0;
return isNumber(value) && parseFloat(value) >= 0;
}
function isVariable(value) {
@ -417,8 +327,11 @@ function isVariable(value) {
function isTime(value) {
var numberUpTo = scanForNumber(value);
return numberUpTo == value.length && parseInt(value) === 0 ||
numberUpTo > -1 && validTimeUnits.indexOf(value.slice(numberUpTo + 1)) > -1;
return (
(numberUpTo == value.length && parseInt(value) === 0) ||
(numberUpTo > -1 &&
validTimeUnits.indexOf(value.slice(numberUpTo + 1)) > -1)
);
}
function isTimingFunction() {
@ -432,10 +345,12 @@ function isTimingFunction() {
function isUnit(validUnits, value) {
var numberUpTo = scanForNumber(value);
return numberUpTo == value.length && parseInt(value) === 0 ||
numberUpTo > -1 && validUnits.indexOf(value.slice(numberUpTo + 1)) > -1 ||
return (
(numberUpTo == value.length && parseInt(value) === 0) ||
(numberUpTo > -1 && validUnits.indexOf(value.slice(numberUpTo + 1)) > -1) ||
value == 'auto' ||
value == 'inherit';
value == 'inherit'
);
}
function isUrl(value) {
@ -443,9 +358,7 @@ function isUrl(value) {
}
function isZIndex(value) {
return value == 'auto' ||
isNumber(value) ||
isKeyword('^')(value);
return value == 'auto' || isNumber(value) || isKeyword('^')(value);
}
function scanForNumber(value) {
@ -459,7 +372,11 @@ function scanForNumber(value) {
if (i === 0 && (character == PLUS_SIGN || character == MINUS_SIGN)) {
hasSign = true;
} else if (i > 0 && hasSign && (character == PLUS_SIGN || character == MINUS_SIGN)) {
} else if (
i > 0 &&
hasSign &&
(character == PLUS_SIGN || character == MINUS_SIGN)
) {
return i - 1;
} else if (character == DECIMAL_DOT && !hasDot) {
hasDot = true;
@ -477,7 +394,9 @@ function scanForNumber(value) {
function validator(compatibility) {
var validUnits = Units.slice(0).filter(function (value) {
return !(value in compatibility.units) || compatibility.units[value] === true;
return (
!(value in compatibility.units) || compatibility.units[value] === true
);
});
return {
@ -522,7 +441,7 @@ function validator(compatibility) {
isUrl: isUrl,
isVariable: isVariable,
isWidth: isKeyword('width'),
isZIndex: isZIndex
isZIndex: isZIndex,
};
}