This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

260
node_modules/cssstyle/lib/CSSStyleDeclaration.js generated vendored Normal file
View File

@@ -0,0 +1,260 @@
/*********************************************************************
* This is a fork from the CSS Style Declaration part of
* https://github.com/NV/CSSOM
********************************************************************/
'use strict';
var CSSOM = require('cssom');
var allProperties = require('./allProperties');
var allExtraProperties = require('./allExtraProperties');
var implementedProperties = require('./implementedProperties');
var { dashedToCamelCase } = require('./parsers');
var getBasicPropertyDescriptor = require('./utils/getBasicPropertyDescriptor');
/**
* @constructor
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
*/
var CSSStyleDeclaration = function CSSStyleDeclaration(onChangeCallback) {
this._values = {};
this._importants = {};
this._length = 0;
this._onChange =
onChangeCallback ||
function() {
return;
};
};
CSSStyleDeclaration.prototype = {
constructor: CSSStyleDeclaration,
/**
*
* @param {string} name
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue
* @return {string} the value of the property if it has been explicitly set for this declaration block.
* Returns the empty string if the property has not been set.
*/
getPropertyValue: function(name) {
if (!this._values.hasOwnProperty(name)) {
return '';
}
return this._values[name].toString();
},
/**
*
* @param {string} name
* @param {string} value
* @param {string} [priority=null] "important" or null
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
*/
setProperty: function(name, value, priority) {
if (value === undefined) {
return;
}
if (value === null || value === '') {
this.removeProperty(name);
return;
}
var isCustomProperty = name.indexOf('--') === 0;
if (isCustomProperty) {
this._setProperty(name, value, priority);
return;
}
var lowercaseName = name.toLowerCase();
if (!allProperties.has(lowercaseName) && !allExtraProperties.has(lowercaseName)) {
return;
}
this[lowercaseName] = value;
this._importants[lowercaseName] = priority;
},
_setProperty: function(name, value, priority) {
if (value === undefined) {
return;
}
if (value === null || value === '') {
this.removeProperty(name);
return;
}
if (this._values[name]) {
// Property already exist. Overwrite it.
var index = Array.prototype.indexOf.call(this, name);
if (index < 0) {
this[this._length] = name;
this._length++;
}
} else {
// New property.
this[this._length] = name;
this._length++;
}
this._values[name] = value;
this._importants[name] = priority;
this._onChange(this.cssText);
},
/**
*
* @param {string} name
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty
* @return {string} the value of the property if it has been explicitly set for this declaration block.
* Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.
*/
removeProperty: function(name) {
if (!this._values.hasOwnProperty(name)) {
return '';
}
var prevValue = this._values[name];
delete this._values[name];
delete this._importants[name];
var index = Array.prototype.indexOf.call(this, name);
if (index < 0) {
return prevValue;
}
// That's what WebKit and Opera do
Array.prototype.splice.call(this, index, 1);
// That's what Firefox does
//this[index] = ""
this._onChange(this.cssText);
return prevValue;
},
/**
*
* @param {String} name
*/
getPropertyPriority: function(name) {
return this._importants[name] || '';
},
getPropertyCSSValue: function() {
//FIXME
return;
},
/**
* element.style.overflow = "auto"
* element.style.getPropertyShorthand("overflow-x")
* -> "overflow"
*/
getPropertyShorthand: function() {
//FIXME
return;
},
isPropertyImplicit: function() {
//FIXME
return;
},
/**
* http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-item
*/
item: function(index) {
index = parseInt(index, 10);
if (index < 0 || index >= this._length) {
return '';
}
return this[index];
},
};
Object.defineProperties(CSSStyleDeclaration.prototype, {
cssText: {
get: function() {
var properties = [];
var i;
var name;
var value;
var priority;
for (i = 0; i < this._length; i++) {
name = this[i];
value = this.getPropertyValue(name);
priority = this.getPropertyPriority(name);
if (priority !== '') {
priority = ' !' + priority;
}
properties.push([name, ': ', value, priority, ';'].join(''));
}
return properties.join(' ');
},
set: function(value) {
var i;
this._values = {};
Array.prototype.splice.call(this, 0, this._length);
this._importants = {};
var dummyRule;
try {
dummyRule = CSSOM.parse('#bogus{' + value + '}').cssRules[0].style;
} catch (err) {
// malformed css, just return
return;
}
var rule_length = dummyRule.length;
var name;
for (i = 0; i < rule_length; ++i) {
name = dummyRule[i];
this.setProperty(
dummyRule[i],
dummyRule.getPropertyValue(name),
dummyRule.getPropertyPriority(name)
);
}
this._onChange(this.cssText);
},
enumerable: true,
configurable: true,
},
parentRule: {
get: function() {
return null;
},
enumerable: true,
configurable: true,
},
length: {
get: function() {
return this._length;
},
/**
* This deletes indices if the new length is less then the current
* length. If the new length is more, it does nothing, the new indices
* will be undefined until set.
**/
set: function(value) {
var i;
for (i = value; i < this._length; i++) {
delete this[i];
}
this._length = value;
},
enumerable: true,
configurable: true,
},
});
require('./properties')(CSSStyleDeclaration.prototype);
allProperties.forEach(function(property) {
if (!implementedProperties.has(property)) {
var declaration = getBasicPropertyDescriptor(property);
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
Object.defineProperty(CSSStyleDeclaration.prototype, dashedToCamelCase(property), declaration);
}
});
allExtraProperties.forEach(function(property) {
if (!implementedProperties.has(property)) {
var declaration = getBasicPropertyDescriptor(property);
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
Object.defineProperty(CSSStyleDeclaration.prototype, dashedToCamelCase(property), declaration);
}
});
exports.CSSStyleDeclaration = CSSStyleDeclaration;

556
node_modules/cssstyle/lib/CSSStyleDeclaration.test.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

67
node_modules/cssstyle/lib/allExtraProperties.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
'use strict';
/**
* This file contains all implemented properties that are not a part of any
* current specifications or drafts, but are handled by browsers nevertheless.
*/
var allWebkitProperties = require('./allWebkitProperties');
module.exports = new Set(
[
'background-position-x',
'background-position-y',
'background-repeat-x',
'background-repeat-y',
'color-interpolation',
'color-profile',
'color-rendering',
'css-float',
'enable-background',
'fill',
'fill-opacity',
'fill-rule',
'glyph-orientation-horizontal',
'image-rendering',
'kerning',
'marker',
'marker-end',
'marker-mid',
'marker-offset',
'marker-start',
'marks',
'pointer-events',
'shape-rendering',
'size',
'src',
'stop-color',
'stop-opacity',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'text-anchor',
'text-line-through',
'text-line-through-color',
'text-line-through-mode',
'text-line-through-style',
'text-line-through-width',
'text-overline',
'text-overline-color',
'text-overline-mode',
'text-overline-style',
'text-overline-width',
'text-rendering',
'text-underline',
'text-underline-color',
'text-underline-mode',
'text-underline-style',
'text-underline-width',
'unicode-range',
'vector-effect',
].concat(allWebkitProperties)
);

462
node_modules/cssstyle/lib/allProperties.js generated vendored Normal file
View File

@@ -0,0 +1,462 @@
'use strict';
// autogenerated - 4/29/2020
/*
*
* https://www.w3.org/Style/CSS/all-properties.en.html
*/
module.exports = new Set([
'align-content',
'align-items',
'align-self',
'alignment-baseline',
'all',
'animation',
'animation-delay',
'animation-direction',
'animation-duration',
'animation-fill-mode',
'animation-iteration-count',
'animation-name',
'animation-play-state',
'animation-timing-function',
'appearance',
'azimuth',
'background',
'background-attachment',
'background-blend-mode',
'background-clip',
'background-color',
'background-image',
'background-origin',
'background-position',
'background-repeat',
'background-size',
'baseline-shift',
'block-overflow',
'block-size',
'bookmark-label',
'bookmark-level',
'bookmark-state',
'border',
'border-block',
'border-block-color',
'border-block-end',
'border-block-end-color',
'border-block-end-style',
'border-block-end-width',
'border-block-start',
'border-block-start-color',
'border-block-start-style',
'border-block-start-width',
'border-block-style',
'border-block-width',
'border-bottom',
'border-bottom-color',
'border-bottom-left-radius',
'border-bottom-right-radius',
'border-bottom-style',
'border-bottom-width',
'border-boundary',
'border-collapse',
'border-color',
'border-end-end-radius',
'border-end-start-radius',
'border-image',
'border-image-outset',
'border-image-repeat',
'border-image-slice',
'border-image-source',
'border-image-width',
'border-inline',
'border-inline-color',
'border-inline-end',
'border-inline-end-color',
'border-inline-end-style',
'border-inline-end-width',
'border-inline-start',
'border-inline-start-color',
'border-inline-start-style',
'border-inline-start-width',
'border-inline-style',
'border-inline-width',
'border-left',
'border-left-color',
'border-left-style',
'border-left-width',
'border-radius',
'border-right',
'border-right-color',
'border-right-style',
'border-right-width',
'border-spacing',
'border-start-end-radius',
'border-start-start-radius',
'border-style',
'border-top',
'border-top-color',
'border-top-left-radius',
'border-top-right-radius',
'border-top-style',
'border-top-width',
'border-width',
'bottom',
'box-decoration-break',
'box-shadow',
'box-sizing',
'box-snap',
'break-after',
'break-before',
'break-inside',
'caption-side',
'caret',
'caret-color',
'caret-shape',
'chains',
'clear',
'clip',
'clip-path',
'clip-rule',
'color',
'color-adjust',
'color-interpolation-filters',
'color-scheme',
'column-count',
'column-fill',
'column-gap',
'column-rule',
'column-rule-color',
'column-rule-style',
'column-rule-width',
'column-span',
'column-width',
'columns',
'contain',
'content',
'continue',
'counter-increment',
'counter-reset',
'counter-set',
'cue',
'cue-after',
'cue-before',
'cursor',
'direction',
'display',
'dominant-baseline',
'elevation',
'empty-cells',
'filter',
'flex',
'flex-basis',
'flex-direction',
'flex-flow',
'flex-grow',
'flex-shrink',
'flex-wrap',
'float',
'flood-color',
'flood-opacity',
'flow',
'flow-from',
'flow-into',
'font',
'font-family',
'font-feature-settings',
'font-kerning',
'font-language-override',
'font-optical-sizing',
'font-palette',
'font-size',
'font-size-adjust',
'font-stretch',
'font-style',
'font-synthesis',
'font-synthesis-small-caps',
'font-synthesis-style',
'font-synthesis-weight',
'font-variant',
'font-variant-alternates',
'font-variant-caps',
'font-variant-east-asian',
'font-variant-emoji',
'font-variant-ligatures',
'font-variant-numeric',
'font-variant-position',
'font-variation-settings',
'font-weight',
'footnote-display',
'footnote-policy',
'forced-color-adjust',
'gap',
'glyph-orientation-vertical',
'grid',
'grid-area',
'grid-auto-columns',
'grid-auto-flow',
'grid-auto-rows',
'grid-column',
'grid-column-end',
'grid-column-start',
'grid-row',
'grid-row-end',
'grid-row-start',
'grid-template',
'grid-template-areas',
'grid-template-columns',
'grid-template-rows',
'hanging-punctuation',
'height',
'hyphenate-character',
'hyphenate-limit-chars',
'hyphenate-limit-last',
'hyphenate-limit-lines',
'hyphenate-limit-zone',
'hyphens',
'image-orientation',
'image-rendering',
'image-resolution',
'initial-letters',
'initial-letters-align',
'initial-letters-wrap',
'inline-size',
'inline-sizing',
'inset',
'inset-block',
'inset-block-end',
'inset-block-start',
'inset-inline',
'inset-inline-end',
'inset-inline-start',
'isolation',
'justify-content',
'justify-items',
'justify-self',
'left',
'letter-spacing',
'lighting-color',
'line-break',
'line-clamp',
'line-grid',
'line-height',
'line-padding',
'line-snap',
'list-style',
'list-style-image',
'list-style-position',
'list-style-type',
'margin',
'margin-block',
'margin-block-end',
'margin-block-start',
'margin-bottom',
'margin-inline',
'margin-inline-end',
'margin-inline-start',
'margin-left',
'margin-right',
'margin-top',
'marker-side',
'mask',
'mask-border',
'mask-border-mode',
'mask-border-outset',
'mask-border-repeat',
'mask-border-slice',
'mask-border-source',
'mask-border-width',
'mask-clip',
'mask-composite',
'mask-image',
'mask-mode',
'mask-origin',
'mask-position',
'mask-repeat',
'mask-size',
'mask-type',
'max-block-size',
'max-height',
'max-inline-size',
'max-lines',
'max-width',
'min-block-size',
'min-height',
'min-inline-size',
'min-width',
'mix-blend-mode',
'nav-down',
'nav-left',
'nav-right',
'nav-up',
'object-fit',
'object-position',
'offset',
'offset-after',
'offset-anchor',
'offset-before',
'offset-distance',
'offset-end',
'offset-path',
'offset-position',
'offset-rotate',
'offset-start',
'opacity',
'order',
'orphans',
'outline',
'outline-color',
'outline-offset',
'outline-style',
'outline-width',
'overflow',
'overflow-block',
'overflow-inline',
'overflow-wrap',
'overflow-x',
'overflow-y',
'padding',
'padding-block',
'padding-block-end',
'padding-block-start',
'padding-bottom',
'padding-inline',
'padding-inline-end',
'padding-inline-start',
'padding-left',
'padding-right',
'padding-top',
'page',
'page-break-after',
'page-break-before',
'page-break-inside',
'pause',
'pause-after',
'pause-before',
'pitch',
'pitch-range',
'place-content',
'place-items',
'place-self',
'play-during',
'position',
'quotes',
'region-fragment',
'resize',
'rest',
'rest-after',
'rest-before',
'richness',
'right',
'row-gap',
'ruby-align',
'ruby-merge',
'ruby-position',
'running',
'scroll-behavior',
'scroll-margin',
'scroll-margin-block',
'scroll-margin-block-end',
'scroll-margin-block-start',
'scroll-margin-bottom',
'scroll-margin-inline',
'scroll-margin-inline-end',
'scroll-margin-inline-start',
'scroll-margin-left',
'scroll-margin-right',
'scroll-margin-top',
'scroll-padding',
'scroll-padding-block',
'scroll-padding-block-end',
'scroll-padding-block-start',
'scroll-padding-bottom',
'scroll-padding-inline',
'scroll-padding-inline-end',
'scroll-padding-inline-start',
'scroll-padding-left',
'scroll-padding-right',
'scroll-padding-top',
'scroll-snap-align',
'scroll-snap-stop',
'scroll-snap-type',
'shape-image-threshold',
'shape-inside',
'shape-margin',
'shape-outside',
'spatial-navigation-action',
'spatial-navigation-contain',
'spatial-navigation-function',
'speak',
'speak-as',
'speak-header',
'speak-numeral',
'speak-punctuation',
'speech-rate',
'stress',
'string-set',
'tab-size',
'table-layout',
'text-align',
'text-align-all',
'text-align-last',
'text-combine-upright',
'text-decoration',
'text-decoration-color',
'text-decoration-line',
'text-decoration-style',
'text-emphasis',
'text-emphasis-color',
'text-emphasis-position',
'text-emphasis-style',
'text-group-align',
'text-indent',
'text-justify',
'text-orientation',
'text-overflow',
'text-shadow',
'text-space-collapse',
'text-space-trim',
'text-spacing',
'text-transform',
'text-underline-position',
'text-wrap',
'top',
'transform',
'transform-box',
'transform-origin',
'transition',
'transition-delay',
'transition-duration',
'transition-property',
'transition-timing-function',
'unicode-bidi',
'user-select',
'vertical-align',
'visibility',
'voice-balance',
'voice-duration',
'voice-family',
'voice-pitch',
'voice-range',
'voice-rate',
'voice-stress',
'voice-volume',
'volume',
'white-space',
'widows',
'width',
'will-change',
'word-boundary-detection',
'word-boundary-expansion',
'word-break',
'word-spacing',
'word-wrap',
'wrap-after',
'wrap-before',
'wrap-flow',
'wrap-inside',
'wrap-through',
'writing-mode',
'z-index',
]);

194
node_modules/cssstyle/lib/allWebkitProperties.js generated vendored Normal file
View File

@@ -0,0 +1,194 @@
'use strict';
/**
* This file contains all implemented properties that are not a part of any
* current specifications or drafts, but are handled by browsers nevertheless.
*/
module.exports = [
'animation',
'animation-delay',
'animation-direction',
'animation-duration',
'animation-fill-mode',
'animation-iteration-count',
'animation-name',
'animation-play-state',
'animation-timing-function',
'appearance',
'aspect-ratio',
'backface-visibility',
'background-clip',
'background-composite',
'background-origin',
'background-size',
'border-after',
'border-after-color',
'border-after-style',
'border-after-width',
'border-before',
'border-before-color',
'border-before-style',
'border-before-width',
'border-end',
'border-end-color',
'border-end-style',
'border-end-width',
'border-fit',
'border-horizontal-spacing',
'border-image',
'border-radius',
'border-start',
'border-start-color',
'border-start-style',
'border-start-width',
'border-vertical-spacing',
'box-align',
'box-direction',
'box-flex',
'box-flex-group',
'box-lines',
'box-ordinal-group',
'box-orient',
'box-pack',
'box-reflect',
'box-shadow',
'color-correction',
'column-axis',
'column-break-after',
'column-break-before',
'column-break-inside',
'column-count',
'column-gap',
'column-rule',
'column-rule-color',
'column-rule-style',
'column-rule-width',
'columns',
'column-span',
'column-width',
'filter',
'flex-align',
'flex-direction',
'flex-flow',
'flex-item-align',
'flex-line-pack',
'flex-order',
'flex-pack',
'flex-wrap',
'flow-from',
'flow-into',
'font-feature-settings',
'font-kerning',
'font-size-delta',
'font-smoothing',
'font-variant-ligatures',
'highlight',
'hyphenate-character',
'hyphenate-limit-after',
'hyphenate-limit-before',
'hyphenate-limit-lines',
'hyphens',
'line-align',
'line-box-contain',
'line-break',
'line-clamp',
'line-grid',
'line-snap',
'locale',
'logical-height',
'logical-width',
'margin-after',
'margin-after-collapse',
'margin-before',
'margin-before-collapse',
'margin-bottom-collapse',
'margin-collapse',
'margin-end',
'margin-start',
'margin-top-collapse',
'marquee',
'marquee-direction',
'marquee-increment',
'marquee-repetition',
'marquee-speed',
'marquee-style',
'mask',
'mask-attachment',
'mask-box-image',
'mask-box-image-outset',
'mask-box-image-repeat',
'mask-box-image-slice',
'mask-box-image-source',
'mask-box-image-width',
'mask-clip',
'mask-composite',
'mask-image',
'mask-origin',
'mask-position',
'mask-position-x',
'mask-position-y',
'mask-repeat',
'mask-repeat-x',
'mask-repeat-y',
'mask-size',
'match-nearest-mail-blockquote-color',
'max-logical-height',
'max-logical-width',
'min-logical-height',
'min-logical-width',
'nbsp-mode',
'overflow-scrolling',
'padding-after',
'padding-before',
'padding-end',
'padding-start',
'perspective',
'perspective-origin',
'perspective-origin-x',
'perspective-origin-y',
'print-color-adjust',
'region-break-after',
'region-break-before',
'region-break-inside',
'region-overflow',
'rtl-ordering',
'svg-shadow',
'tap-highlight-color',
'text-combine',
'text-decorations-in-effect',
'text-emphasis',
'text-emphasis-color',
'text-emphasis-position',
'text-emphasis-style',
'text-fill-color',
'text-orientation',
'text-security',
'text-size-adjust',
'text-stroke',
'text-stroke-color',
'text-stroke-width',
'transform',
'transform-origin',
'transform-origin-x',
'transform-origin-y',
'transform-origin-z',
'transform-style',
'transition',
'transition-delay',
'transition-duration',
'transition-property',
'transition-timing-function',
'user-drag',
'user-modify',
'user-select',
'wrap',
'wrap-flow',
'wrap-margin',
'wrap-padding',
'wrap-shape-inside',
'wrap-shape-outside',
'wrap-through',
'writing-mode',
'zoom',
].map(prop => 'webkit-' + prop);

6
node_modules/cssstyle/lib/constants.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
'use strict';
module.exports.POSITION_AT_SHORTHAND = {
first: 0,
second: 1,
};

90
node_modules/cssstyle/lib/implementedProperties.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
'use strict';
// autogenerated - 4/29/2020
/*
*
* https://www.w3.org/Style/CSS/all-properties.en.html
*/
var implementedProperties = new Set();
implementedProperties.add("azimuth");
implementedProperties.add("background");
implementedProperties.add("background-attachment");
implementedProperties.add("background-color");
implementedProperties.add("background-image");
implementedProperties.add("background-position");
implementedProperties.add("background-repeat");
implementedProperties.add("border");
implementedProperties.add("border-bottom");
implementedProperties.add("border-bottom-color");
implementedProperties.add("border-bottom-style");
implementedProperties.add("border-bottom-width");
implementedProperties.add("border-collapse");
implementedProperties.add("border-color");
implementedProperties.add("border-left");
implementedProperties.add("border-left-color");
implementedProperties.add("border-left-style");
implementedProperties.add("border-left-width");
implementedProperties.add("border-right");
implementedProperties.add("border-right-color");
implementedProperties.add("border-right-style");
implementedProperties.add("border-right-width");
implementedProperties.add("border-spacing");
implementedProperties.add("border-style");
implementedProperties.add("border-top");
implementedProperties.add("border-top-color");
implementedProperties.add("border-top-style");
implementedProperties.add("border-top-width");
implementedProperties.add("border-width");
implementedProperties.add("bottom");
implementedProperties.add("clear");
implementedProperties.add("clip");
implementedProperties.add("color");
implementedProperties.add("css-float");
implementedProperties.add("flex");
implementedProperties.add("flex-basis");
implementedProperties.add("flex-grow");
implementedProperties.add("flex-shrink");
implementedProperties.add("float");
implementedProperties.add("flood-color");
implementedProperties.add("font");
implementedProperties.add("font-family");
implementedProperties.add("font-size");
implementedProperties.add("font-style");
implementedProperties.add("font-variant");
implementedProperties.add("font-weight");
implementedProperties.add("height");
implementedProperties.add("left");
implementedProperties.add("lighting-color");
implementedProperties.add("line-height");
implementedProperties.add("margin");
implementedProperties.add("margin-bottom");
implementedProperties.add("margin-left");
implementedProperties.add("margin-right");
implementedProperties.add("margin-top");
implementedProperties.add("opacity");
implementedProperties.add("outline-color");
implementedProperties.add("padding");
implementedProperties.add("padding-bottom");
implementedProperties.add("padding-left");
implementedProperties.add("padding-right");
implementedProperties.add("padding-top");
implementedProperties.add("right");
implementedProperties.add("stop-color");
implementedProperties.add("text-line-through-color");
implementedProperties.add("text-overline-color");
implementedProperties.add("text-underline-color");
implementedProperties.add("top");
implementedProperties.add("webkit-border-after-color");
implementedProperties.add("webkit-border-before-color");
implementedProperties.add("webkit-border-end-color");
implementedProperties.add("webkit-border-start-color");
implementedProperties.add("webkit-column-rule-color");
implementedProperties.add("webkit-match-nearest-mail-blockquote-color");
implementedProperties.add("webkit-tap-highlight-color");
implementedProperties.add("webkit-text-emphasis-color");
implementedProperties.add("webkit-text-fill-color");
implementedProperties.add("webkit-text-stroke-color");
implementedProperties.add("width");
module.exports = implementedProperties;

152
node_modules/cssstyle/lib/named_colors.json generated vendored Normal file
View File

@@ -0,0 +1,152 @@
[
"aliceblue",
"antiquewhite",
"aqua",
"aquamarine",
"azure",
"beige",
"bisque",
"black",
"blanchedalmond",
"blue",
"blueviolet",
"brown",
"burlywood",
"cadetblue",
"chartreuse",
"chocolate",
"coral",
"cornflowerblue",
"cornsilk",
"crimson",
"cyan",
"darkblue",
"darkcyan",
"darkgoldenrod",
"darkgray",
"darkgreen",
"darkgrey",
"darkkhaki",
"darkmagenta",
"darkolivegreen",
"darkorange",
"darkorchid",
"darkred",
"darksalmon",
"darkseagreen",
"darkslateblue",
"darkslategray",
"darkslategrey",
"darkturquoise",
"darkviolet",
"deeppink",
"deepskyblue",
"dimgray",
"dimgrey",
"dodgerblue",
"firebrick",
"floralwhite",
"forestgreen",
"fuchsia",
"gainsboro",
"ghostwhite",
"gold",
"goldenrod",
"gray",
"green",
"greenyellow",
"grey",
"honeydew",
"hotpink",
"indianred",
"indigo",
"ivory",
"khaki",
"lavender",
"lavenderblush",
"lawngreen",
"lemonchiffon",
"lightblue",
"lightcoral",
"lightcyan",
"lightgoldenrodyellow",
"lightgray",
"lightgreen",
"lightgrey",
"lightpink",
"lightsalmon",
"lightseagreen",
"lightskyblue",
"lightslategray",
"lightslategrey",
"lightsteelblue",
"lightyellow",
"lime",
"limegreen",
"linen",
"magenta",
"maroon",
"mediumaquamarine",
"mediumblue",
"mediumorchid",
"mediumpurple",
"mediumseagreen",
"mediumslateblue",
"mediumspringgreen",
"mediumturquoise",
"mediumvioletred",
"midnightblue",
"mintcream",
"mistyrose",
"moccasin",
"navajowhite",
"navy",
"oldlace",
"olive",
"olivedrab",
"orange",
"orangered",
"orchid",
"palegoldenrod",
"palegreen",
"paleturquoise",
"palevioletred",
"papayawhip",
"peachpuff",
"peru",
"pink",
"plum",
"powderblue",
"purple",
"rebeccapurple",
"red",
"rosybrown",
"royalblue",
"saddlebrown",
"salmon",
"sandybrown",
"seagreen",
"seashell",
"sienna",
"silver",
"skyblue",
"slateblue",
"slategray",
"slategrey",
"snow",
"springgreen",
"steelblue",
"tan",
"teal",
"thistle",
"tomato",
"turquoise",
"violet",
"wheat",
"white",
"whitesmoke",
"yellow",
"yellowgreen",
"transparent",
"currentcolor"
]

722
node_modules/cssstyle/lib/parsers.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

139
node_modules/cssstyle/lib/parsers.test.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
'use strict';
const parsers = require('./parsers');
describe('valueType', () => {
it('returns color for red', () => {
let input = 'red';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for #nnnnnn', () => {
let input = '#fefefe';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for rgb(n, n, n)', () => {
let input = 'rgb(10, 10, 10)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for rgb(p, p, p)', () => {
let input = 'rgb(10%, 10%, 10%)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for rgba(n, n, n, n)', () => {
let input = 'rgba(10, 10, 10, 1)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for rgba(n, n, n, n) with decimal alpha', () => {
let input = 'rgba(10, 10, 10, 0.5)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for rgba(p, p, p, n)', () => {
let input = 'rgba(10%, 10%, 10%, 1)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns color for rgba(p, p, p, n) with decimal alpha', () => {
let input = 'rgba(10%, 10%, 10%, 0.5)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.COLOR);
});
it('returns length for 100ch', () => {
let input = '100ch';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.LENGTH);
});
it('returns calc from calc(100px * 2)', () => {
let input = 'calc(100px * 2)';
let output = parsers.valueType(input);
expect(output).toEqual(parsers.TYPES.CALC);
});
});
describe('parseInteger', () => {
it.todo('test');
});
describe('parseNumber', () => {
it.todo('test');
});
describe('parseLength', () => {
it.todo('test');
});
describe('parsePercent', () => {
it.todo('test');
});
describe('parseMeasurement', () => {
it.todo('test');
});
describe('parseUrl', () => {
it.todo('test');
});
describe('parseString', () => {
it.todo('test');
});
describe('parseColor', () => {
it('should convert hsl to rgb values', () => {
let input = 'hsla(0, 1%, 2%)';
let output = parsers.parseColor(input);
expect(output).toEqual('rgb(5, 5, 5)');
});
it('should convert hsla to rgba values', () => {
let input = 'hsla(0, 1%, 2%, 0.5)';
let output = parsers.parseColor(input);
expect(output).toEqual('rgba(5, 5, 5, 0.5)');
});
it.todo('Add more tests');
});
describe('parseAngle', () => {
it.todo('test');
});
describe('parseKeyword', () => {
it.todo('test');
});
describe('dashedToCamelCase', () => {
it.todo('test');
});
describe('shorthandParser', () => {
it.todo('test');
});
describe('shorthandSetter', () => {
it.todo('test');
});
describe('shorthandGetter', () => {
it.todo('test');
});
describe('implicitSetter', () => {
it.todo('test');
});
describe('subImplicitSetter', () => {
it.todo('test');
});
describe('camelToDashed', () => {
it.todo('test');
});

1833
node_modules/cssstyle/lib/properties.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

67
node_modules/cssstyle/lib/properties/azimuth.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
'use strict';
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;
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');
}
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,
};

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

@@ -0,0 +1,19 @@
'use strict';
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.definition = {
set: shorthandSetter('background', shorthand_for),
get: shorthandGetter('background', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -0,0 +1,24 @@
'use strict';
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')
);
});
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,
};

View File

@@ -0,0 +1,36 @@
'use strict';
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;
};
module.exports.isValid = function isValid(v) {
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,
};

View File

@@ -0,0 +1,32 @@
'use strict';
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;
};
module.exports.isValid = function isValid(v) {
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,
};

View File

@@ -0,0 +1,58 @@
'use strict';
var parsers = require('../parsers');
var valid_keywords = ['top', 'center', 'bottom', 'left', 'right'];
var parse = function parse(v) {
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;
}
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;
};
module.exports.definition = {
set: function(v) {
this._setProperty('background-position', parse(v));
},
get: function() {
return this.getPropertyValue('background-position');
},
enumerable: true,
configurable: true,
};

View File

@@ -0,0 +1,32 @@
'use strict';
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;
};
module.exports.isValid = function isValid(v) {
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,
};

33
node_modules/cssstyle/lib/properties/border.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
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 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,
};

17
node_modules/cssstyle/lib/properties/borderBottom.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'border-bottom-width': require('./borderBottomWidth'),
'border-bottom-style': require('./borderBottomStyle'),
'border-bottom-color': require('./borderBottomColor'),
};
module.exports.definition = {
set: shorthandSetter('border-bottom', shorthand_for),
get: shorthandGetter('border-bottom', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

View File

@@ -0,0 +1,21 @@
'use strict';
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,
};

View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

26
node_modules/cssstyle/lib/properties/borderCollapse.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
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.definition = {
set: function(v) {
this._setProperty('border-collapse', parse(v));
},
get: function() {
return this.getPropertyValue('border-collapse');
},
enumerable: true,
configurable: true,
};

30
node_modules/cssstyle/lib/properties/borderColor.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
'use strict';
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
);
};
var isValid = module.exports.isValid;
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,
};

17
node_modules/cssstyle/lib/properties/borderLeft.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'border-left-width': require('./borderLeftWidth'),
'border-left-style': require('./borderLeftStyle'),
'border-left-color': require('./borderLeftColor'),
};
module.exports.definition = {
set: shorthandSetter('border-left', shorthand_for),
get: shorthandGetter('border-left', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

View File

@@ -0,0 +1,21 @@
'use strict';
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,
};

View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

17
node_modules/cssstyle/lib/properties/borderRight.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'border-right-width': require('./borderRightWidth'),
'border-right-style': require('./borderRightStyle'),
'border-right-color': require('./borderRightColor'),
};
module.exports.definition = {
set: shorthandSetter('border-right', shorthand_for),
get: shorthandGetter('border-right', shorthand_for),
enumerable: true,
configurable: true,
};

View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

View File

@@ -0,0 +1,21 @@
'use strict';
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,
};

View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

41
node_modules/cssstyle/lib/properties/borderSpacing.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
'use strict';
var parsers = require('../parsers');
// <length> <length>? | inherit
// if one, it applies to both horizontal and verical spacing
// 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 === 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;
}
});
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,
};

38
node_modules/cssstyle/lib/properties/borderStyle.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use strict';
var implicitSetter = require('../parsers').implicitSetter;
// the valid border-styles:
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);
};
var isValid = module.exports.isValid;
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,
};

17
node_modules/cssstyle/lib/properties/borderTop.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;
var shorthand_for = {
'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,
};

16
node_modules/cssstyle/lib/properties/borderTopColor.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
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,
};

21
node_modules/cssstyle/lib/properties/borderTopStyle.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
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,
};

17
node_modules/cssstyle/lib/properties/borderTopWidth.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
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,
};

46
node_modules/cssstyle/lib/properties/borderWidth.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict';
var parsers = require('../parsers');
var implicitSetter = require('../parsers').implicitSetter;
// the valid border-widths:
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;
}
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;
};
module.exports.definition = {
set: implicitSetter('border', 'width', isValid, parser),
get: function() {
return this.getPropertyValue('border-width');
},
enumerable: true,
configurable: true,
};

14
node_modules/cssstyle/lib/properties/bottom.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
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,
};

16
node_modules/cssstyle/lib/properties/clear.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
var parseKeyword = require('../parsers').parseKeyword;
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,
};

47
node_modules/cssstyle/lib/properties/clip.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
'use strict';
var parseMeasurement = require('../parsers').parseMeasurement;
var shape_regex = /^rect\((.*)\)$/i;
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,
};

14
node_modules/cssstyle/lib/properties/color.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
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,
};

12
node_modules/cssstyle/lib/properties/cssFloat.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,
};

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

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