This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,47 @@
import prefixProperty from './utils/prefixProperty';
import prefixValue from './utils/prefixValue';
import addNewValuesOnly from './utils/addNewValuesOnly';
import isObject from './utils/isObject';
export default function createPrefixer(_ref) {
var prefixMap = _ref.prefixMap,
plugins = _ref.plugins;
return function prefix(style) {
for (var property in style) {
var value = style[property];
// handle nested objects
if (isObject(value)) {
style[property] = prefix(value);
// handle array values
} else if (Array.isArray(value)) {
var combinedValue = [];
for (var i = 0, len = value.length; i < len; ++i) {
var processedValue = prefixValue(plugins, property, value[i], style, prefixMap);
addNewValuesOnly(combinedValue, processedValue || value[i]);
}
// only modify the value if it was touched
// by any plugin to prevent unnecessary mutations
if (combinedValue.length > 0) {
style[property] = combinedValue;
}
} else {
var _processedValue = prefixValue(plugins, property, value, style, prefixMap);
// only modify the value if it was touched
// by any plugin to prevent unnecessary mutations
if (_processedValue) {
style[property] = _processedValue;
}
style = prefixProperty(prefixMap, property, style);
}
}
return style;
};
}

12
node_modules/inline-style-prefixer/es/data.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
var w = ["Webkit"];
var m = ["Moz"];
var ms = ["ms"];
var wm = ["Webkit", "Moz"];
var wms = ["Webkit", "ms"];
var wmms = ["Webkit", "Moz", "ms"];
export default {
plugins: [],
prefixMap: { "appearance": wm, "textEmphasisPosition": w, "textEmphasis": w, "textEmphasisStyle": w, "textEmphasisColor": w, "boxDecorationBreak": w, "maskImage": w, "maskMode": w, "maskRepeat": w, "maskPosition": w, "maskClip": w, "maskOrigin": w, "maskSize": w, "maskComposite": w, "mask": w, "maskBorderSource": w, "maskBorderMode": w, "maskBorderSlice": w, "maskBorderWidth": w, "maskBorderOutset": w, "maskBorderRepeat": w, "maskBorder": w, "maskType": w, "textDecorationStyle": w, "textDecorationSkip": w, "textDecorationLine": w, "textDecorationColor": w, "userSelect": wmms, "backdropFilter": w, "fontKerning": w, "scrollSnapType": wms, "scrollSnapPointsX": wms, "scrollSnapPointsY": wms, "scrollSnapDestination": wms, "scrollSnapCoordinate": wms, "clipPath": w, "shapeImageThreshold": w, "shapeImageMargin": w, "shapeImageOutside": w, "filter": w, "hyphens": wms, "flowInto": wms, "flowFrom": wms, "breakBefore": wms, "breakAfter": wms, "breakInside": wms, "regionFragment": wms, "writingMode": wms, "textOrientation": w, "tabSize": m, "fontFeatureSettings": w, "columnCount": w, "columnFill": w, "columnGap": w, "columnRule": w, "columnRuleColor": w, "columnRuleStyle": w, "columnRuleWidth": w, "columns": w, "columnSpan": w, "columnWidth": w, "wrapFlow": ms, "wrapThrough": ms, "wrapMargin": ms, "textSizeAdjust": wms }
};

View File

@ -0,0 +1,21 @@
import pluginMap from './maps/pluginMap';
export default function getRecommendedPlugins(browserList) {
var recommendedPlugins = {};
for (var plugin in pluginMap) {
var browserSupportByPlugin = pluginMap[plugin];
for (var browser in browserSupportByPlugin) {
if (browserList.hasOwnProperty(browser)) {
var browserVersion = browserSupportByPlugin[browser];
if (browserList[browser] < browserVersion) {
recommendedPlugins[plugin] = true;
}
}
}
}
return Object.keys(recommendedPlugins);
}

View File

@ -0,0 +1,76 @@
import { getSupport } from 'caniuse-api';
import propertyMap from './maps/propertyMap';
var prefixBrowserMap = {
chrome: 'Webkit',
safari: 'Webkit',
firefox: 'Moz',
opera: 'Webkit',
ie: 'ms',
edge: 'ms',
ios_saf: 'Webkit',
android: 'Webkit',
and_chr: 'Webkit',
and_uc: 'Webkit',
op_mini: 'Webkit',
ie_mob: 'ms'
// remove flexprops from IE
};var flexPropsIE = ['alignContent', 'alignSelf', 'alignItems', 'justifyContent', 'order', 'flexGrow', 'flexShrink', 'flexBasis'];
function filterAndRemoveIfEmpty(map, property, filter) {
if (map[property]) {
map[property] = map[property].filter(filter);
if (map[property].length === 0) {
delete map[property];
}
}
}
export default function generatePrefixMap(browserList) {
var prefixMap = {};
for (var browser in prefixBrowserMap) {
var prefix = prefixBrowserMap[browser];
for (var keyword in propertyMap) {
var keywordProperties = [].concat(propertyMap[keyword]);
var versions = getSupport(keyword);
for (var i = 0, len = keywordProperties.length; i < len; ++i) {
if (versions[browser].x >= browserList[browser]) {
var property = keywordProperties[i];
if (!prefixMap[property]) {
prefixMap[property] = [];
}
if (prefixMap[property].indexOf(prefix) === -1) {
prefixMap[property].push(prefix);
}
}
}
}
}
// remove flexProps from IE and Firefox due to alternative syntax
for (var _i = 0, _len = flexPropsIE.length; _i < _len; ++_i) {
filterAndRemoveIfEmpty(prefixMap, flexPropsIE[_i], function (prefix) {
return prefix !== 'ms' && prefix !== 'Moz';
});
}
// remove transition from Moz and Webkit as they are handled
// specially by the transition plugins
filterAndRemoveIfEmpty(prefixMap, 'transition', function (prefix) {
return prefix !== 'Moz' && prefix !== 'Webkit';
});
// remove WebkitFlexDirection as it does not exist
filterAndRemoveIfEmpty(prefixMap, 'flexDirection', function (prefix) {
return prefix !== 'Moz';
});
return prefixMap;
}

View File

@ -0,0 +1,69 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import generatePrefixMap from './generatePrefixMap';
import generatePluginList from './generatePluginList';
function generateImportString(plugin, compatibility) {
if (compatibility) {
return 'var ' + plugin + ' = require(\'inline-style-prefixer/lib/plugins/' + plugin + '\')';
}
return 'import ' + plugin + ' from \'inline-style-prefixer/lib/plugins/' + plugin + '\'';
}
export function generateFile(prefixMap, pluginList, compatibility) {
var pluginImports = pluginList.map(function (plugin) {
return generateImportString(plugin, compatibility);
}).join('\n');
var moduleExporter = compatibility ? 'module.exports = ' : 'export default';
var pluginExport = '[' + pluginList.join(',') + ']';
var prefixMapExport = JSON.stringify(prefixMap);
var prefixVariables = ['var w = ["Webkit"];', 'var m = ["Moz"];', 'var ms = ["ms"];', 'var wm = ["Webkit","Moz"];', 'var wms = ["Webkit","ms"];', 'var wmms = ["Webkit","Moz","ms"];'].join('\n');
return pluginImports + '\n' + prefixVariables + '\n\n' + moduleExporter + ' {\n plugins: ' + pluginExport + ',\n prefixMap: ' + prefixMapExport.replace(/\["Webkit"\]/g, 'w').replace(/\["Moz"\]/g, 'm').replace(/\["ms"\]/g, 'ms').replace(/\["Webkit","Moz"\]/g, 'wm').replace(/\["Webkit","ms"\]/g, 'wms').replace(/\["Webkit","Moz","ms"\]/g, 'wmms') + '\n}';
}
function saveFile(fileContent, path) {
/* eslint-disable global-require */
var fs = require('fs');
/* eslint-enable global-require */
fs.writeFile(path, fileContent, function (err) {
if (err) {
throw err;
}
console.log('Successfully saved data to "' + path + '".');
});
}
var defaultOptions = {
prefixMap: true,
plugins: true,
compatibility: false
};
export default function generateData(browserList) {
var userOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var options = _extends({}, defaultOptions, userOptions);
var compatibility = options.compatibility,
plugins = options.plugins,
path = options.path,
prefixMap = options.prefixMap;
var requiredPrefixMap = prefixMap ? generatePrefixMap(browserList) : {};
var requiredPlugins = plugins ? generatePluginList(browserList) : [];
if (path) {
saveFile(generateFile(requiredPrefixMap, requiredPlugins, compatibility), path);
}
return {
prefixMap: requiredPrefixMap,
plugins: requiredPlugins
};
}

View File

@ -0,0 +1,111 @@
// values are "up-to"
var maximumVersion = 9999;
export default {
backgroundClip: {
chrome: maximumVersion,
safari: maximumVersion,
opera: maximumVersion,
and_chr: maximumVersion,
ios_saf: maximumVersion,
edge: maximumVersion,
firefox: maximumVersion,
op_mini: maximumVersion
},
calc: {
firefox: 15,
chrome: 25,
safari: 6.1,
ios_saf: 7
},
crossFade: {
chrome: maximumVersion,
opera: maximumVersion,
and_chr: maximumVersion,
ios_saf: 10,
safari: 10
},
cursor: {
firefox: maximumVersion,
chrome: maximumVersion,
safari: maximumVersion,
opera: maximumVersion
},
filter: {
ios_saf: maximumVersion,
safari: 9.1
},
flex: {
chrome: 29,
safari: 9,
ios_saf: 9,
opera: 16
},
flexboxIE: {
ie_mob: 11,
ie: 11
},
flexboxOld: {
firefox: 22,
chrome: 21,
safari: 6.2,
ios_saf: 6.2,
android: 4.4,
and_uc: maximumVersion
},
gradient: {
firefox: 16,
chrome: 26,
safari: 7,
ios_saf: 7,
opera: 12.1,
op_mini: 12.1,
android: 4.4,
and_uc: maximumVersion
},
grid: {
edge: 16,
ie: 11,
ie_mob: 11
},
imageSet: {
chrome: maximumVersion,
safari: maximumVersion,
opera: maximumVersion,
and_chr: maximumVersion,
and_uc: maximumVersion,
ios_saf: maximumVersion
},
logical: {
chrome: 68,
safari: maximumVersion,
opera: maximumVersion,
and_chr: 66,
ios_saf: maximumVersion,
firefox: 40
},
position: {
safari: maximumVersion,
ios_saf: maximumVersion
},
sizing: {
chrome: 46,
safari: maximumVersion,
opera: 33,
and_chr: 53,
ios_saf: maximumVersion
},
transition: {
chrome: maximumVersion,
safari: maximumVersion,
opera: maximumVersion,
and_chr: maximumVersion,
and_uc: maximumVersion,
ios_saf: maximumVersion,
msie: maximumVersion,
ie_mob: maximumVersion,
edge: maximumVersion,
firefox: maximumVersion,
op_mini: maximumVersion
}
};

View File

@ -0,0 +1,38 @@
export default {
'border-radius': 'borderRadius',
'border-image': ['borderImage', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
flexbox: ['flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexFlow', 'flexShrink', 'flexWrap', 'alignContent', 'alignItems', 'alignSelf', 'justifyContent', 'order'],
'css-transitions': ['transition', 'transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
transforms2d: ['transform', 'transformOrigin', 'transformOriginX', 'transformOriginY'],
transforms3d: ['backfaceVisibility', 'perspective', 'perspectiveOrigin', 'transform', 'transformOrigin', 'transformStyle', 'transformOriginX', 'transformOriginY', 'transformOriginZ'],
'css-animation': ['animation', 'animationDelay', 'animationDirection', 'animationFillMode', 'animationDuration', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
'css-appearance': 'appearance',
'user-select-none': 'userSelect',
'css-backdrop-filter': 'backdropFilter',
'css3-boxsizing': 'boxSizing',
'font-kerning': 'fontKerning',
'css-exclusions': ['wrapFlow', 'wrapThrough', 'wrapMargin'],
'css-snappoints': ['scrollSnapType', 'scrollSnapPointsX', 'scrollSnapPointsY', 'scrollSnapDestination', 'scrollSnapCoordinate'],
'text-emphasis': ['textEmphasisPosition', 'textEmphasis', 'textEmphasisStyle', 'textEmphasisColor'],
'css-text-align-last': 'textAlignLast',
'css-boxdecorationbreak': 'boxDecorationBreak',
'css-clip-path': 'clipPath',
'css-masks': ['maskImage', 'maskMode', 'maskRepeat', 'maskPosition', 'maskClip', 'maskOrigin', 'maskSize', 'maskComposite', 'mask', 'maskBorderSource', 'maskBorderMode', 'maskBorderSlice', 'maskBorderWidth', 'maskBorderOutset', 'maskBorderRepeat', 'maskBorder', 'maskType'],
'css-touch-action': 'touchAction',
'text-size-adjust': 'textSizeAdjust',
'text-decoration': ['textDecorationStyle', 'textDecorationSkip', 'textDecorationLine', 'textDecorationColor'],
'css-shapes': ['shapeImageThreshold', 'shapeImageMargin', 'shapeImageOutside'],
'css3-tabsize': 'tabSize',
'css-filters': 'filter',
'css-resize': 'resize',
'css-hyphens': 'hyphens',
'css-regions': ['flowInto', 'flowFrom', 'breakBefore', 'breakAfter', 'breakInside', 'regionFragment'],
'object-fit': ['objectFit', 'objectPosition'],
'text-overflow': 'textOverflow',
'background-img-opts': ['backgroundClip', 'backgroundOrigin', 'backgroundSize'],
'font-feature': 'fontFeatureSettings',
'css-boxshadow': 'boxShadow',
multicolumn: ['breakAfter', 'breakBefore', 'breakInside', 'columnCount', 'columnFill', 'columnGap', 'columnRule', 'columnRuleColor', 'columnRuleStyle', 'columnRuleWidth', 'columns', 'columnSpan', 'columnWidth', 'columnGap'],
'css-writing-mode': ['writingMode'],
'css-text-orientation': ['textOrientation']
};

26
node_modules/inline-style-prefixer/es/index.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
import createPrefixer from './createPrefixer';
import data from './data';
import backgroundClip from './plugins/backgroundClip';
import cursor from './plugins/cursor';
import crossFade from './plugins/crossFade';
import filter from './plugins/filter';
import flex from './plugins/flex';
import flexboxOld from './plugins/flexboxOld';
import gradient from './plugins/gradient';
import grid from './plugins/grid';
import imageSet from './plugins/imageSet';
import logical from './plugins/logical';
import position from './plugins/position';
import sizing from './plugins/sizing';
import transition from './plugins/transition';
var plugins = [backgroundClip, crossFade, cursor, filter, flexboxOld, gradient, grid, imageSet, logical, position, sizing, transition, flex];
var prefix = createPrefixer({
prefixMap: data.prefixMap,
plugins: plugins
});
export { createPrefixer, prefix };

View File

@ -0,0 +1,7 @@
// https://developer.mozilla.org/en-US/docs/Web/CSS/background-clip#Browser_compatibility
export default function backgroundClip(property, value) {
if (typeof value === 'string' && value === 'text') {
return ['-webkit-text', 'text'];
}
}

11
node_modules/inline-style-prefixer/es/plugins/calc.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue';
var prefixes = ['-webkit-', '-moz-', ''];
export default function calc(property, value) {
if (typeof value === 'string' && !isPrefixedValue(value) && value.indexOf('calc(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/calc\(/g, prefix + 'calc(');
});
}
}

View File

@ -0,0 +1,12 @@
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue';
// http://caniuse.com/#search=cross-fade
var prefixes = ['-webkit-', ''];
export default function crossFade(property, value) {
if (typeof value === 'string' && !isPrefixedValue(value) && value.indexOf('cross-fade(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/cross-fade\(/g, prefix + 'cross-fade(');
});
}
}

View File

@ -0,0 +1,16 @@
var prefixes = ['-webkit-', '-moz-', ''];
var values = {
'zoom-in': true,
'zoom-out': true,
grab: true,
grabbing: true
};
export default function cursor(property, value) {
if (property === 'cursor' && values.hasOwnProperty(value)) {
return prefixes.map(function (prefix) {
return prefix + value;
});
}
}

View File

@ -0,0 +1,12 @@
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue';
// http://caniuse.com/#feat=css-filter-function
var prefixes = ['-webkit-', ''];
export default function filter(property, value) {
if (typeof value === 'string' && !isPrefixedValue(value) && value.indexOf('filter(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/filter\(/g, prefix + 'filter(');
});
}
}

10
node_modules/inline-style-prefixer/es/plugins/flex.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
var values = {
flex: ['-webkit-box', '-moz-box', '-ms-flexbox', '-webkit-flex', 'flex'],
'inline-flex': ['-webkit-inline-box', '-moz-inline-box', '-ms-inline-flexbox', '-webkit-inline-flex', 'inline-flex']
};
export default function flex(property, value) {
if (property === 'display' && values.hasOwnProperty(value)) {
return values[value];
}
}

View File

@ -0,0 +1,67 @@
var alternativeValues = {
'space-around': 'distribute',
'space-between': 'justify',
'flex-start': 'start',
'flex-end': 'end'
};
var alternativeProps = {
alignContent: 'msFlexLinePack',
alignSelf: 'msFlexItemAlign',
alignItems: 'msFlexAlign',
justifyContent: 'msFlexPack',
order: 'msFlexOrder',
flexGrow: 'msFlexPositive',
flexShrink: 'msFlexNegative',
flexBasis: 'msFlexPreferredSize'
// Full expanded syntax is flex-grow | flex-shrink | flex-basis.
};var flexShorthandMappings = {
auto: '1 1 auto',
inherit: 'inherit',
initial: '0 1 auto',
none: '0 0 auto',
unset: 'unset'
};
var isUnitlessNumber = /^\d+(\.\d+)?$/;
export default function flexboxIE(property, value, style) {
if (Object.prototype.hasOwnProperty.call(alternativeProps, property)) {
style[alternativeProps[property]] = alternativeValues[value] || value;
}
if (property === 'flex') {
// For certain values we can do straight mappings based on the spec
// for the expansions.
if (Object.prototype.hasOwnProperty.call(flexShorthandMappings, value)) {
style.msFlex = flexShorthandMappings[value];
return;
}
// Here we have no direct mapping, so we favor looking for a
// unitless positive number as that will be the most common use-case.
if (isUnitlessNumber.test(value)) {
style.msFlex = value + ' 1 0%';
return;
}
// The next thing we can look for is if there are multiple values.
var flexValues = value.split(/\s/);
// If we only have a single value that wasn't a positive unitless
// or a pre-mapped value, then we can assume it is a unit value.
switch (flexValues.length) {
case 1:
style.msFlex = '1 1 ' + value;
return;
case 2:
// If we have 2 units, then we expect that the first will
// always be a unitless number and represents flex-grow.
// The second unit will represent flex-shrink for a unitless
// value, or flex-basis otherwise.
if (isUnitlessNumber.test(flexValues[1])) {
style.msFlex = flexValues[0] + ' ' + flexValues[1] + ' 0%';
} else {
style.msFlex = flexValues[0] + ' 1 ' + flexValues[1];
}
return;
default:
style.msFlex = value;
}
}
}

View File

@ -0,0 +1,33 @@
var alternativeValues = {
'space-around': 'justify',
'space-between': 'justify',
'flex-start': 'start',
'flex-end': 'end',
'wrap-reverse': 'multiple',
wrap: 'multiple'
};
var alternativeProps = {
alignItems: 'WebkitBoxAlign',
justifyContent: 'WebkitBoxPack',
flexWrap: 'WebkitBoxLines',
flexGrow: 'WebkitBoxFlex'
};
export default function flexboxOld(property, value, style) {
if (property === 'flexDirection' && typeof value === 'string') {
if (value.indexOf('column') > -1) {
style.WebkitBoxOrient = 'vertical';
} else {
style.WebkitBoxOrient = 'horizontal';
}
if (value.indexOf('reverse') > -1) {
style.WebkitBoxDirection = 'reverse';
} else {
style.WebkitBoxDirection = 'normal';
}
}
if (alternativeProps.hasOwnProperty(property)) {
style[alternativeProps[property]] = alternativeValues[value] || value;
}
}

View File

@ -0,0 +1,14 @@
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue';
var prefixes = ['-webkit-', '-moz-', ''];
var values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/gi;
export default function gradient(property, value) {
if (typeof value === 'string' && !isPrefixedValue(value) && values.test(value)) {
return prefixes.map(function (prefix) {
return value.replace(values, function (grad) {
return prefix + grad;
});
});
}
}

129
node_modules/inline-style-prefixer/es/plugins/grid.js generated vendored Normal file
View File

@ -0,0 +1,129 @@
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
function isSimplePositionValue(value) {
return typeof value === 'number' && !isNaN(value);
}
function isComplexSpanValue(value) {
return typeof value === 'string' && value.includes('/');
}
var alignmentValues = ['center', 'end', 'start', 'stretch'];
var displayValues = {
'inline-grid': ['-ms-inline-grid', 'inline-grid'],
grid: ['-ms-grid', 'grid']
};
var propertyConverters = {
alignSelf: function alignSelf(value, style) {
if (alignmentValues.indexOf(value) > -1) {
style.msGridRowAlign = value;
}
},
gridColumn: function gridColumn(value, style) {
if (isSimplePositionValue(value)) {
style.msGridColumn = value;
} else if (isComplexSpanValue(value)) {
var _value$split = value.split('/'),
_value$split2 = _slicedToArray(_value$split, 2),
start = _value$split2[0],
end = _value$split2[1];
propertyConverters.gridColumnStart(+start, style);
var _end$split = end.split(/ ?span /),
_end$split2 = _slicedToArray(_end$split, 2),
maybeSpan = _end$split2[0],
maybeNumber = _end$split2[1];
if (maybeSpan === '') {
propertyConverters.gridColumnEnd(+start + +maybeNumber, style);
} else {
propertyConverters.gridColumnEnd(+end, style);
}
} else {
propertyConverters.gridColumnStart(value, style);
}
},
gridColumnEnd: function gridColumnEnd(value, style) {
var msGridColumn = style.msGridColumn;
if (isSimplePositionValue(value) && isSimplePositionValue(msGridColumn)) {
style.msGridColumnSpan = value - msGridColumn;
}
},
gridColumnStart: function gridColumnStart(value, style) {
if (isSimplePositionValue(value)) {
style.msGridColumn = value;
}
},
gridRow: function gridRow(value, style) {
if (isSimplePositionValue(value)) {
style.msGridRow = value;
} else if (isComplexSpanValue(value)) {
var _value$split3 = value.split('/'),
_value$split4 = _slicedToArray(_value$split3, 2),
start = _value$split4[0],
end = _value$split4[1];
propertyConverters.gridRowStart(+start, style);
var _end$split3 = end.split(/ ?span /),
_end$split4 = _slicedToArray(_end$split3, 2),
maybeSpan = _end$split4[0],
maybeNumber = _end$split4[1];
if (maybeSpan === '') {
propertyConverters.gridRowEnd(+start + +maybeNumber, style);
} else {
propertyConverters.gridRowEnd(+end, style);
}
} else {
propertyConverters.gridRowStart(value, style);
}
},
gridRowEnd: function gridRowEnd(value, style) {
var msGridRow = style.msGridRow;
if (isSimplePositionValue(value) && isSimplePositionValue(msGridRow)) {
style.msGridRowSpan = value - msGridRow;
}
},
gridRowStart: function gridRowStart(value, style) {
if (isSimplePositionValue(value)) {
style.msGridRow = value;
}
},
gridTemplateColumns: function gridTemplateColumns(value, style) {
style.msGridColumns = value;
},
gridTemplateRows: function gridTemplateRows(value, style) {
style.msGridRows = value;
},
justifySelf: function justifySelf(value, style) {
if (alignmentValues.indexOf(value) > -1) {
style.msGridColumnAlign = value;
}
}
};
export default function grid(property, value, style) {
if (property === 'display' && value in displayValues) {
return displayValues[value];
}
if (property in propertyConverters) {
var propertyConverter = propertyConverters[property];
propertyConverter(value, style);
}
}

View File

@ -0,0 +1,12 @@
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue';
// http://caniuse.com/#feat=css-image-set
var prefixes = ['-webkit-', ''];
export default function imageSet(property, value) {
if (typeof value === 'string' && !isPrefixedValue(value) && value.indexOf('image-set(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/image-set\(/g, prefix + 'image-set(');
});
}
}

17
node_modules/inline-style-prefixer/es/plugins/index.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
import backgroundClip from './backgroundClip';
import calc from './calc';
import cursor from './cursor';
import crossFade from './crossFade';
import filter from './filter';
import flex from './flex';
import flexboxIE from './flexboxIE';
import flexboxOld from './flexboxOld';
import gradient from './gradient';
import grid from './grid';
import imageSet from './imageSet';
import logical from './logical';
import position from './position';
import sizing from './sizing';
import transition from './transition';
export default [backgroundClip, calc, crossFade, cursor, filter, flex, flexboxIE, flexboxOld, gradient, grid, imageSet, logical, position, sizing, transition];

View File

@ -0,0 +1,35 @@
var alternativeProps = {
marginBlockStart: ['WebkitMarginBefore'],
marginBlockEnd: ['WebkitMarginAfter'],
marginInlineStart: ['WebkitMarginStart', 'MozMarginStart'],
marginInlineEnd: ['WebkitMarginEnd', 'MozMarginEnd'],
paddingBlockStart: ['WebkitPaddingBefore'],
paddingBlockEnd: ['WebkitPaddingAfter'],
paddingInlineStart: ['WebkitPaddingStart', 'MozPaddingStart'],
paddingInlineEnd: ['WebkitPaddingEnd', 'MozPaddingEnd'],
borderBlockStart: ['WebkitBorderBefore'],
borderBlockStartColor: ['WebkitBorderBeforeColor'],
borderBlockStartStyle: ['WebkitBorderBeforeStyle'],
borderBlockStartWidth: ['WebkitBorderBeforeWidth'],
borderBlockEnd: ['WebkitBorderAfter'],
borderBlockEndColor: ['WebkitBorderAfterColor'],
borderBlockEndStyle: ['WebkitBorderAfterStyle'],
borderBlockEndWidth: ['WebkitBorderAfterWidth'],
borderInlineStart: ['WebkitBorderStart', 'MozBorderStart'],
borderInlineStartColor: ['WebkitBorderStartColor', 'MozBorderStartColor'],
borderInlineStartStyle: ['WebkitBorderStartStyle', 'MozBorderStartStyle'],
borderInlineStartWidth: ['WebkitBorderStartWidth', 'MozBorderStartWidth'],
borderInlineEnd: ['WebkitBorderEnd', 'MozBorderEnd'],
borderInlineEndColor: ['WebkitBorderEndColor', 'MozBorderEndColor'],
borderInlineEndStyle: ['WebkitBorderEndStyle', 'MozBorderEndStyle'],
borderInlineEndWidth: ['WebkitBorderEndWidth', 'MozBorderEndWidth']
};
export default function logical(property, value, style) {
if (Object.prototype.hasOwnProperty.call(alternativeProps, property)) {
var alternativePropList = alternativeProps[property];
for (var i = 0, len = alternativePropList.length; i < len; ++i) {
style[alternativePropList[i]] = value;
}
}
}

View File

@ -0,0 +1,5 @@
export default function position(property, value) {
if (property === 'position' && value === 'sticky') {
return ['-webkit-sticky', 'sticky'];
}
}

View File

@ -0,0 +1,26 @@
var prefixes = ['-webkit-', '-moz-', ''];
var properties = {
maxHeight: true,
maxWidth: true,
width: true,
height: true,
columnWidth: true,
minWidth: true,
minHeight: true
};
var values = {
'min-content': true,
'max-content': true,
'fill-available': true,
'fit-content': true,
'contain-floats': true
};
export default function sizing(property, value) {
if (properties.hasOwnProperty(property) && values.hasOwnProperty(value)) {
return prefixes.map(function (prefix) {
return prefix + value;
});
}
}

View File

@ -0,0 +1,75 @@
import hyphenateProperty from 'css-in-js-utils/lib/hyphenateProperty';
import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue';
import capitalizeString from '../utils/capitalizeString';
var properties = {
transition: true,
transitionProperty: true,
WebkitTransition: true,
WebkitTransitionProperty: true,
MozTransition: true,
MozTransitionProperty: true
};
var prefixMapping = {
Webkit: '-webkit-',
Moz: '-moz-',
ms: '-ms-'
};
function prefixValue(value, propertyPrefixMap) {
if (isPrefixedValue(value)) {
return value;
}
// only split multi values, not cubic beziers
var multipleValues = value.split(/,(?![^()]*(?:\([^()]*\))?\))/g);
for (var i = 0, len = multipleValues.length; i < len; ++i) {
var singleValue = multipleValues[i];
var values = [singleValue];
for (var property in propertyPrefixMap) {
var dashCaseProperty = hyphenateProperty(property);
if (singleValue.indexOf(dashCaseProperty) > -1 && dashCaseProperty !== 'order') {
var prefixes = propertyPrefixMap[property];
for (var j = 0, pLen = prefixes.length; j < pLen; ++j) {
// join all prefixes and create a new value
values.unshift(singleValue.replace(dashCaseProperty, prefixMapping[prefixes[j]] + dashCaseProperty));
}
}
}
multipleValues[i] = values.join(',');
}
return multipleValues.join(',');
}
export default function transition(property, value, style, propertyPrefixMap) {
// also check for already prefixed transitions
if (typeof value === 'string' && properties.hasOwnProperty(property)) {
var outputValue = prefixValue(value, propertyPrefixMap);
// if the property is already prefixed
var webkitOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (val) {
return !/-moz-|-ms-/.test(val);
}).join(',');
if (property.indexOf('Webkit') > -1) {
return webkitOutput;
}
var mozOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (val) {
return !/-webkit-|-ms-/.test(val);
}).join(',');
if (property.indexOf('Moz') > -1) {
return mozOutput;
}
style['Webkit' + capitalizeString(property)] = webkitOutput;
style['Moz' + capitalizeString(property)] = mozOutput;
return outputValue;
}
}

View File

@ -0,0 +1,15 @@
function addIfNew(list, value) {
if (list.indexOf(value) === -1) {
list.push(value);
}
}
export default function addNewValuesOnly(list, values) {
if (Array.isArray(values)) {
for (var i = 0, len = values.length; i < len; ++i) {
addIfNew(list, values[i]);
}
} else {
addIfNew(list, values);
}
}

View File

@ -0,0 +1,3 @@
export default function capitalizeString(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}

View File

@ -0,0 +1,3 @@
export default function isObject(value) {
return value instanceof Object && !Array.isArray(value);
}

View File

@ -0,0 +1,22 @@
import capitalizeString from './capitalizeString';
export default function prefixProperty(prefixProperties, property, style) {
if (prefixProperties.hasOwnProperty(property)) {
var newStyle = {};
var requiredPrefixes = prefixProperties[property];
var capitalizedProperty = capitalizeString(property);
var keys = Object.keys(style);
for (var i = 0; i < keys.length; i++) {
var styleProperty = keys[i];
if (styleProperty === property) {
for (var j = 0; j < requiredPrefixes.length; j++) {
newStyle[requiredPrefixes[j] + capitalizedProperty] = style[property];
}
}
newStyle[styleProperty] = style[styleProperty];
}
return newStyle;
}
return style;
}

View File

@ -0,0 +1,11 @@
export default function prefixValue(plugins, property, value, style, metaData) {
for (var i = 0, len = plugins.length; i < len; ++i) {
var processedValue = plugins[i](property, value, style, metaData);
// we can stop processing if a value is returned
// as all plugin criteria are unique
if (processedValue) {
return processedValue;
}
}
}