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

update node modules

This commit is contained in:
s2
2019-03-29 15:56:41 +01:00
parent f114871153
commit 89c32fb4e6
8347 changed files with 390123 additions and 159877 deletions

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('alignment-baseline', v);
},
get: function () {
return this.getPropertyValue('alignment-baseline');
},
enumerable: true,
configurable: true
};

View File

@@ -3,63 +3,65 @@
var parsers = require('../parsers');
module.exports.definition = {
set: function (v) {
var valueType = parsers.valueType(v);
if (valueType === parsers.TYPES.ANGLE) {
return this._setProperty('azimuth', parsers.parseAngle(v));
}
if (valueType === parsers.TYPES.KEYWORD) {
var keywords = v.toLowerCase().trim().split(/\s+/);
var hasBehind = false;
if (keywords.length > 2) {
return;
}
var behindIndex = keywords.indexOf('behind');
hasBehind = (behindIndex !== -1);
set: function(v) {
var valueType = parsers.valueType(v);
if (valueType === parsers.TYPES.ANGLE) {
return this._setProperty('azimuth', parsers.parseAngle(v));
}
if (valueType === parsers.TYPES.KEYWORD) {
var keywords = v
.toLowerCase()
.trim()
.split(/\s+/);
var hasBehind = false;
if (keywords.length > 2) {
return;
}
var behindIndex = keywords.indexOf('behind');
hasBehind = behindIndex !== -1;
if (keywords.length === 2) {
if (!hasBehind) {
return;
}
keywords.splice(behindIndex, 1);
}
if (keywords[0] === 'leftwards' || keywords[0] === 'rightwards') {
if (hasBehind) {
return;
}
return this._setProperty('azimuth', keywords[0]);
}
if (keywords[0] === 'behind') {
return this._setProperty('azimuth', '180deg');
}
var deg;
switch (keywords[0]) {
case 'left-side':
return this._setProperty('azimuth', '270deg');
case 'far-left':
return this._setProperty('azimuth', (hasBehind ? 240 : 300) + 'deg');
case 'left':
return this._setProperty('azimuth', (hasBehind ? 220 : 320) + 'deg');
case 'center-left':
return this._setProperty('azimuth', (hasBehind ? 200 : 340) + 'deg');
case 'center':
return this._setProperty('azimuth', (hasBehind ? 180 : 0) + 'deg');
case 'center-right':
return this._setProperty('azimuth', (hasBehind ? 160 : 20) + 'deg');
case 'right':
return this._setProperty('azimuth', (hasBehind ? 140 : 40) + 'deg');
case 'far-right':
return this._setProperty('azimuth', (hasBehind ? 120 : 60) + 'deg');
case 'right-side':
return this._setProperty('azimuth', '90deg');
default:
return;
}
if (keywords.length === 2) {
if (!hasBehind) {
return;
}
},
get: function () {
return this.getPropertyValue('azimuth');
},
enumerable: true,
configurable: true
keywords.splice(behindIndex, 1);
}
if (keywords[0] === 'leftwards' || keywords[0] === 'rightwards') {
if (hasBehind) {
return;
}
return this._setProperty('azimuth', keywords[0]);
}
if (keywords[0] === 'behind') {
return this._setProperty('azimuth', '180deg');
}
switch (keywords[0]) {
case 'left-side':
return this._setProperty('azimuth', '270deg');
case 'far-left':
return this._setProperty('azimuth', (hasBehind ? 240 : 300) + 'deg');
case 'left':
return this._setProperty('azimuth', (hasBehind ? 220 : 320) + 'deg');
case 'center-left':
return this._setProperty('azimuth', (hasBehind ? 200 : 340) + 'deg');
case 'center':
return this._setProperty('azimuth', (hasBehind ? 180 : 0) + 'deg');
case 'center-right':
return this._setProperty('azimuth', (hasBehind ? 160 : 20) + 'deg');
case 'right':
return this._setProperty('azimuth', (hasBehind ? 140 : 40) + 'deg');
case 'far-right':
return this._setProperty('azimuth', (hasBehind ? 120 : 60) + 'deg');
case 'right-side':
return this._setProperty('azimuth', '90deg');
default:
return;
}
}
},
get: function() {
return this.getPropertyValue('azimuth');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,24 +1,19 @@
'use strict';
var shorthandParser = require('../parsers').shorthandParser;
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'background-color': require('./backgroundColor'),
'background-image': require('./backgroundImage'),
'background-repeat': require('./backgroundRepeat'),
'background-attachment': require('./backgroundAttachment'),
'background-position': require('./backgroundPosition')
};
module.exports.isValid = function isValid(v) {
return shorthandParser(v, shorthand_for) !== undefined;
'background-color': require('./backgroundColor'),
'background-image': require('./backgroundImage'),
'background-repeat': require('./backgroundRepeat'),
'background-attachment': require('./backgroundAttachment'),
'background-position': require('./backgroundPosition'),
};
module.exports.definition = {
set: shorthandSetter('background', shorthand_for),
get: shorthandGetter('background', shorthand_for),
enumerable: true,
configurable: true
set: shorthandSetter('background', shorthand_for),
get: shorthandGetter('background', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -2,21 +2,23 @@
var parsers = require('../parsers');
var isValid = module.exports.isValid = function isValid(v) {
return parsers.valueType(v) === parsers.TYPES.KEYWORD &&
(v.toLowerCase() === 'scroll' || v.toLowerCase() === 'fixed' || v.toLowerCase() === 'inherit');
};
var isValid = (module.exports.isValid = function isValid(v) {
return (
parsers.valueType(v) === parsers.TYPES.KEYWORD &&
(v.toLowerCase() === 'scroll' || v.toLowerCase() === 'fixed' || v.toLowerCase() === 'inherit')
);
});
module.exports.definition = {
set: function (v) {
if (!isValid(v)) {
return;
}
this._setProperty('background-attachment', v);
},
get: function () {
return this.getPropertyValue('background-attachment');
},
enumerable: true,
configurable: true
set: function(v) {
if (!isValid(v)) {
return;
}
this._setProperty('background-attachment', v);
},
get: function() {
return this.getPropertyValue('background-attachment');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-clip', v);
},
get: function () {
return this.getPropertyValue('background-clip');
},
enumerable: true,
configurable: true
};

View File

@@ -3,31 +3,34 @@
var parsers = require('../parsers');
var parse = function parse(v) {
var parsed = parsers.parseColor(v);
if (parsed !== undefined) {
return parsed;
}
if (parsers.valueType(v) === parsers.TYPES.KEYWORD && (v.toLowerCase() === 'transparent' || v.toLowerCase() === 'inherit')) {
return v;
}
return undefined;
var parsed = parsers.parseColor(v);
if (parsed !== undefined) {
return parsed;
}
if (
parsers.valueType(v) === parsers.TYPES.KEYWORD &&
(v.toLowerCase() === 'transparent' || v.toLowerCase() === 'inherit')
) {
return v;
}
return undefined;
};
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
return parse(v) !== undefined;
};
module.exports.definition = {
set: function (v) {
var parsed = parse(v);
if (parsed === undefined) {
return;
}
this._setProperty('background-color', parsed);
},
get: function () {
return this.getPropertyValue('background-color');
},
enumerable: true,
configurable: true
set: function(v) {
var parsed = parse(v);
if (parsed === undefined) {
return;
}
this._setProperty('background-color', parsed);
},
get: function() {
return this.getPropertyValue('background-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,27 +3,30 @@
var parsers = require('../parsers');
var parse = function parse(v) {
var parsed = parsers.parseUrl(v);
if (parsed !== undefined) {
return parsed;
}
if (parsers.valueType(v) === parsers.TYPES.KEYWORD && (v.toLowerCase() === 'none' || v.toLowerCase() === 'inherit')) {
return v;
}
return undefined;
var parsed = parsers.parseUrl(v);
if (parsed !== undefined) {
return parsed;
}
if (
parsers.valueType(v) === parsers.TYPES.KEYWORD &&
(v.toLowerCase() === 'none' || v.toLowerCase() === 'inherit')
) {
return v;
}
return undefined;
};
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
return parse(v) !== undefined;
};
module.exports.definition = {
set: function (v) {
this._setProperty('background-image', parse(v));
},
get: function () {
return this.getPropertyValue('background-image');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('background-image', parse(v));
},
get: function() {
return this.getPropertyValue('background-image');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-origin', v);
},
get: function () {
return this.getPropertyValue('background-origin');
},
enumerable: true,
configurable: true
};

View File

@@ -5,52 +5,54 @@ var parsers = require('../parsers');
var valid_keywords = ['top', 'center', 'bottom', 'left', 'right'];
var parse = function parse(v) {
if (v === '' || v === null) {
return undefined;
if (v === '' || v === null) {
return undefined;
}
var parts = v.split(/\s+/);
if (parts.length > 2 || parts.length < 1) {
return undefined;
}
var types = [];
parts.forEach(function(part, index) {
types[index] = parsers.valueType(part);
});
if (parts.length === 1) {
if (types[0] === parsers.TYPES.LENGTH || types[0] === parsers.TYPES.PERCENT) {
return v;
}
var parts = v.split(/\s+/);
if (parts.length > 2 || parts.length < 1) {
return undefined;
}
var types = [];
parts.forEach(function (part, index) {
types[index] = parsers.valueType(part);
});
if (parts.length === 1) {
if (types[0] === parsers.TYPES.LENGTH || types[0] === parsers.TYPES.PERCENT) {
return v;
}
if (types[0] === parsers.TYPES.KEYWORD) {
if (valid_keywords.indexOf(v.toLowerCase()) !== -1 || v.toLowerCase() === 'inherit') {
return v;
}
}
return undefined;
}
if ((types[0] === parsers.TYPES.LENGTH || types[0] === parsers.TYPES.PERCENT) &&
(types[1] === parsers.TYPES.LENGTH || types[1] === parsers.TYPES.PERCENT)) {
return v;
}
if (types[0] !== parsers.TYPES.KEYWORD || types[1] !== parsers.TYPES.KEYWORD) {
return undefined;
}
if (valid_keywords.indexOf(parts[0]) !== -1 && valid_keywords.indexOf(parts[1]) !== -1) {
if (types[0] === parsers.TYPES.KEYWORD) {
if (valid_keywords.indexOf(v.toLowerCase()) !== -1 || v.toLowerCase() === 'inherit') {
return v;
}
}
return undefined;
}
if (
(types[0] === parsers.TYPES.LENGTH || types[0] === parsers.TYPES.PERCENT) &&
(types[1] === parsers.TYPES.LENGTH || types[1] === parsers.TYPES.PERCENT)
) {
return v;
}
if (types[0] !== parsers.TYPES.KEYWORD || types[1] !== parsers.TYPES.KEYWORD) {
return undefined;
}
if (valid_keywords.indexOf(parts[0]) !== -1 && valid_keywords.indexOf(parts[1]) !== -1) {
return v;
}
return undefined;
};
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
return parse(v) !== undefined;
};
module.exports.definition = {
set: function (v) {
this._setProperty('background-position', parse(v));
},
get: function () {
return this.getPropertyValue('background-position');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('background-position', parse(v));
},
get: function() {
return this.getPropertyValue('background-position');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-position-x', v);
},
get: function () {
return this.getPropertyValue('background-position-x');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-position-y', v);
},
get: function () {
return this.getPropertyValue('background-position-y');
},
enumerable: true,
configurable: true
};

View File

@@ -3,23 +3,30 @@
var parsers = require('../parsers');
var parse = function parse(v) {
if (parsers.valueType(v) === parsers.TYPES.KEYWORD && (v.toLowerCase() === 'repeat' || v.toLowerCase() === 'repeat-x' || v.toLowerCase() === 'repeat-y' || v.toLowerCase() === 'no-repeat' || v.toLowerCase() === 'inherit')) {
return v;
}
return undefined;
if (
parsers.valueType(v) === parsers.TYPES.KEYWORD &&
(v.toLowerCase() === 'repeat' ||
v.toLowerCase() === 'repeat-x' ||
v.toLowerCase() === 'repeat-y' ||
v.toLowerCase() === 'no-repeat' ||
v.toLowerCase() === 'inherit')
) {
return v;
}
return undefined;
};
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
return parse(v) !== undefined;
};
module.exports.definition = {
set: function (v) {
this._setProperty('background-repeat', parse(v));
},
get: function () {
return this.getPropertyValue('background-repeat');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('background-repeat', parse(v));
},
get: function() {
return this.getPropertyValue('background-repeat');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-repeat-x', v);
},
get: function () {
return this.getPropertyValue('background-repeat-x');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-repeat-y', v);
},
get: function () {
return this.getPropertyValue('background-repeat-y');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('background-size', v);
},
get: function () {
return this.getPropertyValue('background-size');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('baseline-shift', v);
},
get: function () {
return this.getPropertyValue('baseline-shift');
},
enumerable: true,
configurable: true
};

View File

@@ -1,49 +1,33 @@
'use strict';
var shorthandParser = require('../parsers').shorthandParser;
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'border-width': require('./borderWidth'),
'border-style': require('./borderStyle'),
'border-color': require('./borderColor')
};
var isValid = function isValid(v) {
return shorthandParser(v, shorthand_for) !== undefined;
};
module.exports.isValid = isValid;
var parser = function (v) {
if (v.toString().toLowerCase() === 'none') {
v = '';
}
if (isValid(v)) {
return v;
}
return undefined;
'border-width': require('./borderWidth'),
'border-style': require('./borderStyle'),
'border-color': require('./borderColor'),
};
var myShorthandSetter = shorthandSetter('border', shorthand_for);
var myShorthandGetter = shorthandGetter('border', shorthand_for);
module.exports.definition = {
set: function (v) {
if (v.toString().toLowerCase() === 'none') {
v = '';
}
myShorthandSetter.call(this, v);
this.removeProperty('border-top');
this.removeProperty('border-left');
this.removeProperty('border-right');
this.removeProperty('border-bottom');
this._values['border-top'] = this._values.border;
this._values['border-left'] = this._values.border;
this._values['border-right'] = this._values.border;
this._values['border-bottom'] = this._values.border;
},
get: myShorthandGetter,
enumerable: true,
configurable: true
set: function(v) {
if (v.toString().toLowerCase() === 'none') {
v = '';
}
myShorthandSetter.call(this, v);
this.removeProperty('border-top');
this.removeProperty('border-left');
this.removeProperty('border-right');
this.removeProperty('border-bottom');
this._values['border-top'] = this._values.border;
this._values['border-left'] = this._values.border;
this._values['border-right'] = this._values.border;
this._values['border-bottom'] = this._values.border;
},
get: myShorthandGetter,
enumerable: true,
configurable: true,
};

View File

@@ -2,22 +2,16 @@
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthandParser = require('../parsers').shorthandParser;
var shorthand_for = {
'border-bottom-width': require('./borderBottomWidth'),
'border-bottom-style': require('./borderBottomStyle'),
'border-bottom-color': require('./borderBottomColor')
'border-bottom-width': require('./borderBottomWidth'),
'border-bottom-style': require('./borderBottomStyle'),
'border-bottom-color': require('./borderBottomColor'),
};
var isValid = function isValid(v) {
return shorthandParser(v, shorthand_for) !== undefined;
};
module.exports.isValid = isValid;
module.exports.definition = {
set: shorthandSetter('border-bottom', shorthand_for),
get: shorthandGetter('border-bottom', shorthand_for),
enumerable: true,
configurable: true
set: shorthandSetter('border-bottom', shorthand_for),
get: shorthandGetter('border-bottom', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderColor').isValid;
var isValid = (module.exports.isValid = require('./borderColor').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-bottom-color', v);
}
},
get: function () {
return this.getPropertyValue('border-bottom-color');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-bottom-color', v);
}
},
get: function() {
return this.getPropertyValue('border-bottom-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-bottom-left-radius', v);
},
get: function () {
return this.getPropertyValue('border-bottom-left-radius');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-bottom-right-radius', v);
},
get: function () {
return this.getPropertyValue('border-bottom-right-radius');
},
enumerable: true,
configurable: true
};

View File

@@ -4,18 +4,18 @@ var isValid = require('./borderStyle').isValid;
module.exports.isValid = isValid;
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-bottom-width');
}
this._setProperty('border-bottom-style', v);
}
},
get: function () {
return this.getPropertyValue('border-bottom-style');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-bottom-width');
}
this._setProperty('border-bottom-style', v);
}
},
get: function() {
return this.getPropertyValue('border-bottom-style');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderWidth').isValid;
var isValid = (module.exports.isValid = require('./borderWidth').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-bottom-width', v);
}
},
get: function () {
return this.getPropertyValue('border-bottom-width');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-bottom-width', v);
}
},
get: function() {
return this.getPropertyValue('border-bottom-width');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,23 +3,24 @@
var parsers = require('../parsers');
var parse = function parse(v) {
if (parsers.valueType(v) === parsers.TYPES.KEYWORD && (v.toLowerCase() === 'collapse' || v.toLowerCase() === 'separate' || v.toLowerCase() === 'inherit')) {
return v;
}
return undefined;
};
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
if (
parsers.valueType(v) === parsers.TYPES.KEYWORD &&
(v.toLowerCase() === 'collapse' ||
v.toLowerCase() === 'separate' ||
v.toLowerCase() === 'inherit')
) {
return v;
}
return undefined;
};
module.exports.definition = {
set: function (v) {
this._setProperty('border-collapse', parse(v));
},
get: function () {
return this.getPropertyValue('border-collapse');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('border-collapse', parse(v));
},
get: function() {
return this.getPropertyValue('border-collapse');
},
enumerable: true,
configurable: true,
};

View File

@@ -4,25 +4,27 @@ var parsers = require('../parsers');
var implicitSetter = require('../parsers').implicitSetter;
module.exports.isValid = function parse(v) {
if (typeof v !== 'string') {
return false;
}
return (v === '' || v.toLowerCase() === 'transparent' || parsers.valueType(v) === parsers.TYPES.COLOR);
if (typeof v !== 'string') {
return false;
}
return (
v === '' || v.toLowerCase() === 'transparent' || parsers.valueType(v) === parsers.TYPES.COLOR
);
};
var isValid = module.exports.isValid;
var parser = function (v) {
if (isValid(v)) {
return v.toLowerCase();
}
return undefined;
var parser = function(v) {
if (isValid(v)) {
return v.toLowerCase();
}
return undefined;
};
module.exports.definition = {
set: implicitSetter('border', 'color', isValid, parser),
get: function () {
return this.getPropertyValue('border-color');
},
enumerable: true,
configurable: true
set: implicitSetter('border', 'color', isValid, parser),
get: function() {
return this.getPropertyValue('border-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-image', v);
},
get: function () {
return this.getPropertyValue('border-image');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-image-outset', v);
},
get: function () {
return this.getPropertyValue('border-image-outset');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-image-repeat', v);
},
get: function () {
return this.getPropertyValue('border-image-repeat');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-image-slice', v);
},
get: function () {
return this.getPropertyValue('border-image-slice');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-image-source', v);
},
get: function () {
return this.getPropertyValue('border-image-source');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-image-width', v);
},
get: function () {
return this.getPropertyValue('border-image-width');
},
enumerable: true,
configurable: true
};

View File

@@ -2,22 +2,16 @@
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthandParser = require('../parsers').shorthandParser;
var shorthand_for = {
'border-left-width': require('./borderLeftWidth'),
'border-left-style': require('./borderLeftStyle'),
'border-left-color': require('./borderLeftColor')
'border-left-width': require('./borderLeftWidth'),
'border-left-style': require('./borderLeftStyle'),
'border-left-color': require('./borderLeftColor'),
};
var isValid = function isValid(v) {
return shorthandParser(v, shorthand_for) !== undefined;
};
module.exports.isValid = isValid;
module.exports.definition = {
set: shorthandSetter('border-left', shorthand_for),
get: shorthandGetter('border-left', shorthand_for),
enumerable: true,
configurable: true
set: shorthandSetter('border-left', shorthand_for),
get: shorthandGetter('border-left', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderColor').isValid;
var isValid = (module.exports.isValid = require('./borderColor').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-left-color', v);
}
},
get: function () {
return this.getPropertyValue('border-left-color');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-left-color', v);
}
},
get: function() {
return this.getPropertyValue('border-left-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -4,18 +4,18 @@ var isValid = require('./borderStyle').isValid;
module.exports.isValid = isValid;
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-left-width');
}
this._setProperty('border-left-style', v);
}
},
get: function () {
return this.getPropertyValue('border-left-style');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-left-width');
}
this._setProperty('border-left-style', v);
}
},
get: function() {
return this.getPropertyValue('border-left-style');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderWidth').isValid;
var isValid = (module.exports.isValid = require('./borderWidth').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-left-width', v);
}
},
get: function () {
return this.getPropertyValue('border-left-width');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-left-width', v);
}
},
get: function() {
return this.getPropertyValue('border-left-width');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-radius', v);
},
get: function () {
return this.getPropertyValue('border-radius');
},
enumerable: true,
configurable: true
};

View File

@@ -2,22 +2,16 @@
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthandParser = require('../parsers').shorthandParser;
var shorthand_for = {
'border-right-width': require('./borderRightWidth'),
'border-right-style': require('./borderRightStyle'),
'border-right-color': require('./borderRightColor')
'border-right-width': require('./borderRightWidth'),
'border-right-style': require('./borderRightStyle'),
'border-right-color': require('./borderRightColor'),
};
var isValid = function isValid(v) {
return shorthandParser(v, shorthand_for) !== undefined;
};
module.exports.isValid = isValid;
module.exports.definition = {
set: shorthandSetter('border-right', shorthand_for),
get: shorthandGetter('border-right', shorthand_for),
enumerable: true,
configurable: true
set: shorthandSetter('border-right', shorthand_for),
get: shorthandGetter('border-right', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderColor').isValid;
var isValid = (module.exports.isValid = require('./borderColor').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-right-color', v);
}
},
get: function () {
return this.getPropertyValue('border-right-color');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-right-color', v);
}
},
get: function() {
return this.getPropertyValue('border-right-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -4,18 +4,18 @@ var isValid = require('./borderStyle').isValid;
module.exports.isValid = isValid;
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-right-width');
}
this._setProperty('border-right-style', v);
}
},
get: function () {
return this.getPropertyValue('border-right-style');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-right-width');
}
this._setProperty('border-right-style', v);
}
},
get: function() {
return this.getPropertyValue('border-right-style');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderWidth').isValid;
var isValid = (module.exports.isValid = require('./borderWidth').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-right-width', v);
}
},
get: function () {
return this.getPropertyValue('border-right-width');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-right-width', v);
}
},
get: function() {
return this.getPropertyValue('border-right-width');
},
enumerable: true,
configurable: true,
};

View File

@@ -7,36 +7,35 @@ var parsers = require('../parsers');
// if two, the first applies to the horizontal and the second applies to vertical spacing
var parse = function parse(v) {
if (v === '' || v === null) {
return undefined;
}
if (v.toLowerCase() === 'inherit') {
return v;
}
var parts = v.split(/\s+/);
if (parts.length !== 1 && parts.length !== 2) {
return undefined;
}
parts.forEach(function (part) {
if (parsers.valueType(part) !== parsers.TYPES.LENGTH) {
return undefined;
}
});
if (v === '' || v === null) {
return undefined;
}
if (v === 0) {
return '0px';
}
if (v.toLowerCase() === 'inherit') {
return v;
};
}
var parts = v.split(/\s+/);
if (parts.length !== 1 && parts.length !== 2) {
return undefined;
}
parts.forEach(function(part) {
if (parsers.valueType(part) !== parsers.TYPES.LENGTH) {
return undefined;
}
});
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
return v;
};
module.exports.definition = {
set: function (v) {
this._setProperty('border-spacing', parse(v));
},
get: function () {
return this.getPropertyValue('border-spacing');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('border-spacing', parse(v));
},
get: function() {
return this.getPropertyValue('border-spacing');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,25 +3,36 @@
var implicitSetter = require('../parsers').implicitSetter;
// the valid border-styles:
var styles = ['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'];
var styles = [
'none',
'hidden',
'dotted',
'dashed',
'solid',
'double',
'groove',
'ridge',
'inset',
'outset',
];
module.exports.isValid = function parse(v) {
return typeof v === 'string' && (v === '' || styles.indexOf(v) !== -1);
return typeof v === 'string' && (v === '' || styles.indexOf(v) !== -1);
};
var isValid = module.exports.isValid;
var parser = function (v) {
if (isValid(v)) {
return v.toLowerCase();
}
return undefined;
var parser = function(v) {
if (isValid(v)) {
return v.toLowerCase();
}
return undefined;
};
module.exports.definition = {
set: implicitSetter('border', 'style', isValid, parser),
get: function () {
return this.getPropertyValue('border-style');
},
enumerable: true,
configurable: true
set: implicitSetter('border', 'style', isValid, parser),
get: function() {
return this.getPropertyValue('border-style');
},
enumerable: true,
configurable: true,
};

View File

@@ -2,21 +2,16 @@
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthandParser = require('../parsers').shorthandParser;
var shorthand_for = {
'border-top-width': require('./borderTopWidth'),
'border-top-style': require('./borderTopStyle'),
'border-top-color': require('./borderTopColor')
};
module.exports.isValid = function (v) {
return shorthandParser(v, shorthand_for) !== undefined;
'border-top-width': require('./borderTopWidth'),
'border-top-style': require('./borderTopStyle'),
'border-top-color': require('./borderTopColor'),
};
module.exports.definition = {
set: shorthandSetter('border-top', shorthand_for),
get: shorthandGetter('border-top', shorthand_for),
enumerable: true,
configurable: true
set: shorthandSetter('border-top', shorthand_for),
get: shorthandGetter('border-top', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -1,16 +1,16 @@
'use strict';
var isValid = module.exports.isValid = require('./borderColor').isValid;
var isValid = (module.exports.isValid = require('./borderColor').isValid);
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-top-color', v);
}
},
get: function () {
return this.getPropertyValue('border-top-color');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-top-color', v);
}
},
get: function() {
return this.getPropertyValue('border-top-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-top-left-radius', v);
},
get: function () {
return this.getPropertyValue('border-top-left-radius');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('border-top-right-radius', v);
},
get: function () {
return this.getPropertyValue('border-top-right-radius');
},
enumerable: true,
configurable: true
};

View File

@@ -4,18 +4,18 @@ var isValid = require('./borderStyle').isValid;
module.exports.isValid = isValid;
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-top-width');
}
this._setProperty('border-top-style', v);
}
},
get: function () {
return this.getPropertyValue('border-top-style');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
if (v.toLowerCase() === 'none') {
v = '';
this.removeProperty('border-top-width');
}
this._setProperty('border-top-style', v);
}
},
get: function() {
return this.getPropertyValue('border-top-style');
},
enumerable: true,
configurable: true,
};

View File

@@ -4,14 +4,14 @@ var isValid = require('./borderWidth').isValid;
module.exports.isValid = isValid;
module.exports.definition = {
set: function (v) {
if (isValid(v)) {
this._setProperty('border-top-width', v);
}
},
get: function () {
return this.getPropertyValue('border-top-width');
},
enumerable: true,
configurable: true
set: function(v) {
if (isValid(v)) {
this._setProperty('border-top-width', v);
}
},
get: function() {
return this.getPropertyValue('border-top-width');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,6 +1,5 @@
'use strict';
var parsers = require('../parsers');
var parsers = require('../parsers');
var implicitSetter = require('../parsers').implicitSetter;
@@ -8,40 +7,40 @@ var implicitSetter = require('../parsers').implicitSetter;
var widths = ['thin', 'medium', 'thick'];
module.exports.isValid = function parse(v) {
var length = parsers.parseLength(v);
if (length !== undefined) {
return true;
}
if (typeof v !== 'string') {
return false;
}
if (v === '') {
return true;
}
v = v.toLowerCase();
if (widths.indexOf(v) === -1) {
return false;
}
var length = parsers.parseLength(v);
if (length !== undefined) {
return true;
}
if (typeof v !== 'string') {
return false;
}
if (v === '') {
return true;
}
v = v.toLowerCase();
if (widths.indexOf(v) === -1) {
return false;
}
return true;
};
var isValid = module.exports.isValid;
var parser = function (v) {
var length = parsers.parseLength(v);
if (length !== undefined) {
return length;
}
if (isValid(v)) {
return v.toLowerCase();
}
return undefined;
var parser = function(v) {
var length = parsers.parseLength(v);
if (length !== undefined) {
return length;
}
if (isValid(v)) {
return v.toLowerCase();
}
return undefined;
};
module.exports.definition = {
set: implicitSetter('border', 'width', isValid, parser),
get: function () {
return this.getPropertyValue('border-width');
},
enumerable: true,
configurable: true
set: implicitSetter('border', 'width', isValid, parser),
get: function() {
return this.getPropertyValue('border-width');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,12 +3,12 @@
var parseMeasurement = require('../parsers').parseMeasurement;
module.exports.definition = {
set: function (v) {
this._setProperty('bottom', parseMeasurement(v));
},
get: function () {
return this.getPropertyValue('bottom');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('bottom', parseMeasurement(v));
},
get: function() {
return this.getPropertyValue('bottom');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('box-shadow', v);
},
get: function () {
return this.getPropertyValue('box-shadow');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('box-sizing', v);
},
get: function () {
return this.getPropertyValue('box-sizing');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('caption-side', v);
},
get: function () {
return this.getPropertyValue('caption-side');
},
enumerable: true,
configurable: true
};

View File

@@ -2,15 +2,15 @@
var parseKeyword = require('../parsers').parseKeyword;
var clear_keywords = [ 'none', 'left', 'right', 'both', 'inherit' ];
var clear_keywords = ['none', 'left', 'right', 'both', 'inherit'];
module.exports.definition = {
set: function (v) {
this._setProperty('clear', parseKeyword(v, clear_keywords));
},
get: function () {
return this.getPropertyValue('clear');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('clear', parseKeyword(v, clear_keywords));
},
get: function() {
return this.getPropertyValue('clear');
},
enumerable: true,
configurable: true,
};

View File

@@ -2,48 +2,46 @@
var parseMeasurement = require('../parsers').parseMeasurement;
/*jslint regexp: true*/
var shape_regex = /^rect\((.*)\)$/i;
/*jslint regexp: false*/
var parse = function (val) {
if (val === '' || val === null) {
return val;
}
if (typeof val !== 'string') {
return undefined;
}
val = val.toLowerCase();
if (val === 'auto' || val === 'inherit') {
return val;
}
var matches = val.match(shape_regex);
if (!matches) {
return undefined;
}
var parts = matches[1].split(/\s*,\s*/);
if (parts.length !== 4) {
return undefined;
}
var valid = parts.every(function (part, index) {
var measurement = parseMeasurement(part);
parts[index] = measurement;
return measurement !== undefined;
});
if (!valid) {
return undefined;
}
parts = parts.join(', ');
return val.replace(matches[1], parts);
var parse = function(val) {
if (val === '' || val === null) {
return val;
}
if (typeof val !== 'string') {
return undefined;
}
val = val.toLowerCase();
if (val === 'auto' || val === 'inherit') {
return val;
}
var matches = val.match(shape_regex);
if (!matches) {
return undefined;
}
var parts = matches[1].split(/\s*,\s*/);
if (parts.length !== 4) {
return undefined;
}
var valid = parts.every(function(part, index) {
var measurement = parseMeasurement(part);
parts[index] = measurement;
return measurement !== undefined;
});
if (!valid) {
return undefined;
}
parts = parts.join(', ');
return val.replace(matches[1], parts);
};
module.exports.definition = {
set: function (v) {
this._setProperty('clip', parse(v));
},
get: function () {
return this.getPropertyValue('clip');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('clip', parse(v));
},
get: function() {
return this.getPropertyValue('clip');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,12 +3,12 @@
var parseColor = require('../parsers').parseColor;
module.exports.definition = {
set: function (v) {
this._setProperty('color', parseColor(v));
},
get: function () {
return this.getPropertyValue('color');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('color', parseColor(v));
},
get: function() {
return this.getPropertyValue('color');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('color-interpolation', v);
},
get: function () {
return this.getPropertyValue('color-interpolation');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('color-interpolation-filters', v);
},
get: function () {
return this.getPropertyValue('color-interpolation-filters');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('color-profile', v);
},
get: function () {
return this.getPropertyValue('color-profile');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('color-rendering', v);
},
get: function () {
return this.getPropertyValue('color-rendering');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('content', v);
},
get: function () {
return this.getPropertyValue('content');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('counter-increment', v);
},
get: function () {
return this.getPropertyValue('counter-increment');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('counter-reset', v);
},
get: function () {
return this.getPropertyValue('counter-reset');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +1,12 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('float', v);
},
get: function () {
return this.getPropertyValue('float');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('float', v);
},
get: function() {
return this.getPropertyValue('float');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('cue', v);
},
get: function () {
return this.getPropertyValue('cue');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('cue-after', v);
},
get: function () {
return this.getPropertyValue('cue-after');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('cue-before', v);
},
get: function () {
return this.getPropertyValue('cue-before');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('cursor', v);
},
get: function () {
return this.getPropertyValue('cursor');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('direction', v);
},
get: function () {
return this.getPropertyValue('direction');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('display', v);
},
get: function () {
return this.getPropertyValue('display');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('dominant-baseline', v);
},
get: function () {
return this.getPropertyValue('dominant-baseline');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('elevation', v);
},
get: function () {
return this.getPropertyValue('elevation');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('empty-cells', v);
},
get: function () {
return this.getPropertyValue('empty-cells');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('enable-background', v);
},
get: function () {
return this.getPropertyValue('enable-background');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('fill', v);
},
get: function () {
return this.getPropertyValue('fill');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('fill-opacity', v);
},
get: function () {
return this.getPropertyValue('fill-opacity');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('fill-rule', v);
},
get: function () {
return this.getPropertyValue('fill-rule');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('filter', v);
},
get: function () {
return this.getPropertyValue('filter');
},
enumerable: true,
configurable: true
};

45
node_modules/cssstyle/lib/properties/flex.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
'use strict';
var shorthandParser = require('../parsers').shorthandParser;
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'flex-grow': require('./flexGrow'),
'flex-shrink': require('./flexShrink'),
'flex-basis': require('./flexBasis'),
};
var myShorthandSetter = shorthandSetter('flex', shorthand_for);
module.exports.isValid = function isValid(v) {
return shorthandParser(v, shorthand_for) !== undefined;
};
module.exports.definition = {
set: function(v) {
var normalizedValue = String(v)
.trim()
.toLowerCase();
if (normalizedValue === 'none') {
myShorthandSetter.call(this, '0 0 auto');
return;
}
if (normalizedValue === 'initial') {
myShorthandSetter.call(this, '0 1 auto');
return;
}
if (normalizedValue === 'auto') {
this.removeProperty('flex-grow');
this.removeProperty('flex-shrink');
this.setProperty('flex-basis', normalizedValue);
return;
}
myShorthandSetter.call(this, v);
},
get: shorthandGetter('flex', shorthand_for),
enumerable: true,
configurable: true,
};

28
node_modules/cssstyle/lib/properties/flexBasis.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
'use strict';
var parseMeasurement = require('../parsers').parseMeasurement;
function parse(v) {
if (String(v).toLowerCase() === 'auto') {
return 'auto';
}
if (String(v).toLowerCase() === 'inherit') {
return 'inherit';
}
return parseMeasurement(v);
}
module.exports.isValid = function isValid(v) {
return parse(v) !== undefined;
};
module.exports.definition = {
set: function(v) {
this._setProperty('flex-basis', parse(v));
},
get: function() {
return this.getPropertyValue('flex-basis');
},
enumerable: true,
configurable: true,
};

19
node_modules/cssstyle/lib/properties/flexGrow.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
'use strict';
var parseNumber = require('../parsers').parseNumber;
var POSITION_AT_SHORTHAND = require('../constants').POSITION_AT_SHORTHAND;
module.exports.isValid = function isValid(v, positionAtFlexShorthand) {
return parseNumber(v) !== undefined && positionAtFlexShorthand === POSITION_AT_SHORTHAND.first;
};
module.exports.definition = {
set: function(v) {
this._setProperty('flex-grow', parseNumber(v));
},
get: function() {
return this.getPropertyValue('flex-grow');
},
enumerable: true,
configurable: true,
};

19
node_modules/cssstyle/lib/properties/flexShrink.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
'use strict';
var parseNumber = require('../parsers').parseNumber;
var POSITION_AT_SHORTHAND = require('../constants').POSITION_AT_SHORTHAND;
module.exports.isValid = function isValid(v, positionAtFlexShorthand) {
return parseNumber(v) !== undefined && positionAtFlexShorthand === POSITION_AT_SHORTHAND.second;
};
module.exports.definition = {
set: function(v) {
this._setProperty('flex-shrink', parseNumber(v));
},
get: function() {
return this.getPropertyValue('flex-shrink');
},
enumerable: true,
configurable: true,
};

12
node_modules/cssstyle/lib/properties/float.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
module.exports.definition = {
set: function(v) {
this._setProperty('float', v);
},
get: function() {
return this.getPropertyValue('float');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,12 +3,12 @@
var parseColor = require('../parsers').parseColor;
module.exports.definition = {
set: function (v) {
this._setProperty('flood-color', parseColor(v));
},
get: function () {
return this.getPropertyValue('flood-color');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('flood-color', parseColor(v));
},
get: function() {
return this.getPropertyValue('flood-color');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('flood-opacity', v);
},
get: function () {
return this.getPropertyValue('flood-opacity');
},
enumerable: true,
configurable: true
};

View File

@@ -7,34 +7,37 @@ var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'font-family': require('./fontFamily'),
'font-size': require('./fontSize'),
'font-style': require('./fontStyle'),
'font-variant': require('./fontVariant'),
'font-weight': require('./fontWeight'),
'line-height': require('./lineHeight')
'font-family': require('./fontFamily'),
'font-size': require('./fontSize'),
'font-style': require('./fontStyle'),
'font-variant': require('./fontVariant'),
'font-weight': require('./fontWeight'),
'line-height': require('./lineHeight'),
};
var static_fonts = ['caption', 'icon', 'menu', 'message-box', 'small-caption', 'status-bar', 'inherit'];
module.exports.isValid = function isValid(v) {
return (shorthandParser(v, shorthand_for) !== undefined) ||
(valueType(v) === TYPES.KEYWORD && static_fonts.indexOf(v.toLowerCase()) !== -1);
};
var static_fonts = [
'caption',
'icon',
'menu',
'message-box',
'small-caption',
'status-bar',
'inherit',
];
var setter = shorthandSetter('font', shorthand_for);
module.exports.definition = {
set: function (v) {
var short = shorthandParser(v, shorthand_for);
if (short !== undefined) {
return setter.call(this, v);
}
if (valueType(v) === TYPES.KEYWORD && static_fonts.indexOf(v.toLowerCase()) !== -1) {
this._setProperty('font', v);
}
},
get: shorthandGetter('font', shorthand_for),
enumerable: true,
configurable: true
set: function(v) {
var short = shorthandParser(v, shorthand_for);
if (short !== undefined) {
return setter.call(this, v);
}
if (valueType(v) === TYPES.KEYWORD && static_fonts.indexOf(v.toLowerCase()) !== -1) {
this._setProperty('font', v);
}
},
get: shorthandGetter('font', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -5,29 +5,29 @@ var valueType = require('../parsers').valueType;
var partsRegEx = /\s*,\s*/;
module.exports.isValid = function isValid(v) {
if (v === '' || v === null) {
return true;
if (v === '' || v === null) {
return true;
}
var parts = v.split(partsRegEx);
var len = parts.length;
var i;
var type;
for (i = 0; i < len; i++) {
type = valueType(parts[i]);
if (type === TYPES.STRING || type === TYPES.KEYWORD) {
return true;
}
var parts = v.split(partsRegEx);
var len = parts.length;
var i;
var type;
for (i = 0; i < len; i++) {
type = valueType(parts[i]);
if (type === TYPES.STRING || type === TYPES.KEYWORD) {
return true;
}
}
return false;
}
return false;
};
module.exports.definition = {
set: function (v) {
this._setProperty('font-family', v);
},
get: function () {
return this.getPropertyValue('font-family');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('font-family', v);
},
get: function() {
return this.getPropertyValue('font-family');
},
enumerable: true,
configurable: true,
};

View File

@@ -6,20 +6,23 @@ var valueType = require('../parsers').valueType;
var absoluteSizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
var relativeSizes = ['larger', 'smaller'];
module.exports.isValid = function (v) {
var type = valueType(v.toLowerCase());
return type === TYPES.LENGTH || type === TYPES.PERCENT ||
(type === TYPES.KEYWORD && absoluteSizes.indexOf(v.toLowerCase()) !== -1) ||
(type === TYPES.KEYWORD && relativeSizes.indexOf(v.toLowerCase()) !== -1);
module.exports.isValid = function(v) {
var type = valueType(v.toLowerCase());
return (
type === TYPES.LENGTH ||
type === TYPES.PERCENT ||
(type === TYPES.KEYWORD && absoluteSizes.indexOf(v.toLowerCase()) !== -1) ||
(type === TYPES.KEYWORD && relativeSizes.indexOf(v.toLowerCase()) !== -1)
);
};
module.exports.definition = {
set: function (v) {
this._setProperty('font-size', v);
},
get: function () {
return this.getPropertyValue('font-size');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('font-size', v);
},
get: function() {
return this.getPropertyValue('font-size');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('font-size-adjust', v);
},
get: function () {
return this.getPropertyValue('font-size-adjust');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('font-stretch', v);
},
get: function () {
return this.getPropertyValue('font-stretch');
},
enumerable: true,
configurable: true
};

View File

@@ -2,17 +2,17 @@
var valid_styles = ['normal', 'italic', 'oblique', 'inherit'];
module.exports.isValid = function (v) {
return valid_styles.indexOf(v.toLowerCase()) !== -1;
module.exports.isValid = function(v) {
return valid_styles.indexOf(v.toLowerCase()) !== -1;
};
module.exports.definition = {
set: function (v) {
this._setProperty('font-style', v);
},
get: function () {
return this.getPropertyValue('font-style');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('font-style', v);
},
get: function() {
return this.getPropertyValue('font-style');
},
enumerable: true,
configurable: true,
};

View File

@@ -3,16 +3,16 @@
var valid_variants = ['normal', 'small-caps', 'inherit'];
module.exports.isValid = function isValid(v) {
return valid_variants.indexOf(v.toLowerCase()) !== -1;
return valid_variants.indexOf(v.toLowerCase()) !== -1;
};
module.exports.definition = {
set: function (v) {
this._setProperty('font-variant', v);
},
get: function () {
return this.getPropertyValue('font-variant');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('font-variant', v);
},
get: function() {
return this.getPropertyValue('font-variant');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,18 +1,33 @@
'use strict';
var valid_weights = ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900', 'inherit'];
var valid_weights = [
'normal',
'bold',
'bolder',
'lighter',
'100',
'200',
'300',
'400',
'500',
'600',
'700',
'800',
'900',
'inherit',
];
module.exports.isValid = function isValid(v) {
return valid_weights.indexOf(v.toLowerCase()) !== -1;
return valid_weights.indexOf(v.toLowerCase()) !== -1;
};
module.exports.definition = {
set: function (v) {
this._setProperty('font-weight', v);
},
get: function () {
return this.getPropertyValue('font-weight');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('font-weight', v);
},
get: function() {
return this.getPropertyValue('font-weight');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('glyph-orientation-horizontal', v);
},
get: function () {
return this.getPropertyValue('glyph-orientation-horizontal');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('glyph-orientation-vertical', v);
},
get: function () {
return this.getPropertyValue('glyph-orientation-vertical');
},
enumerable: true,
configurable: true
};

View File

@@ -3,22 +3,22 @@
var parseMeasurement = require('../parsers').parseMeasurement;
function parse(v) {
if (String(v).toLowerCase() === 'auto') {
return 'auto';
}
if (String(v).toLowerCase() === 'inherit') {
return 'inherit';
}
return parseMeasurement(v);
if (String(v).toLowerCase() === 'auto') {
return 'auto';
}
if (String(v).toLowerCase() === 'inherit') {
return 'inherit';
}
return parseMeasurement(v);
}
module.exports.definition = {
set: function (v) {
this._setProperty('height', parse(v));
},
get: function () {
return this.getPropertyValue('height');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('height', parse(v));
},
get: function() {
return this.getPropertyValue('height');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('image-rendering', v);
},
get: function () {
return this.getPropertyValue('image-rendering');
},
enumerable: true,
configurable: true
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('kerning', v);
},
get: function () {
return this.getPropertyValue('kerning');
},
enumerable: true,
configurable: true
};

View File

@@ -3,12 +3,12 @@
var parseMeasurement = require('../parsers').parseMeasurement;
module.exports.definition = {
set: function (v) {
this._setProperty('left', parseMeasurement(v));
},
get: function () {
return this.getPropertyValue('left');
},
enumerable: true,
configurable: true
set: function(v) {
this._setProperty('left', parseMeasurement(v));
},
get: function() {
return this.getPropertyValue('left');
},
enumerable: true,
configurable: true,
};

View File

@@ -1,12 +0,0 @@
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('letter-spacing', v);
},
get: function () {
return this.getPropertyValue('letter-spacing');
},
enumerable: true,
configurable: true
};

Some files were not shown because too many files have changed in this diff Show More