123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- (function() {
- var add, crispedges, feature, flexbox, gradients, logicalProps, prefix, resolution, result, sort,
- slice = [].slice;
-
- sort = function(array) {
- return array.sort(function(a, b) {
- var d;
- a = a.split(' ');
- b = b.split(' ');
- if (a[0] > b[0]) {
- return 1;
- } else if (a[0] < b[0]) {
- return -1;
- } else {
- d = parseFloat(a[1]) - parseFloat(b[1]);
- if (d > 0) {
- return 1;
- } else if (d < 0) {
- return -1;
- } else {
- return 0;
- }
- }
- });
- };
-
- feature = function(data, opts, callback) {
- var browser, match, need, ref, ref1, support, version, versions;
- if (!callback) {
- ref = [opts, {}], callback = ref[0], opts = ref[1];
- }
- match = opts.match || /\sx($|\s)/;
- need = [];
- ref1 = data.stats;
- for (browser in ref1) {
- versions = ref1[browser];
- for (version in versions) {
- support = versions[version];
- if (support.match(match)) {
- need.push(browser + ' ' + version);
- }
- }
- }
- return callback(sort(need));
- };
-
- result = {};
-
- prefix = function() {
- var data, i, j, k, len, name, names, results;
- names = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), data = arguments[j++];
- results = [];
- for (k = 0, len = names.length; k < len; k++) {
- name = names[k];
- result[name] = {};
- results.push((function() {
- var results1;
- results1 = [];
- for (i in data) {
- results1.push(result[name][i] = data[i]);
- }
- return results1;
- })());
- }
- return results;
- };
-
- add = function() {
- var data, j, k, len, name, names, results;
- names = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), data = arguments[j++];
- results = [];
- for (k = 0, len = names.length; k < len; k++) {
- name = names[k];
- results.push(result[name].browsers = sort(result[name].browsers.concat(data.browsers)));
- }
- return results;
- };
-
- module.exports = result;
-
- feature(require('caniuse-db/features-json/border-radius'), function(browsers) {
- return prefix('border-radius', 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', {
- mistakes: ['-ms-', '-o-'],
- transition: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-boxshadow'), function(browsers) {
- return prefix('box-shadow', {
- transition: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-animation'), function(browsers) {
- return prefix('animation', 'animation-name', 'animation-duration', 'animation-delay', 'animation-direction', 'animation-fill-mode', 'animation-iteration-count', 'animation-play-state', 'animation-timing-function', '@keyframes', {
- mistakes: ['-ms-'],
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-transitions'), function(browsers) {
- return prefix('transition', 'transition-property', 'transition-duration', 'transition-delay', 'transition-timing-function', {
- mistakes: ['-ms-'],
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/transforms2d'), function(browsers) {
- return prefix('transform', 'transform-origin', {
- transition: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/transforms3d'), function(browsers) {
- prefix('perspective', 'perspective-origin', {
- transition: true,
- browsers: browsers
- });
- return prefix('transform-style', 'backface-visibility', {
- browsers: browsers
- });
- });
-
- gradients = require('caniuse-db/features-json/css-gradients');
-
- feature(gradients, {
- match: /y\sx/
- }, function(browsers) {
- return prefix('linear-gradient', 'repeating-linear-gradient', 'radial-gradient', 'repeating-radial-gradient', {
- props: ['background', 'background-image', 'border-image', 'list-style', 'list-style-image', 'content', 'mask-image', 'mask'],
- mistakes: ['-ms-'],
- browsers: browsers
- });
- });
-
- feature(gradients, {
- match: /a\sx/
- }, function(browsers) {
- browsers = browsers.map(function(i) {
- if (/op/.test(i)) {
- return i;
- } else {
- return i + " old";
- }
- });
- return add('linear-gradient', 'repeating-linear-gradient', 'radial-gradient', 'repeating-radial-gradient', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css3-boxsizing'), function(browsers) {
- return prefix('box-sizing', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-filters'), function(browsers) {
- return prefix('filter', {
- transition: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/multicolumn'), function(browsers) {
- prefix('columns', 'column-width', 'column-gap', 'column-rule', 'column-rule-color', 'column-rule-width', {
- transition: true,
- browsers: browsers
- });
- return prefix('column-count', 'column-rule-style', 'column-span', 'column-fill', 'break-before', 'break-after', 'break-inside', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/user-select-none'), function(browsers) {
- return prefix('user-select', {
- browsers: browsers
- });
- });
-
- flexbox = require('caniuse-db/features-json/flexbox');
-
- feature(flexbox, {
- match: /a\sx/
- }, function(browsers) {
- browsers = browsers.map(function(i) {
- if (/ie|firefox/.test(i)) {
- return i;
- } else {
- return i + " 2009";
- }
- });
- prefix('display-flex', 'inline-flex', {
- props: ['display'],
- browsers: browsers
- });
- prefix('flex', 'flex-grow', 'flex-shrink', 'flex-basis', {
- transition: true,
- browsers: browsers
- });
- return prefix('flex-direction', 'flex-wrap', 'flex-flow', 'justify-content', 'order', 'align-items', 'align-self', 'align-content', {
- browsers: browsers
- });
- });
-
- feature(flexbox, {
- match: /y\sx/
- }, function(browsers) {
- add('display-flex', 'inline-flex', {
- browsers: browsers
- });
- add('flex', 'flex-grow', 'flex-shrink', 'flex-basis', {
- browsers: browsers
- });
- return add('flex-direction', 'flex-wrap', 'flex-flow', 'justify-content', 'order', 'align-items', 'align-self', 'align-content', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/calc'), function(browsers) {
- return prefix('calc', {
- props: ['*'],
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/background-img-opts'), function(browsers) {
- return prefix('background-clip', 'background-origin', 'background-size', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/font-feature'), function(browsers) {
- return prefix('font-feature-settings', 'font-variant-ligatures', 'font-language-override', 'font-kerning', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/border-image'), function(browsers) {
- return prefix('border-image', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-selection'), function(browsers) {
- return prefix('::selection', {
- selector: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-placeholder'), function(browsers) {
- browsers = browsers.map(function(i) {
- var name, ref, version;
- ref = i.split(' '), name = ref[0], version = ref[1];
- if (name === 'firefox' && parseFloat(version) <= 18) {
- return i + ' old';
- } else {
- return i;
- }
- });
- return prefix('::placeholder', {
- selector: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-hyphens'), function(browsers) {
- return prefix('hyphens', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/fullscreen'), function(browsers) {
- return prefix(':fullscreen', {
- selector: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css3-tabsize'), function(browsers) {
- return prefix('tab-size', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/intrinsic-width'), function(browsers) {
- return prefix('max-content', 'min-content', 'fit-content', 'fill-available', {
- props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height'],
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css3-cursors-newer'), function(browsers) {
- prefix('zoom-in', 'zoom-out', {
- props: ['cursor'],
- browsers: browsers.concat(['chrome 3'])
- });
- return prefix('grab', 'grabbing', {
- props: ['cursor'],
- browsers: browsers.concat(['firefox 24', 'firefox 25', 'firefox 26'])
- });
- });
-
- feature(require('caniuse-db/features-json/css-sticky'), function(browsers) {
- return prefix('sticky', {
- props: ['position'],
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/pointer'), function(browsers) {
- return prefix('touch-action', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/text-decoration'), function(browsers) {
- return prefix('text-decoration-style', 'text-decoration-line', 'text-decoration-color', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/text-size-adjust'), function(browsers) {
- return prefix('text-size-adjust', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-masks'), function(browsers) {
- prefix('mask-clip', 'mask-composite', 'mask-image', 'mask-origin', 'mask-repeat', {
- browsers: browsers
- });
- return prefix('clip-path', 'mask', 'mask-position', 'mask-size', {
- transition: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-boxdecorationbreak'), function(brwsrs) {
- return prefix('box-decoration-break', {
- browsers: brwsrs
- });
- });
-
- feature(require('caniuse-db/features-json/object-fit'), function(browsers) {
- return prefix('object-fit', 'object-position', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-shapes'), function(browsers) {
- return prefix('shape-margin', 'shape-outside', 'shape-image-threshold', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/text-overflow'), function(browsers) {
- return prefix('text-overflow', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/text-emphasis'), function(browsers) {
- return prefix('text-emphasis', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-deviceadaptation'), function(browsers) {
- return prefix('@viewport', {
- browsers: browsers
- });
- });
-
- resolution = require('caniuse-db/features-json/css-media-resolution');
-
- feature(resolution, {
- match: /( x($| )|a #3)/
- }, function(browsers) {
- return prefix('@resolution', {
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-text-align-last'), function(browsers) {
- return prefix('text-align-last', {
- browsers: browsers
- });
- });
-
- crispedges = require('caniuse-db/features-json/css-crisp-edges');
-
- feature(crispedges, {
- match: /y x/
- }, function(browsers) {
- return prefix('pixelated', {
- props: ['image-rendering'],
- browsers: browsers
- });
- });
-
- feature(crispedges, {
- match: /a x #2/
- }, function(browsers) {
- return prefix('image-rendering', {
- browsers: browsers
- });
- });
-
- logicalProps = require('caniuse-db/features-json/css-logical-props');
-
- feature(logicalProps, function(browsers) {
- return prefix('border-inline-start', 'border-inline-end', 'margin-inline-start', 'margin-inline-end', 'padding-inline-start', 'padding-inline-end', {
- transition: true,
- browsers: browsers
- });
- });
-
- feature(logicalProps, {
- match: /x\s#2/
- }, function(browsers) {
- return prefix('border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', {
- transition: true,
- browsers: browsers
- });
- });
-
- feature(require('caniuse-db/features-json/css-appearance'), function(browsers) {
- return prefix('appearance', {
- browsers: browsers
- });
- });
-
- }).call(this);
|