Commit 9ba09659 9ba0965926adddf638fb046e6d33cbcf2ad8029a by zhanghao

commit

1 parent 13ad2c1f
Showing 1000 changed files with 4913 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
# Installation
> `npm install --save @types/q`
# Summary
This package contains type definitions for Q (https://github.com/kriskowal/q).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/q.
### Additional Details
* Last updated: Fri, 15 May 2020 23:04:11 GMT
* Dependencies: none
* Global values: `Q`
# Credits
These definitions were written by [Barrie Nemetchek](https://github.com/bnemetchek), [Andrew Gaspar](https://github.com/AndrewGaspar), [John Reilly](https://github.com/johnnyreilly), [Michel Boudreau](https://github.com/mboudreau), and [TeamworkGuy2](https://github.com/TeamworkGuy2).
{
"_from": "@types/q@^1.5.1",
"_id": "@types/q@1.5.4",
"_inBundle": false,
"_integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==",
"_location": "/@types/q",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/q@^1.5.1",
"name": "@types/q",
"escapedName": "@types%2fq",
"scope": "@types",
"rawSpec": "^1.5.1",
"saveSpec": null,
"fetchSpec": "^1.5.1"
},
"_requiredBy": [
"/cssnano-preset-default/coa"
],
"_resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz",
"_shasum": "15925414e0ad2cd765bfef58842f7e26a7accb24",
"_spec": "@types/q@^1.5.1",
"_where": "/Users/zhanghao/brcode/br-client/node_modules/cssnano-preset-default/node_modules/coa",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Barrie Nemetchek",
"url": "https://github.com/bnemetchek"
},
{
"name": "Andrew Gaspar",
"url": "https://github.com/AndrewGaspar"
},
{
"name": "John Reilly",
"url": "https://github.com/johnnyreilly"
},
{
"name": "Michel Boudreau",
"url": "https://github.com/mboudreau"
},
{
"name": "TeamworkGuy2",
"url": "https://github.com/TeamworkGuy2"
}
],
"dependencies": {},
"deprecated": false,
"description": "TypeScript definitions for Q",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
"license": "MIT",
"main": "",
"name": "@types/q",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/q"
},
"scripts": {},
"typeScriptVersion": "3.0",
"types": "index.d.ts",
"typesPublisherContentHash": "468c45fb0acfd51599db9fd0186f40568f238a731e9d591452de2c66ac244221",
"version": "1.5.4"
}
# This is the official list of Autoprefixer authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control or
# https://github.com/postcss/autoprefixer/graphs/contributors
#
# Authors who wish to be recognized in this file should add themselves (or
# their employer, as appropriate).
Aaron <me@aaron.md>
Adam Lynch <contact@adamlynch.ie>
Adonis K <aklp08@gmail.com>
Adriaan <https://github.com/harianus>
Aleksei Androsov <aandrosov@yandex-team.ru>
Aleksey Shvayka <shvaikalesh@gmail.com>
Aleks Hudochenkov <aleks@hudochenkov.com>
Alexey Komarov <alex7kom@gmail.com>
Alexey Plutalov <demiazz.py@gmail.com>
Anders Olsen Sandvik <https://github.com/Andersos>
Andreas Haller <Andreas.Haller@invision.de>
Andreas Lind <andreas@one.com>
Andrew Rhoads <andrew.c.rhoads@gmail.com
Andrey Deryabin <deriabin@gmail.com>
Andrey Sitnik <andrey@sitnik.ru>
Andrey Taritsyn <taritsyn@gmail.com>
Andy Trevorah <a.trevorah@gmail.com>
Anton Khlynovskiy <subzey@gmail.com>
Artem Yavorsky <info@yavorsky.org>
aruseni <aruseni.magiku@gmail.com>
Ben Briggs <beneb.info@gmail.com>
bernig <https://github.com/bernig>
Bogdan Chadkin <trysound@yandex.ru>
brainopia <brainopia@evilmartians.com>
Brandon Mathis <brandon@imathis.com>
Chad von Nau <chad@vonnau.com>
Chi Vinh Le <vinh@wikiwi.io>
Cory House <housecor@gmail.com>
Cory Simmons <cory@mojotech.com>
Craig Martin <https://github.com/craigmichaelmartin>
Damon <motoxer4533@gmail.com>
Daniel Garcia-Carrillo <garciacarrillo.daniel@gmail.com>
Daniel Tschinder <daniel@tschinder.de>
Danny Pule <kojikusan@gmail.com>
Darius
David Narbutovich <vamnemne@gmail.com>
David Pike <david@evolution7.com.au>
Denis Sokolov <denis@sokolov.cc>
Dominik Porada <dominik@porada.co>
Dominik Schilling <dominikschilling+git@gmail.com>
dotch <ch.weiss@hotmail.de>
Dmitry Semigradsky <semigradskyd@gmail.com>
Efremov Alexey <lexich121@gmail.com>
eitanr <eitanr@wix.com>
Erik Sundahl <esundahl@gmail.com>
Eugene Datsky <eugene@datsky.ru>
Evgeny Petukhov <petukhov.yevgeny@gmail.com>
Evilebot Tnawi <sheo13666q@gmail.com>
Fangzhou Li <riophaelee@gmail.com>
Forrest York <https://github.com/badisa>
Google Inc.
Gregory Eremin <magnolia_fan@me.com>
GU Yiling <justice360@gmail.com>
Hallvord R. M. Steen <hallvord@hallvord.com>
heady <https://github.com/heady>
Iain Beeston <iain.beeston@gmail.com>
Igor Adamenko <https://github.com/igoradamenko>
Jack Moore <hello@jacklmoore.com>
Jason Kuhrt <jasonkuhrt@me.com>
Jeff Escalante <hello@jenius.me>
Joan León <joan.leon@gmail.com>
Johannes J. Schmidt <schmidt@netzmerk.com>
John Kreitlow <jkreitlow@deepfocus.net>
Jonathan Ong <jonathanrichardong@gmail.com>
Josh Gillies <github@joshgilli.es>
Junliang Huang
jvdanilo <jvdanilo@gmail.com>
Kevin Pfefferle <kevin@rebaseinteractive.com>
Kieran <Kieranju@gmail.com>
Kir Shatrov <shatrov@me.com>
Kiwi <vinh@wikiwi.io>
kizu <kizmarh@gmail.com>
Leonya Khachaturov <leonidkhachaturov@gmail.com>
Lovchikov Anton <besyanya@yandex.ru>
L.T <ec.huyinghuan@gmail.com>
Lucas Caton <lucascaton@gmail.com>
Luciano Battagliero <lucianobattagliero+git@gmail.com>
Luke Page <luke.a.page@gmail.com>
martco <martco@gmail.com>
Matt Smith <runner_28@hotmail.com>
Maxime Thirouin <m@moox.io>
Max Mechanic <max@philo.com>
Michael Beil <michaelbeil@me.com>
Michael Scott Hertzberg <mshertzberg@gmail.com>
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mikael Jorhult <mikael@jorhult.se>
Morton Fox <github@qslw.com>
mvasilkov <mvasilkov@gmail.com>
Nick Howes <nick@nickhowes.co.uk>
Nick Marchenko <n30n1ck@gmail.com>
Nick Schonning <nschonni@gmail.com>
nickspielgist <dev@nickspiel.me>
Niels Dequeker <niels.dequeker@gmail.com>
Nikolay Burlov <kohgpat@gmail.com>
Oleksandr Sergiienko <sigerello@gmail.com>
Pavel Pustovalov <pustovalov.pavel@gmail.com>
Paul Statezny <Paulstatezny@gmail.com>
Peter van Westen <info@regularlabs.com>
Peter Zotov <whitequark@whitequark.org>
Phil Dokas <phil@jetless.org>
Rafael Silva <rafael@rafaelsilva.net>
Ray Lehnhoff <raymond.lehnhoff@gmail.com>
ReadmeCritic <frankensteinbot@gmail.com>
Reinaldo Schiehll <rn.schiehll@gmail.com>
René Stalder <rene@whatwedo.ch>
Richard Wang <richardwa@google.com>
Rob Howell <rob@robhowell.com>
Roland Warmerdam <rowno@webspirited.com>
Roman Dvornov <rdvornov@gmail.com>
Ryan Zimmerman
Sami Suo-Heikki <suoheikki.sami@gmail.com>
Sasha Koss <koss@nocorp.me>
Sean Anderson <Sean.Palmer.Anderson@gmail.com>
Sergey Belov <peimei@ya.ru>
Sergey Leschina <mail@putnik.ws>
sethjgore <sethjgore@gmail.com>
Šime Vidas <sime.vidas@gmail.com>
Simon Lydell <simon.lydell@gmail.com>
Sindre Sorhus <sindresorhus@gmail.com>
Stephen Edgar <stephen@netweb.com.au>
Steve Mao <https://github.com/stevemao>
Stig Otnes Kolstad <stig@stigok.net>
Subash Pathak <sbspk@msn.com>
sunhao <sunhao_1988@msn.cn>
tomdavenport <playmusic@me.com>
Tony Ganch <tonyganch@gmail.com>
Vegard Andreas Larsen <vegard@xaltra.net>
Vera Surkova <vera@surkova.se>
Vincent De Oliveira <vincent@iamvdo.me>
Vishnu Ravi <vishnu@vishnu.io>
Vladimir Pouzanov <farcaller@gmail.com>
vladkens <vladkens@yandex.ru>
Yet Another Minion <yam@thinkalexandria.com>
Даниил Пронин <mail@grawl.ru>
一丝 <jie.lijie@alibaba-inc.com>
刘祺 <gucong@gmail.com>
忆初 <baby@justjavac.com>
The MIT License (MIT)
Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#!/usr/bin/env node
process.stdout.write(require('../')().info() + '\n');
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Prefixer = require('./prefixer');
var AtRule = function (_Prefixer) {
_inherits(AtRule, _Prefixer);
function AtRule() {
_classCallCheck(this, AtRule);
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
/**
* Clone and add prefixes for at-rule
*/
AtRule.prototype.add = function add(rule, prefix) {
var prefixed = prefix + rule.name;
var already = rule.parent.some(function (i) {
return i.name === prefixed && i.params === rule.params;
});
if (already) {
return undefined;
}
var cloned = this.clone(rule, { name: prefixed });
return rule.parent.insertBefore(rule, cloned);
};
/**
* Clone node with prefixes
*/
AtRule.prototype.process = function process(node) {
var parent = this.parentPrefix(node);
for (var _iterator = this.prefixes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prefix = _ref;
if (!parent || parent === prefix) {
this.add(node, prefix);
}
}
};
return AtRule;
}(Prefixer);
module.exports = AtRule;
\ No newline at end of file
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var browserslist = require('browserslist');
var postcss = require('postcss');
var Browsers = require('./browsers');
var Prefixes = require('./prefixes');
function isPlainObject(obj) {
return Object.prototype.toString.apply(obj) === '[object Object]';
}
var cache = {};
function timeCapsule(result, prefixes) {
if (prefixes.browsers.selected.length === 0) {
return;
}
if (prefixes.add.selectors.length > 0) {
return;
}
if (Object.keys(prefixes.add).length > 2) {
return;
}
/* istanbul ignore next */
result.warn('Greetings, time traveller. ' + 'We are in the golden age of prefix-less CSS, ' + 'where Autoprefixer is no longer needed for your stylesheet.');
}
module.exports = postcss.plugin('autoprefixer', function () {
for (var _len = arguments.length, reqs = Array(_len), _key = 0; _key < _len; _key++) {
reqs[_key] = arguments[_key];
}
var options = void 0;
if (reqs.length === 1 && isPlainObject(reqs[0])) {
options = reqs[0];
reqs = undefined;
} else if (reqs.length === 0 || reqs.length === 1 && !reqs[0]) {
reqs = undefined;
} else if (reqs.length <= 2 && (reqs[0] instanceof Array || !reqs[0])) {
options = reqs[1];
reqs = reqs[0];
} else if (_typeof(reqs[reqs.length - 1]) === 'object') {
options = reqs.pop();
}
if (!options) {
options = {};
}
if (options.browser) {
throw new Error('Change `browser` option to `browsers` in Autoprefixer');
} else if (options.browserslist) {
throw new Error('Change `browserslist` option to `browsers` in Autoprefixer');
}
if (options.browsers) {
reqs = options.browsers;
}
if (typeof options.grid === 'undefined') {
options.grid = false;
}
var loadPrefixes = function loadPrefixes(opts) {
var data = module.exports.data;
var browsers = new Browsers(data.browsers, reqs, opts, options.stats);
var key = browsers.selected.join(', ') + JSON.stringify(options);
if (!cache[key]) {
cache[key] = new Prefixes(data.prefixes, browsers, options);
}
return cache[key];
};
var plugin = function plugin(css, result) {
var prefixes = loadPrefixes({
from: css.source && css.source.input.file,
env: options.env
});
timeCapsule(result, prefixes);
if (options.remove !== false) {
prefixes.processor.remove(css, result);
}
if (options.add !== false) {
prefixes.processor.add(css, result);
}
};
plugin.options = options;
plugin.browsers = reqs;
plugin.info = function (opts) {
opts = opts || {};
opts.from = opts.from || process.cwd();
return require('./info')(loadPrefixes(opts));
};
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: require('caniuse-lite').agents,
prefixes: require('../data/prefixes')
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
};
\ No newline at end of file
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var last = function last(array) {
return array[array.length - 1];
};
var brackets = {
/**
* Parse string to nodes tree
*/
parse: function parse(str) {
var current = [''];
var stack = [current];
for (var i = 0; i < str.length; i++) {
var sym = str[i];
if (sym === '(') {
current = [''];
last(stack).push(current);
stack.push(current);
continue;
}
if (sym === ')') {
stack.pop();
current = last(stack);
current.push('');
continue;
}
current[current.length - 1] += sym;
}
return stack[0];
},
/**
* Generate output string by nodes tree
*/
stringify: function stringify(ast) {
var result = '';
for (var _iterator = ast, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var i = _ref;
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object') {
result += '(' + brackets.stringify(i) + ')';
continue;
}
result += i;
}
return result;
}
};
module.exports = brackets;
\ No newline at end of file
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var browserslist = require('browserslist');
var utils = require('./utils');
var Browsers = function () {
/**
* Return all prefixes for default browser data
*/
Browsers.prefixes = function prefixes() {
if (this.prefixesCache) {
return this.prefixesCache;
}
var data = require('caniuse-lite').agents;
this.prefixesCache = [];
for (var name in data) {
this.prefixesCache.push('-' + data[name].prefix + '-');
}
this.prefixesCache = utils.uniq(this.prefixesCache).sort(function (a, b) {
return b.length - a.length;
});
return this.prefixesCache;
};
/**
* Check is value contain any possibe prefix
*/
Browsers.withPrefix = function withPrefix(value) {
if (!this.prefixesRegexp) {
this.prefixesRegexp = new RegExp(this.prefixes().join('|'));
}
return this.prefixesRegexp.test(value);
};
function Browsers(data, requirements, options, stats) {
_classCallCheck(this, Browsers);
this.data = data;
this.options = options || {};
this.stats = stats;
this.selected = this.parse(requirements);
}
/**
* Return browsers selected by requirements
*/
Browsers.prototype.parse = function parse(requirements) {
return browserslist(requirements, {
stats: this.stats,
path: this.options.from,
env: this.options.env
});
};
/**
* Return prefix for selected browser
*/
Browsers.prototype.prefix = function prefix(browser) {
var _browser$split = browser.split(' '),
name = _browser$split[0],
version = _browser$split[1];
var data = this.data[name];
var prefix = data.prefix_exceptions && data.prefix_exceptions[version];
if (!prefix) {
prefix = data.prefix;
}
return '-' + prefix + '-';
};
/**
* Is browser is selected by requirements
*/
Browsers.prototype.isSelected = function isSelected(browser) {
return this.selected.indexOf(browser) !== -1;
};
return Browsers;
}();
module.exports = Browsers;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Prefixer = require('./prefixer');
var Browsers = require('./browsers');
var utils = require('./utils');
var Declaration = function (_Prefixer) {
_inherits(Declaration, _Prefixer);
function Declaration() {
_classCallCheck(this, Declaration);
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
/**
* Always true, because we already get prefixer by property name
*/
Declaration.prototype.check = function check() /* decl */{
return true;
};
/**
* Return prefixed version of property
*/
Declaration.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + prop;
};
/**
* Return unprefixed version of property
*/
Declaration.prototype.normalize = function normalize(prop) {
return prop;
};
/**
* Check `value`, that it contain other prefixes, rather than `prefix`
*/
Declaration.prototype.otherPrefixes = function otherPrefixes(value, prefix) {
for (var _iterator = Browsers.prefixes(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var other = _ref;
if (other === prefix) {
continue;
}
if (value.indexOf(other) !== -1) {
return true;
}
}
return false;
};
/**
* Set prefix to declaration
*/
Declaration.prototype.set = function set(decl, prefix) {
decl.prop = this.prefixed(decl.prop, prefix);
return decl;
};
/**
* Should we use visual cascade for prefixes
*/
Declaration.prototype.needCascade = function needCascade(decl) {
if (!decl._autoprefixerCascade) {
decl._autoprefixerCascade = this.all.options.cascade !== false && decl.raw('before').indexOf('\n') !== -1;
}
return decl._autoprefixerCascade;
};
/**
* Return maximum length of possible prefixed property
*/
Declaration.prototype.maxPrefixed = function maxPrefixed(prefixes, decl) {
if (decl._autoprefixerMax) {
return decl._autoprefixerMax;
}
var max = 0;
for (var _iterator2 = prefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var prefix = _ref2;
prefix = utils.removeNote(prefix);
if (prefix.length > max) {
max = prefix.length;
}
}
decl._autoprefixerMax = max;
return decl._autoprefixerMax;
};
/**
* Calculate indentation to create visual cascade
*/
Declaration.prototype.calcBefore = function calcBefore(prefixes, decl) {
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var max = this.maxPrefixed(prefixes, decl);
var diff = max - utils.removeNote(prefix).length;
var before = decl.raw('before');
if (diff > 0) {
before += Array(diff).fill(' ').join('');
}
return before;
};
/**
* Remove visual cascade
*/
Declaration.prototype.restoreBefore = function restoreBefore(decl) {
var lines = decl.raw('before').split('\n');
var min = lines[lines.length - 1];
this.all.group(decl).up(function (prefixed) {
var array = prefixed.raw('before').split('\n');
var last = array[array.length - 1];
if (last.length < min.length) {
min = last;
}
});
lines[lines.length - 1] = min;
decl.raws.before = lines.join('\n');
};
/**
* Clone and insert new declaration
*/
Declaration.prototype.insert = function insert(decl, prefix, prefixes) {
var cloned = this.set(this.clone(decl), prefix);
if (!cloned) return undefined;
var already = decl.parent.some(function (i) {
return i.prop === cloned.prop && i.value === cloned.value;
});
if (already) {
return undefined;
}
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return decl.parent.insertBefore(decl, cloned);
};
/**
* Did this declaration has this prefix above
*/
Declaration.prototype.isAlready = function isAlready(decl, prefixed) {
var already = this.all.group(decl).up(function (i) {
return i.prop === prefixed;
});
if (!already) {
already = this.all.group(decl).down(function (i) {
return i.prop === prefixed;
});
}
return already;
};
/**
* Clone and add prefixes for declaration
*/
Declaration.prototype.add = function add(decl, prefix, prefixes, result) {
var prefixed = this.prefixed(decl.prop, prefix);
if (this.isAlready(decl, prefixed) || this.otherPrefixes(decl.value, prefix)) {
return undefined;
}
return this.insert(decl, prefix, prefixes, result);
};
/**
* Add spaces for visual cascade
*/
Declaration.prototype.process = function process(decl, result) {
if (!this.needCascade(decl)) {
_Prefixer.prototype.process.call(this, decl, result);
return;
}
var prefixes = _Prefixer.prototype.process.call(this, decl, result);
if (!prefixes || !prefixes.length) {
return;
}
this.restoreBefore(decl);
decl.raws.before = this.calcBefore(prefixes, decl);
};
/**
* Return list of prefixed properties to clean old prefixes
*/
Declaration.prototype.old = function old(prop, prefix) {
return [this.prefixed(prop, prefix)];
};
return Declaration;
}(Prefixer);
module.exports = Declaration;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignContent = function (_Declaration) {
_inherits(AlignContent, _Declaration);
function AlignContent() {
_classCallCheck(this, AlignContent);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for 2012 spec
*/
AlignContent.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-line-pack';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return property name by final spec
*/
AlignContent.prototype.normalize = function normalize() {
return 'align-content';
};
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
AlignContent.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
decl.value = AlignContent.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return AlignContent;
}(Declaration);
Object.defineProperty(AlignContent, 'names', {
enumerable: true,
writable: true,
value: ['align-content', 'flex-line-pack']
});
Object.defineProperty(AlignContent, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
}
});
module.exports = AlignContent;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignItems = function (_Declaration) {
_inherits(AlignItems, _Declaration);
function AlignItems() {
_classCallCheck(this, AlignItems);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for 2009 and 2012 specs
*/
AlignItems.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-align';
} else if (spec === 2012) {
return prefix + 'flex-align';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return property name by final spec
*/
AlignItems.prototype.normalize = function normalize() {
return 'align-items';
};
/**
* Change value for 2009 and 2012 specs
*/
AlignItems.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009 || spec === 2012) {
decl.value = AlignItems.oldValues[decl.value] || decl.value;
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return AlignItems;
}(Declaration);
Object.defineProperty(AlignItems, 'names', {
enumerable: true,
writable: true,
value: ['align-items', 'flex-align', 'box-align']
});
Object.defineProperty(AlignItems, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start'
}
});
module.exports = AlignItems;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignSelf = function (_Declaration) {
_inherits(AlignSelf, _Declaration);
function AlignSelf() {
_classCallCheck(this, AlignSelf);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for 2012 specs
*/
AlignSelf.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-item-align';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return property name by final spec
*/
AlignSelf.prototype.normalize = function normalize() {
return 'align-self';
};
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
AlignSelf.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
decl.value = AlignSelf.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return AlignSelf;
}(Declaration);
Object.defineProperty(AlignSelf, 'names', {
enumerable: true,
writable: true,
value: ['align-self', 'flex-item-align']
});
Object.defineProperty(AlignSelf, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start'
}
});
module.exports = AlignSelf;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var Animation = function (_Declaration) {
_inherits(Animation, _Declaration);
function Animation() {
_classCallCheck(this, Animation);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Don’t add prefixes for modern values.
*/
Animation.prototype.check = function check(decl) {
return !decl.value.split(/\s+/).some(function (i) {
var lower = i.toLowerCase();
return lower === 'reverse' || lower === 'alternate-reverse';
});
};
return Animation;
}(Declaration);
Object.defineProperty(Animation, 'names', {
enumerable: true,
writable: true,
value: ['animation', 'animation-direction']
});
module.exports = Animation;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var utils = require('../utils');
var Appearance = function (_Declaration) {
_inherits(Appearance, _Declaration);
function Appearance(name, prefixes, all) {
_classCallCheck(this, Appearance);
var _this = _possibleConstructorReturn(this, _Declaration.call(this, name, prefixes, all));
if (_this.prefixes) {
_this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
if (i === '-ms-') {
return '-webkit-';
} else {
return i;
}
}));
}
return _this;
}
return Appearance;
}(Declaration);
Object.defineProperty(Appearance, 'names', {
enumerable: true,
writable: true,
value: ['appearance']
});
module.exports = Appearance;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var BackgroundSize = function (_Declaration) {
_inherits(BackgroundSize, _Declaration);
function BackgroundSize() {
_classCallCheck(this, BackgroundSize);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Duplication parameter for -webkit- browsers
*/
BackgroundSize.prototype.set = function set(decl, prefix) {
var value = decl.value.toLowerCase();
if (prefix === '-webkit-' && value.indexOf(' ') === -1 && value !== 'contain' && value !== 'cover') {
decl.value = decl.value + ' ' + decl.value;
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return BackgroundSize;
}(Declaration);
Object.defineProperty(BackgroundSize, 'names', {
enumerable: true,
writable: true,
value: ['background-size']
});
module.exports = BackgroundSize;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var BlockLogical = function (_Declaration) {
_inherits(BlockLogical, _Declaration);
function BlockLogical() {
_classCallCheck(this, BlockLogical);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Use old syntax for -moz- and -webkit-
*/
BlockLogical.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + (prop.indexOf('-start') !== -1 ? prop.replace('-block-start', '-before') : prop.replace('-block-end', '-after'));
};
/**
* Return property name by spec
*/
BlockLogical.prototype.normalize = function normalize(prop) {
if (prop.indexOf('-before') !== -1) {
return prop.replace('-before', '-block-start');
} else {
return prop.replace('-after', '-block-end');
}
};
return BlockLogical;
}(Declaration);
Object.defineProperty(BlockLogical, 'names', {
enumerable: true,
writable: true,
value: ['border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', 'border-before', 'border-after', 'margin-before', 'margin-after', 'padding-before', 'padding-after']
});
module.exports = BlockLogical;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var BorderImage = function (_Declaration) {
_inherits(BorderImage, _Declaration);
function BorderImage() {
_classCallCheck(this, BorderImage);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Remove fill parameter for prefixed declarations
*/
BorderImage.prototype.set = function set(decl, prefix) {
decl.value = decl.value.replace(/\s+fill(\s)/, '$1');
return _Declaration.prototype.set.call(this, decl, prefix);
};
return BorderImage;
}(Declaration);
Object.defineProperty(BorderImage, 'names', {
enumerable: true,
writable: true,
value: ['border-image']
});
module.exports = BorderImage;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var BorderRadius = function (_Declaration) {
_inherits(BorderRadius, _Declaration);
function BorderRadius() {
_classCallCheck(this, BorderRadius);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change syntax, when add Mozilla prefix
*/
BorderRadius.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-moz-') {
return prefix + (BorderRadius.toMozilla[prop] || prop);
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return unprefixed version of property
*/
BorderRadius.prototype.normalize = function normalize(prop) {
return BorderRadius.toNormal[prop] || prop;
};
return BorderRadius;
}(Declaration);
Object.defineProperty(BorderRadius, 'names', {
enumerable: true,
writable: true,
value: ['border-radius']
});
Object.defineProperty(BorderRadius, 'toMozilla', {
enumerable: true,
writable: true,
value: {}
});
Object.defineProperty(BorderRadius, 'toNormal', {
enumerable: true,
writable: true,
value: {}
});
var _arr = ['top', 'bottom'];
for (var _i = 0; _i < _arr.length; _i++) {
var ver = _arr[_i];var _arr2 = ['left', 'right'];
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var hor = _arr2[_i2];
var normal = 'border-' + ver + '-' + hor + '-radius';
var mozilla = 'border-radius-' + ver + hor;
BorderRadius.names.push(normal);
BorderRadius.names.push(mozilla);
BorderRadius.toMozilla[normal] = mozilla;
BorderRadius.toNormal[mozilla] = normal;
}
}
module.exports = BorderRadius;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var BreakProps = function (_Declaration) {
_inherits(BreakProps, _Declaration);
function BreakProps() {
_classCallCheck(this, BreakProps);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change name for -webkit- and -moz- prefix
*/
BreakProps.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-moz-') {
return 'page-' + prop;
} else {
return prefix + 'column-' + prop;
}
};
/**
* Return property name by final spec
*/
BreakProps.prototype.normalize = function normalize(prop) {
if (prop.indexOf('inside') !== -1) {
return 'break-inside';
} else if (prop.indexOf('before') !== -1) {
return 'break-before';
} else {
return 'break-after';
}
};
/**
* Change prefixed value for avoid-column and avoid-page
*/
BreakProps.prototype.set = function set(decl, prefix) {
if (decl.prop === 'break-inside' && decl.value === 'avoid-column' || decl.value === 'avoid-page') {
decl.value = 'avoid';
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
/**
* Don’t prefix some values
*/
BreakProps.prototype.insert = function insert(decl, prefix, prefixes) {
if (decl.prop !== 'break-inside') {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
} else if (decl.value === 'avoid-region') {
return undefined;
} else if (decl.value === 'avoid-page' && prefix === '-webkit-') {
return undefined;
} else {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
};
return BreakProps;
}(Declaration);
Object.defineProperty(BreakProps, 'names', {
enumerable: true,
writable: true,
value: ['break-inside', 'page-break-inside', 'column-break-inside', 'break-before', 'page-break-before', 'column-break-before', 'break-after', 'page-break-after', 'column-break-after']
});
module.exports = BreakProps;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Value = require('../value');
var list = require('postcss').list;
var CrossFade = function (_Value) {
_inherits(CrossFade, _Value);
function CrossFade() {
_classCallCheck(this, CrossFade);
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
}
CrossFade.prototype.replace = function replace(string, prefix) {
var _this2 = this;
return list.space(string).map(function (value) {
if (value.slice(0, +_this2.name.length + 1) !== _this2.name + '(') {
return value;
}
var close = value.lastIndexOf(')');
var after = value.slice(close + 1);
var args = value.slice(_this2.name.length + 1, close);
if (prefix === '-webkit-') {
var match = args.match(/\d*.?\d+%?/);
if (match) {
args = args.slice(match[0].length).trim();
args += ', ' + match[0];
} else {
args += ', 0.5';
}
}
return prefix + _this2.name + '(' + args + ')' + after;
}).join(' ');
};
return CrossFade;
}(Value);
Object.defineProperty(CrossFade, 'names', {
enumerable: true,
writable: true,
value: ['cross-fade']
});
module.exports = CrossFade;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var OldValue = require('../old-value');
var Value = require('../value');
var DisplayFlex = function (_Value) {
_inherits(DisplayFlex, _Value);
function DisplayFlex(name, prefixes) {
_classCallCheck(this, DisplayFlex);
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
if (name === 'display-flex') {
_this.name = 'flex';
}
return _this;
}
/**
* Faster check for flex value
*/
DisplayFlex.prototype.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
/**
* Return value by spec
*/
DisplayFlex.prototype.prefixed = function prefixed(prefix) {
var spec = void 0,
value = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
if (this.name === 'flex') {
value = 'box';
} else {
value = 'inline-box';
}
} else if (spec === 2012) {
if (this.name === 'flex') {
value = 'flexbox';
} else {
value = 'inline-flexbox';
}
} else if (spec === 'final') {
value = this.name;
}
return prefix + value;
};
/**
* Add prefix to value depend on flebox spec version
*/
DisplayFlex.prototype.replace = function replace(string, prefix) {
return this.prefixed(prefix);
};
/**
* Change value for old specs
*/
DisplayFlex.prototype.old = function old(prefix) {
var prefixed = this.prefixed(prefix);
if (!prefixed) return undefined;
return new OldValue(this.name, prefixed);
};
return DisplayFlex;
}(Value);
Object.defineProperty(DisplayFlex, 'names', {
enumerable: true,
writable: true,
value: ['display-flex', 'inline-flex']
});
module.exports = DisplayFlex;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Value = require('../value');
var DisplayGrid = function (_Value) {
_inherits(DisplayGrid, _Value);
function DisplayGrid(name, prefixes) {
_classCallCheck(this, DisplayGrid);
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
if (name === 'display-grid') {
_this.name = 'grid';
}
return _this;
}
/**
* Faster check for flex value
*/
DisplayGrid.prototype.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
return DisplayGrid;
}(Value);
Object.defineProperty(DisplayGrid, 'names', {
enumerable: true,
writable: true,
value: ['display-grid', 'inline-grid']
});
module.exports = DisplayGrid;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Value = require('../value');
var FilterValue = function (_Value) {
_inherits(FilterValue, _Value);
function FilterValue(name, prefixes) {
_classCallCheck(this, FilterValue);
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
if (name === 'filter-function') {
_this.name = 'filter';
}
return _this;
}
return FilterValue;
}(Value);
Object.defineProperty(FilterValue, 'names', {
enumerable: true,
writable: true,
value: ['filter', 'filter-function']
});
module.exports = FilterValue;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var Filter = function (_Declaration) {
_inherits(Filter, _Declaration);
function Filter() {
_classCallCheck(this, Filter);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Check is it Internet Explorer filter
*/
Filter.prototype.check = function check(decl) {
var v = decl.value;
return v.toLowerCase().indexOf('alpha(') === -1 && v.indexOf('DXImageTransform.Microsoft') === -1 && v.indexOf('data:image/svg+xml') === -1;
};
return Filter;
}(Declaration);
Object.defineProperty(Filter, 'names', {
enumerable: true,
writable: true,
value: ['filter']
});
module.exports = Filter;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexBasis = function (_Declaration) {
_inherits(FlexBasis, _Declaration);
function FlexBasis() {
_classCallCheck(this, FlexBasis);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Return property name by final spec
*/
FlexBasis.prototype.normalize = function normalize() {
return 'flex-basis';
};
/**
* Return flex property for 2012 spec
*/
FlexBasis.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-preferred-size';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Ignore 2009 spec and use flex property for 2012
*/
FlexBasis.prototype.set = function set(decl, prefix) {
var spec = void 0;
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return FlexBasis;
}(Declaration);
Object.defineProperty(FlexBasis, 'names', {
enumerable: true,
writable: true,
value: ['flex-basis', 'flex-preferred-size']
});
module.exports = FlexBasis;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexDirection = function (_Declaration) {
_inherits(FlexDirection, _Declaration);
function FlexDirection() {
_classCallCheck(this, FlexDirection);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Return property name by final spec
*/
FlexDirection.prototype.normalize = function normalize() {
return 'flex-direction';
};
/**
* Use two properties for 2009 spec
*/
FlexDirection.prototype.insert = function insert(decl, prefix, prefixes) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
} else {
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
if (already) {
return undefined;
}
var v = decl.value;
var orient = void 0,
dir = void 0;
if (v === 'inherit' || v === 'initial' || v === 'unset') {
orient = v;
dir = v;
} else {
orient = v.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
dir = v.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
}
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
decl.parent.insertBefore(decl, cloned);
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return decl.parent.insertBefore(decl, cloned);
}
};
/**
* Clean two properties for 2009 spec
*/
FlexDirection.prototype.old = function old(prop, prefix) {
var spec = void 0;
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
if (spec === 2009) {
return [prefix + 'box-orient', prefix + 'box-direction'];
} else {
return _Declaration.prototype.old.call(this, prop, prefix);
}
};
return FlexDirection;
}(Declaration);
Object.defineProperty(FlexDirection, 'names', {
enumerable: true,
writable: true,
value: ['flex-direction', 'box-direction', 'box-orient']
});
module.exports = FlexDirection;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexFlow = function (_Declaration) {
_inherits(FlexFlow, _Declaration);
function FlexFlow() {
_classCallCheck(this, FlexFlow);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Use two properties for 2009 spec
*/
FlexFlow.prototype.insert = function insert(decl, prefix, prefixes) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
} else {
var values = decl.value.split(/\s+/).filter(function (i) {
return i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse';
});
if (values.length === 0) {
return undefined;
}
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
if (already) {
return undefined;
}
var value = values[0];
var orient = value.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
var dir = value.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
decl.parent.insertBefore(decl, cloned);
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return decl.parent.insertBefore(decl, cloned);
}
};
return FlexFlow;
}(Declaration);
Object.defineProperty(FlexFlow, 'names', {
enumerable: true,
writable: true,
value: ['flex-flow', 'box-direction', 'box-orient']
});
module.exports = FlexFlow;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var Flex = function (_Declaration) {
_inherits(Flex, _Declaration);
function Flex() {
_classCallCheck(this, Flex);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Return property name by final spec
*/
Flex.prototype.normalize = function normalize() {
return 'flex';
};
/**
* Return flex property for 2009 and 2012 specs
*/
Flex.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
} else if (spec === 2012) {
return prefix + 'flex-positive';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
return Flex;
}(Declaration);
Object.defineProperty(Flex, 'names', {
enumerable: true,
writable: true,
value: ['flex-grow', 'flex-positive']
});
module.exports = Flex;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexShrink = function (_Declaration) {
_inherits(FlexShrink, _Declaration);
function FlexShrink() {
_classCallCheck(this, FlexShrink);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Return property name by final spec
*/
FlexShrink.prototype.normalize = function normalize() {
return 'flex-shrink';
};
/**
* Return flex property for 2012 spec
*/
FlexShrink.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-negative';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Ignore 2009 spec and use flex property for 2012
*/
FlexShrink.prototype.set = function set(decl, prefix) {
var spec = void 0;
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return FlexShrink;
}(Declaration);
Object.defineProperty(FlexShrink, 'names', {
enumerable: true,
writable: true,
value: ['flex-shrink', 'flex-negative']
});
module.exports = FlexShrink;
\ No newline at end of file
'use strict';
/**
* Return flexbox spec versions by prefix
*/
module.exports = function (prefix) {
var spec = void 0;
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
spec = 2009;
} else if (prefix === '-ms-') {
spec = 2012;
} else if (prefix === '-webkit-') {
spec = 'final';
}
if (prefix === '-webkit- 2009') {
prefix = '-webkit-';
}
return [spec, prefix];
};
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexWrap = function (_Declaration) {
_inherits(FlexWrap, _Declaration);
function FlexWrap() {
_classCallCheck(this, FlexWrap);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Don't add prefix for 2009 spec
*/
FlexWrap.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec !== 2009) {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return FlexWrap;
}(Declaration);
Object.defineProperty(FlexWrap, 'names', {
enumerable: true,
writable: true,
value: ['flex-wrap']
});
module.exports = FlexWrap;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var list = require('postcss').list;
var Flex = function (_Declaration) {
_inherits(Flex, _Declaration);
function Flex() {
_classCallCheck(this, Flex);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for 2009 spec
*/
Flex.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return property name by final spec
*/
Flex.prototype.normalize = function normalize() {
return 'flex';
};
/**
* Spec 2009 supports only first argument
* Spec 2012 disallows unitless basis
*/
Flex.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009) {
decl.value = list.space(decl.value)[0];
decl.value = Flex.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else if (spec === 2012) {
var components = list.space(decl.value);
if (components.length === 3 && components[2] === '0') {
decl.value = components.slice(0, 2).concat('0px').join(' ');
}
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return Flex;
}(Declaration);
Object.defineProperty(Flex, 'names', {
enumerable: true,
writable: true,
value: ['flex', 'box-flex']
});
Object.defineProperty(Flex, 'oldValues', {
enumerable: true,
writable: true,
value: {
auto: '1',
none: '0'
}
});
module.exports = Flex;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Selector = require('../selector');
var Fullscreen = function (_Selector) {
_inherits(Fullscreen, _Selector);
function Fullscreen() {
_classCallCheck(this, Fullscreen);
return _possibleConstructorReturn(this, _Selector.apply(this, arguments));
}
/**
* Return different selectors depend on prefix
*/
Fullscreen.prototype.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return ':-webkit-full-screen';
} else if (prefix === '-moz-') {
return ':-moz-full-screen';
} else {
return ':' + prefix + 'fullscreen';
}
};
return Fullscreen;
}(Selector);
Object.defineProperty(Fullscreen, 'names', {
enumerable: true,
writable: true,
value: [':fullscreen']
});
module.exports = Fullscreen;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridArea = function (_Declaration) {
_inherits(GridArea, _Declaration);
function GridArea() {
_classCallCheck(this, GridArea);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Translate grid-area to separate -ms- prefixed properties
*/
GridArea.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-row';
})) {
return undefined;
}
var values = shorthand.parse(decl);
var _shorthand$translate = shorthand.translate(values, 0, 2),
rowStart = _shorthand$translate[0],
rowSpan = _shorthand$translate[1];
var _shorthand$translate2 = shorthand.translate(values, 1, 3),
columnStart = _shorthand$translate2[0],
columnSpan = _shorthand$translate2[1];
if (rowStart) {
decl.cloneBefore({
prop: '-ms-grid-row',
value: rowStart.toString()
});
}
if (rowSpan) {
decl.cloneBefore({
prop: '-ms-grid-row-span',
value: rowSpan.toString()
});
}
if (columnStart) {
decl.cloneBefore({
prop: '-ms-grid-column',
value: columnStart.toString()
});
}
if (columnSpan) {
decl.cloneBefore({
prop: '-ms-grid-column-span',
value: columnSpan.toString()
});
}
return undefined;
};
return GridArea;
}(Declaration);
Object.defineProperty(GridArea, 'names', {
enumerable: true,
writable: true,
value: ['grid-area']
});
module.exports = GridArea;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var GridColumnAlign = function (_Declaration) {
_inherits(GridColumnAlign, _Declaration);
function GridColumnAlign() {
_classCallCheck(this, GridColumnAlign);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Do not prefix flexbox values
*/
GridColumnAlign.prototype.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
};
/**
* Change property name for IE
*/
GridColumnAlign.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-column-align';
};
/**
* Change IE property back
*/
GridColumnAlign.prototype.normalize = function normalize() {
return 'justify-self';
};
return GridColumnAlign;
}(Declaration);
Object.defineProperty(GridColumnAlign, 'names', {
enumerable: true,
writable: true,
value: ['grid-column-align']
});
module.exports = GridColumnAlign;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var GridEnd = function (_Declaration) {
_inherits(GridEnd, _Declaration);
function GridEnd() {
_classCallCheck(this, GridEnd);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Do not add prefix for unsupported value in IE
*/
GridEnd.prototype.check = function check(decl) {
return decl.value.indexOf('span') !== -1;
};
/**
* Return a final spec property
*/
GridEnd.prototype.normalize = function normalize(prop) {
return prop.replace(/(-span|-end)/, '');
};
/**
* Change property name for IE
*/
GridEnd.prototype.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-ms-') {
result = result.replace('-end', '-span');
}
return result;
};
/**
* Change repeating syntax for IE
*/
GridEnd.prototype.set = function set(decl, prefix) {
if (prefix === '-ms-') {
decl.value = decl.value.replace(/span\s/i, '');
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return GridEnd;
}(Declaration);
Object.defineProperty(GridEnd, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-end', 'grid-column-end', 'grid-row-span', 'grid-column-span']
});
module.exports = GridEnd;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var GridRowAlign = function (_Declaration) {
_inherits(GridRowAlign, _Declaration);
function GridRowAlign() {
_classCallCheck(this, GridRowAlign);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Do not prefix flexbox values
*/
GridRowAlign.prototype.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
};
/**
* Change property name for IE
*/
GridRowAlign.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-row-align';
};
/**
* Change IE property back
*/
GridRowAlign.prototype.normalize = function normalize() {
return 'align-self';
};
return GridRowAlign;
}(Declaration);
Object.defineProperty(GridRowAlign, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-align']
});
module.exports = GridRowAlign;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridRowColumn = function (_Declaration) {
_inherits(GridRowColumn, _Declaration);
function GridRowColumn() {
_classCallCheck(this, GridRowColumn);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Translate grid-row / grid-column to separate -ms- prefixed properties
*/
GridRowColumn.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var values = shorthand.parse(decl);
var _shorthand$translate = shorthand.translate(values, 0, 1),
start = _shorthand$translate[0],
span = _shorthand$translate[1];
if (start) {
decl.cloneBefore({
prop: '-ms-' + decl.prop,
value: start.toString()
});
}
if (span) {
decl.cloneBefore({
prop: '-ms-' + decl.prop + '-span',
value: span.toString()
});
}
return undefined;
};
return GridRowColumn;
}(Declaration);
Object.defineProperty(GridRowColumn, 'names', {
enumerable: true,
writable: true,
value: ['grid-row', 'grid-column']
});
module.exports = GridRowColumn;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridRowsColumns = function (_Declaration) {
_inherits(GridRowsColumns, _Declaration);
function GridRowsColumns() {
_classCallCheck(this, GridRowsColumns);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for IE
*/
GridRowsColumns.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return prefix + prop.replace('template-', '');
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Change IE property back
*/
GridRowsColumns.prototype.normalize = function normalize(prop) {
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1');
};
/**
* Change repeating syntax for IE
*/
GridRowsColumns.prototype.set = function set(decl, prefix) {
if (prefix === '-ms-' && decl.value.indexOf('repeat(') !== -1) {
decl.value = shorthand.changeRepeat(decl.value);
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return GridRowsColumns;
}(Declaration);
Object.defineProperty(GridRowsColumns, 'names', {
enumerable: true,
writable: true,
value: ['grid-template-rows', 'grid-template-columns', 'grid-rows', 'grid-columns']
});
module.exports = GridRowsColumns;
\ No newline at end of file
'use strict';
var parser = require('postcss-value-parser');
function convert(value) {
if (value && value.length === 2 && value[0] === 'span' && parseInt(value[1], 10) > 0) {
return [false, parseInt(value[1], 10)];
}
if (value && value.length === 1 && parseInt(value[0], 10) > 0) {
return [parseInt(value[0], 10), false];
}
return [false, false];
}
function translate(values, startIndex, endIndex) {
var startValue = values[startIndex];
var endValue = values[endIndex];
if (!startValue) {
return [false, false];
}
var _convert = convert(startValue),
start = _convert[0],
spanStart = _convert[1];
var _convert2 = convert(endValue),
end = _convert2[0],
spanEnd = _convert2[1];
if (start && !endValue) {
return [start, false];
}
if (spanStart && end) {
return [end - spanStart, spanStart];
}
if (start && spanEnd) {
return [start, spanEnd];
}
if (start && end) {
return [start, end - start];
}
return [false, false];
}
function parse(decl) {
var node = parser(decl.value);
var values = [];
var current = 0;
values[current] = [];
for (var _iterator = node.nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var i = _ref;
if (i.type === 'div') {
current += 1;
values[current] = [];
} else if (i.type === 'word') {
values[current].push(i.value);
}
}
return values;
}
function parseTemplateShortcut(decl) {
var node = parser(decl.value, { loose: true });
var values = [];
var current = 0;
values[current] = [];
for (var _iterator2 = node.nodes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var i = _ref2;
if (i.type === 'div') {
current += 1;
values[current] = [];
} else {
values[current].push(parser.stringify(i));
}
}
return values;
}
function walkRepeat(node) {
var fixed = [];
for (var _iterator3 = node.nodes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
var i = _ref3;
if (i.nodes) {
walkRepeat(i);
}
fixed.push(i);
if (i.type === 'function' && i.value === 'repeat') {
var first = i.nodes.shift();
if (first) {
var count = first.value;
i.nodes.shift();
i.value = '';
fixed.push({ type: 'word', value: '[' + count + ']' });
}
}
}
node.nodes = fixed;
}
function changeRepeat(value) {
var ast = parser(value);
walkRepeat(ast);
return ast.toString();
}
module.exports = {
parse: parse,
translate: translate,
changeRepeat: changeRepeat,
parseTemplateShortcut: parseTemplateShortcut
};
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var GridStart = function (_Declaration) {
_inherits(GridStart, _Declaration);
function GridStart() {
_classCallCheck(this, GridStart);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Do not add prefix for unsupported value in IE
*/
GridStart.prototype.check = function check(decl) {
var value = decl.value;
return value.indexOf('/') === -1 || value.indexOf('span') !== -1;
};
/**
* Return a final spec property
*/
GridStart.prototype.normalize = function normalize(prop) {
return prop.replace('-start', '');
};
/**
* Change property name for IE
*/
GridStart.prototype.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-ms-') {
result = result.replace('-start', '');
}
return result;
};
return GridStart;
}(Declaration);
Object.defineProperty(GridStart, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-start', 'grid-column-start']
});
module.exports = GridStart;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var DOTS = /^\.+$/;
function track(start, end) {
return { start: start, end: end, span: end - start };
}
function getRows(tpl) {
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
}
function getColumns(line) {
return line.trim().split(/\s+/g);
}
function parseGridAreas(tpl) {
return getRows(tpl).reduce(function (areas, line, rowIndex) {
if (line.trim() === '') return areas;
getColumns(line).forEach(function (area, columnIndex) {
if (DOTS.test(area)) return;
if (typeof areas[area] === 'undefined') {
areas[area] = {
column: track(columnIndex + 1, columnIndex + 2),
row: track(rowIndex + 1, rowIndex + 2)
};
} else {
var _areas$area = areas[area],
column = _areas$area.column,
row = _areas$area.row;
column.start = Math.min(column.start, columnIndex + 1);
column.end = Math.max(column.end, columnIndex + 2);
column.span = column.end - column.start;
row.start = Math.min(row.start, rowIndex + 1);
row.end = Math.max(row.end, rowIndex + 2);
row.span = row.end - row.start;
}
});
return areas;
}, {});
}
var GridTemplateAreas = function (_Declaration) {
_inherits(GridTemplateAreas, _Declaration);
function GridTemplateAreas() {
_classCallCheck(this, GridTemplateAreas);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
GridTemplateAreas.prototype.getRoot = function getRoot(parent) {
if (parent.type === 'atrule' || !parent.parent) {
return parent;
}
return this.getRoot(parent.parent);
};
/**
* Translate grid-template-areas to separate -ms- prefixed properties
*/
GridTemplateAreas.prototype.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var areas = parseGridAreas(decl.value);
var missed = Object.keys(areas);
this.getRoot(decl.parent).walkDecls('grid-area', function (gridArea) {
var value = gridArea.value;
var area = areas[value];
missed = missed.filter(function (e) {
return e !== value;
});
if (area) {
gridArea.parent.walkDecls(/-ms-grid-(row|column)/, function (d) {
d.remove();
});
gridArea.cloneBefore({
prop: '-ms-grid-row',
value: String(area.row.start)
});
if (area.row.span > 1) {
gridArea.cloneBefore({
prop: '-ms-grid-row-span',
value: String(area.row.span)
});
}
gridArea.cloneBefore({
prop: '-ms-grid-column',
value: String(area.column.start)
});
if (area.column.span > 1) {
gridArea.cloneBefore({
prop: '-ms-grid-column-span',
value: String(area.column.span)
});
}
}
return undefined;
});
if (missed.length > 0) {
decl.warn(result, 'Can not find grid areas: ' + missed.join(', '));
}
return decl;
};
return GridTemplateAreas;
}(Declaration);
Object.defineProperty(GridTemplateAreas, 'names', {
enumerable: true,
writable: true,
value: ['grid-template-areas']
});
module.exports = GridTemplateAreas;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridTemplate = function (_Declaration) {
_inherits(GridTemplate, _Declaration);
function GridTemplate() {
_classCallCheck(this, GridTemplate);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Do not add prefix for unsupported value in IE
*/
GridTemplate.prototype.check = function check(decl) {
return decl.value.includes('/') && !decl.value.includes('[') && !decl.value.includes('"') && !decl.value.includes('\'');
};
/**
* Translate grid-template to separate -ms- prefixed properties
*/
GridTemplate.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-rows';
})) {
return undefined;
}
var _shorthand$parseTempl = shorthand.parseTemplateShortcut(decl),
templateRows = _shorthand$parseTempl[0],
templateColumns = _shorthand$parseTempl[1];
if (templateRows) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: shorthand.changeRepeat(templateRows.join(''))
});
}
if (templateColumns) {
decl.cloneBefore({
prop: '-ms-grid-columns',
value: shorthand.changeRepeat(templateColumns.join(''))
});
}
return decl;
};
return GridTemplate;
}(Declaration);
Object.defineProperty(GridTemplate, 'names', {
enumerable: true,
writable: true,
value: ['grid-template']
});
module.exports = GridTemplate;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var ImageRendering = function (_Declaration) {
_inherits(ImageRendering, _Declaration);
function ImageRendering() {
_classCallCheck(this, ImageRendering);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Add hack only for crisp-edges
*/
ImageRendering.prototype.check = function check(decl) {
return decl.value === 'pixelated';
};
/**
* Change property name for IE
*/
ImageRendering.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return '-ms-interpolation-mode';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Change property and value for IE
*/
ImageRendering.prototype.set = function set(decl, prefix) {
if (prefix !== '-ms-') return _Declaration.prototype.set.call(this, decl, prefix);
decl.prop = '-ms-interpolation-mode';
decl.value = 'nearest-neighbor';
return decl;
};
/**
* Return property name by spec
*/
ImageRendering.prototype.normalize = function normalize() {
return 'image-rendering';
};
/**
* Warn on old value
*/
ImageRendering.prototype.process = function process(node, result) {
return _Declaration.prototype.process.call(this, node, result);
};
return ImageRendering;
}(Declaration);
Object.defineProperty(ImageRendering, 'names', {
enumerable: true,
writable: true,
value: ['image-rendering', 'interpolation-mode']
});
module.exports = ImageRendering;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Value = require('../value');
var ImageSet = function (_Value) {
_inherits(ImageSet, _Value);
function ImageSet() {
_classCallCheck(this, ImageSet);
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
}
/**
* Use non-standard name for WebKit and Firefox
*/
ImageSet.prototype.replace = function replace(string, prefix) {
var fixed = _Value.prototype.replace.call(this, string, prefix);
if (prefix === '-webkit-') {
fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2');
}
return fixed;
};
return ImageSet;
}(Value);
Object.defineProperty(ImageSet, 'names', {
enumerable: true,
writable: true,
value: ['image-set']
});
module.exports = ImageSet;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var InlineLogical = function (_Declaration) {
_inherits(InlineLogical, _Declaration);
function InlineLogical() {
_classCallCheck(this, InlineLogical);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Use old syntax for -moz- and -webkit-
*/
InlineLogical.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + prop.replace('-inline', '');
};
/**
* Return property name by spec
*/
InlineLogical.prototype.normalize = function normalize(prop) {
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2');
};
return InlineLogical;
}(Declaration);
Object.defineProperty(InlineLogical, 'names', {
enumerable: true,
writable: true,
value: ['border-inline-start', 'border-inline-end', 'margin-inline-start', 'margin-inline-end', 'padding-inline-start', 'padding-inline-end', 'border-start', 'border-end', 'margin-start', 'margin-end', 'padding-start', 'padding-end']
});
module.exports = InlineLogical;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var OldValue = require('../old-value');
var Value = require('../value');
function _regexp(name) {
return new RegExp('(^|[\\s,(])(' + name + '($|[\\s),]))', 'gi');
}
var Intrinsic = function (_Value) {
_inherits(Intrinsic, _Value);
function Intrinsic() {
_classCallCheck(this, Intrinsic);
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
}
Intrinsic.prototype.regexp = function regexp() {
if (!this.regexpCache) this.regexpCache = _regexp(this.name);
return this.regexpCache;
};
Intrinsic.prototype.isStretch = function isStretch() {
return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
};
Intrinsic.prototype.replace = function replace(string, prefix) {
if (prefix === '-moz-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-moz-available$3');
} else if (prefix === '-webkit-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-webkit-fill-available$3');
} else {
return _Value.prototype.replace.call(this, string, prefix);
}
};
Intrinsic.prototype.old = function old(prefix) {
var prefixed = prefix + this.name;
if (this.isStretch()) {
if (prefix === '-moz-') {
prefixed = '-moz-available';
} else if (prefix === '-webkit-') {
prefixed = '-webkit-fill-available';
}
}
return new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
};
Intrinsic.prototype.add = function add(decl, prefix) {
if (decl.prop.indexOf('grid') !== -1 && prefix !== '-webkit-') {
return undefined;
}
return _Value.prototype.add.call(this, decl, prefix);
};
return Intrinsic;
}(Value);
Object.defineProperty(Intrinsic, 'names', {
enumerable: true,
writable: true,
value: ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']
});
module.exports = Intrinsic;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var JustifyContent = function (_Declaration) {
_inherits(JustifyContent, _Declaration);
function JustifyContent() {
_classCallCheck(this, JustifyContent);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for 2009 and 2012 specs
*/
JustifyContent.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-pack';
} else if (spec === 2012) {
return prefix + 'flex-pack';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return property name by final spec
*/
JustifyContent.prototype.normalize = function normalize() {
return 'justify-content';
};
/**
* Change value for 2009 and 2012 specs
*/
JustifyContent.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009 || spec === 2012) {
var value = JustifyContent.oldValues[decl.value] || decl.value;
decl.value = value;
if (spec !== 2009 || value !== 'distribute') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return JustifyContent;
}(Declaration);
Object.defineProperty(JustifyContent, 'names', {
enumerable: true,
writable: true,
value: ['justify-content', 'flex-pack', 'box-pack']
});
Object.defineProperty(JustifyContent, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
}
});
module.exports = JustifyContent;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var MaskBorder = function (_Declaration) {
_inherits(MaskBorder, _Declaration);
function MaskBorder() {
_classCallCheck(this, MaskBorder);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Return property name by final spec
*/
MaskBorder.prototype.normalize = function normalize() {
return this.name.replace('box-image', 'border');
};
/**
* Return flex property for 2012 spec
*/
MaskBorder.prototype.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-webkit-') {
result = result.replace('border', 'box-image');
}
return result;
};
return MaskBorder;
}(Declaration);
Object.defineProperty(MaskBorder, 'names', {
enumerable: true,
writable: true,
value: ['mask-border', 'mask-border-source', 'mask-border-slice', 'mask-border-width', 'mask-border-outset', 'mask-border-repeat', 'mask-box-image', 'mask-box-image-source', 'mask-box-image-slice', 'mask-box-image-width', 'mask-box-image-outset', 'mask-box-image-repeat']
});
module.exports = MaskBorder;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var Order = function (_Declaration) {
_inherits(Order, _Declaration);
function Order() {
_classCallCheck(this, Order);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Change property name for 2009 and 2012 specs
*/
Order.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-ordinal-group';
} else if (spec === 2012) {
return prefix + 'flex-order';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Return property name by final spec
*/
Order.prototype.normalize = function normalize() {
return 'order';
};
/**
* Fix value for 2009 spec
*/
Order.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009 && /\d/.test(decl.value)) {
decl.value = (parseInt(decl.value) + 1).toString();
return _Declaration.prototype.set.call(this, decl, prefix);
} else {
return _Declaration.prototype.set.call(this, decl, prefix);
}
};
return Order;
}(Declaration);
Object.defineProperty(Order, 'names', {
enumerable: true,
writable: true,
value: ['order', 'flex-order', 'box-ordinal-group']
});
module.exports = Order;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var OldValue = require('../old-value');
var Value = require('../value');
var Pixelated = function (_Value) {
_inherits(Pixelated, _Value);
function Pixelated() {
_classCallCheck(this, Pixelated);
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
}
/**
* Use non-standard name for WebKit and Firefox
*/
Pixelated.prototype.replace = function replace(string, prefix) {
if (prefix === '-webkit-') {
return string.replace(this.regexp(), '$1-webkit-optimize-contrast');
} else if (prefix === '-moz-') {
return string.replace(this.regexp(), '$1-moz-crisp-edges');
} else {
return _Value.prototype.replace.call(this, string, prefix);
}
};
/**
* Different name for WebKit and Firefox
*/
Pixelated.prototype.old = function old(prefix) {
if (prefix === '-webkit-') {
return new OldValue(this.name, '-webkit-optimize-contrast');
} else if (prefix === '-moz-') {
return new OldValue(this.name, '-moz-crisp-edges');
} else {
return _Value.prototype.old.call(this, prefix);
}
};
return Pixelated;
}(Value);
Object.defineProperty(Pixelated, 'names', {
enumerable: true,
writable: true,
value: ['pixelated']
});
module.exports = Pixelated;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Selector = require('../selector');
var Placeholder = function (_Selector) {
_inherits(Placeholder, _Selector);
function Placeholder() {
_classCallCheck(this, Placeholder);
return _possibleConstructorReturn(this, _Selector.apply(this, arguments));
}
/**
* Add old mozilla to possible prefixes
*/
Placeholder.prototype.possible = function possible() {
return _Selector.prototype.possible.call(this).concat(['-moz- old', '-ms- old']);
};
/**
* Return different selectors depend on prefix
*/
Placeholder.prototype.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-input-placeholder';
} else if (prefix === '-ms-') {
return '::-ms-input-placeholder';
} else if (prefix === '-ms- old') {
return ':-ms-input-placeholder';
} else if (prefix === '-moz- old') {
return ':-moz-placeholder';
} else {
return '::' + prefix + 'placeholder';
}
};
return Placeholder;
}(Selector);
Object.defineProperty(Placeholder, 'names', {
enumerable: true,
writable: true,
value: ['::placeholder']
});
module.exports = Placeholder;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var BASIC = ['none', 'underline', 'overline', 'line-through', 'blink', 'inherit', 'initial', 'unset'];
var TextDecoration = function (_Declaration) {
_inherits(TextDecoration, _Declaration);
function TextDecoration() {
_classCallCheck(this, TextDecoration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Do not add prefixes for basic values.
*/
TextDecoration.prototype.check = function check(decl) {
return decl.value.split(/\s+/).some(function (i) {
return BASIC.indexOf(i) === -1;
});
};
return TextDecoration;
}(Declaration);
Object.defineProperty(TextDecoration, 'names', {
enumerable: true,
writable: true,
value: ['text-decoration']
});
module.exports = TextDecoration;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var TextEmphasisPosition = function (_Declaration) {
_inherits(TextEmphasisPosition, _Declaration);
function TextEmphasisPosition() {
_classCallCheck(this, TextEmphasisPosition);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
TextEmphasisPosition.prototype.set = function set(decl, prefix) {
if (prefix === '-webkit-') {
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '');
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return TextEmphasisPosition;
}(Declaration);
Object.defineProperty(TextEmphasisPosition, 'names', {
enumerable: true,
writable: true,
value: ['text-emphasis-position']
});
module.exports = TextEmphasisPosition;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var TransformDecl = function (_Declaration) {
_inherits(TransformDecl, _Declaration);
function TransformDecl() {
_classCallCheck(this, TransformDecl);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
/**
* Recursively check all parents for @keyframes
*/
TransformDecl.prototype.keyframeParents = function keyframeParents(decl) {
var parent = decl.parent;
while (parent) {
if (parent.type === 'atrule' && parent.name === 'keyframes') {
return true;
}
var _parent = parent;
parent = _parent.parent;
}
return false;
};
/**
* Is transform contain 3D commands
*/
TransformDecl.prototype.contain3d = function contain3d(decl) {
if (decl.prop === 'transform-origin') {
return false;
}
for (var _iterator = TransformDecl.functions3d, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var func = _ref;
if (decl.value.indexOf(func + '(') !== -1) {
return true;
}
}
return false;
};
/**
* Replace rotateZ to rotate for IE 9
*/
TransformDecl.prototype.set = function set(decl, prefix) {
decl = _Declaration.prototype.set.call(this, decl, prefix);
if (prefix === '-ms-') {
decl.value = decl.value.replace(/rotateZ/gi, 'rotate');
}
return decl;
};
/**
* Don't add prefix for IE in keyframes
*/
TransformDecl.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
if (!this.contain3d(decl) && !this.keyframeParents(decl)) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
} else if (prefix === '-o-') {
if (!this.contain3d(decl)) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
} else {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
return undefined;
};
return TransformDecl;
}(Declaration);
Object.defineProperty(TransformDecl, 'names', {
enumerable: true,
writable: true,
value: ['transform', 'transform-origin']
});
Object.defineProperty(TransformDecl, 'functions3d', {
enumerable: true,
writable: true,
value: ['matrix3d', 'translate3d', 'translateZ', 'scale3d', 'scaleZ', 'rotate3d', 'rotateX', 'rotateY', 'perspective']
});
module.exports = TransformDecl;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Declaration = require('../declaration');
var WritingMode = function (_Declaration) {
_inherits(WritingMode, _Declaration);
function WritingMode() {
_classCallCheck(this, WritingMode);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
WritingMode.prototype.set = function set(decl, prefix) {
if (prefix === '-ms-') {
decl.value = WritingMode.msValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else {
return _Declaration.prototype.set.call(this, decl, prefix);
}
};
return WritingMode;
}(Declaration);
Object.defineProperty(WritingMode, 'names', {
enumerable: true,
writable: true,
value: ['writing-mode']
});
Object.defineProperty(WritingMode, 'msValues', {
enumerable: true,
writable: true,
value: {
'horizontal-tb': 'lr-tb',
'vertical-rl': 'tb-rl',
'vertical-lr': 'tb-lr'
}
});
module.exports = WritingMode;
\ No newline at end of file
'use strict';
var browserslist = require('browserslist');
function capitalize(str) {
return str.slice(0, 1).toUpperCase() + str.slice(1);
}
var names = {
ie: 'IE',
ie_mob: 'IE Mobile',
ios_saf: 'iOS',
op_mini: 'Opera Mini',
op_mob: 'Opera Mobile',
and_chr: 'Chrome for Android',
and_ff: 'Firefox for Android',
and_uc: 'UC for Android'
};
var prefix = function prefix(name, prefixes) {
var out = ' ' + name + ': ';
out += prefixes.map(function (i) {
return i.replace(/^-(.*)-$/g, '$1');
}).join(', ');
out += '\n';
return out;
};
module.exports = function (prefixes) {
if (prefixes.browsers.selected.length === 0) {
return 'No browsers selected';
}
var versions = {};
for (var _iterator = prefixes.browsers.selected, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var browser = _ref;
var _browser$split = browser.split(' '),
name = _browser$split[0],
version = _browser$split[1];
name = names[name] || capitalize(name);
if (versions[name]) {
versions[name].push(version);
} else {
versions[name] = [version];
}
}
var out = 'Browsers:\n';
for (var _browser in versions) {
var list = versions[_browser];
list = list.sort(function (a, b) {
return parseFloat(b) - parseFloat(a);
});
out += ' ' + _browser + ': ' + list.join(', ') + '\n';
}
var coverage = browserslist.coverage(prefixes.browsers.selected);
var round = Math.round(coverage * 100) / 100.0;
out += '\nThese browsers account for ' + round + '% of all users globally\n';
var atrules = '';
for (var name in prefixes.add) {
var data = prefixes.add[name];
if (name[0] === '@' && data.prefixes) {
atrules += prefix(name, data.prefixes);
}
}
if (atrules !== '') {
out += '\nAt-Rules:\n' + atrules;
}
var selectors = '';
for (var _iterator2 = prefixes.add.selectors, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var selector = _ref2;
if (selector.prefixes) {
selectors += prefix(selector.name, selector.prefixes);
}
}
if (selectors !== '') {
out += '\nSelectors:\n' + selectors;
}
var values = '';
var props = '';
for (var _name in prefixes.add) {
var _data = prefixes.add[_name];
if (_name[0] !== '@' && _data.prefixes) {
props += prefix(_name, _data.prefixes);
}
if (!_data.values) {
continue;
}
for (var _iterator3 = _data.values, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
var value = _ref3;
var string = prefix(value.name, value.prefixes);
if (values.indexOf(string) === -1) {
values += string;
}
}
}
if (props !== '') {
out += '\nProperties:\n' + props;
}
if (values !== '') {
out += '\nValues:\n' + values;
}
if (atrules === '' && selectors === '' && props === '' && values === '') {
out += '\nAwesome! Your browsers don\'t require any vendor prefixes.' + '\nNow you can remove Autoprefixer from build steps.';
}
return out;
};
\ No newline at end of file
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var OldSelector = function () {
function OldSelector(selector, prefix) {
_classCallCheck(this, OldSelector);
this.prefix = prefix;
this.prefixed = selector.prefixed(this.prefix);
this.regexp = selector.regexp(this.prefix);
this.prefixeds = selector.possible().map(function (x) {
return [selector.prefixed(x), selector.regexp(x)];
});
this.unprefixed = selector.name;
this.nameRegexp = selector.regexp();
}
/**
* Is rule a hack without unprefixed version bottom
*/
OldSelector.prototype.isHack = function isHack(rule) {
var index = rule.parent.index(rule) + 1;
var rules = rule.parent.nodes;
while (index < rules.length) {
var before = rules[index].selector;
if (!before) {
return true;
}
if (before.indexOf(this.unprefixed) !== -1 && before.match(this.nameRegexp)) {
return false;
}
var some = false;
for (var _iterator = this.prefixeds, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref2;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref2 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref2 = _i.value;
}
var _ref = _ref2;
var string = _ref[0];
var regexp = _ref[1];
if (before.indexOf(string) !== -1 && before.match(regexp)) {
some = true;
break;
}
}
if (!some) {
return true;
}
index += 1;
}
return true;
};
/**
* Does rule contain an unnecessary prefixed selector
*/
OldSelector.prototype.check = function check(rule) {
if (rule.selector.indexOf(this.prefixed) === -1) {
return false;
}
if (!rule.selector.match(this.regexp)) {
return false;
}
if (this.isHack(rule)) {
return false;
}
return true;
};
return OldSelector;
}();
module.exports = OldSelector;
\ No newline at end of file
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var utils = require('./utils');
var OldValue = function () {
function OldValue(unprefixed, prefixed, string, regexp) {
_classCallCheck(this, OldValue);
this.unprefixed = unprefixed;
this.prefixed = prefixed;
this.string = string || prefixed;
this.regexp = regexp || utils.regexp(prefixed);
}
/**
* Check, that value contain old value
*/
OldValue.prototype.check = function check(value) {
if (value.indexOf(this.string) !== -1) {
return !!value.match(this.regexp);
}
return false;
};
return OldValue;
}();
module.exports = OldValue;
\ No newline at end of file
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Browsers = require('./browsers');
var utils = require('./utils');
var vendor = require('postcss').vendor;
/**
* Recursivly clone objects
*/
function _clone(obj, parent) {
var cloned = new obj.constructor();
for (var _iterator = Object.keys(obj || {}), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var i = _ref;
var value = obj[i];
if (i === 'parent' && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
if (parent) {
cloned[i] = parent;
}
} else if (i === 'source' || i === null) {
cloned[i] = value;
} else if (value instanceof Array) {
cloned[i] = value.map(function (x) {
return _clone(x, cloned);
});
} else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null) {
value = _clone(value, cloned);
}
cloned[i] = value;
}
}
return cloned;
}
var Prefixer = function () {
/**
* Add hack to selected names
*/
Prefixer.hack = function hack(klass) {
var _this = this;
if (!this.hacks) {
this.hacks = {};
}
return klass.names.map(function (name) {
_this.hacks[name] = klass;
return _this.hacks[name];
});
};
/**
* Load hacks for some names
*/
Prefixer.load = function load(name, prefixes, all) {
var Klass = this.hacks && this.hacks[name];
if (Klass) {
return new Klass(name, prefixes, all);
} else {
return new this(name, prefixes, all);
}
};
/**
* Clone node and clean autprefixer custom caches
*/
Prefixer.clone = function clone(node, overrides) {
var cloned = _clone(node);
for (var name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
};
function Prefixer(name, prefixes, all) {
_classCallCheck(this, Prefixer);
this.name = name;
this.prefixes = prefixes;
this.all = all;
}
/**
* Find prefix in node parents
*/
Prefixer.prototype.parentPrefix = function parentPrefix(node) {
var prefix = void 0;
if (typeof node._autoprefixerPrefix !== 'undefined') {
prefix = node._autoprefixerPrefix;
} else if (node.type === 'decl' && node.prop[0] === '-') {
prefix = vendor.prefix(node.prop);
} else if (node.type === 'root') {
prefix = false;
} else if (node.type === 'rule' && node.selector.indexOf(':-') !== -1 && /:(-\w+-)/.test(node.selector)) {
prefix = node.selector.match(/:(-\w+-)/)[1];
} else if (node.type === 'atrule' && node.name[0] === '-') {
prefix = vendor.prefix(node.name);
} else {
prefix = this.parentPrefix(node.parent);
}
if (Browsers.prefixes().indexOf(prefix) === -1) {
prefix = false;
}
node._autoprefixerPrefix = prefix;
return node._autoprefixerPrefix;
};
/**
* Clone node with prefixes
*/
Prefixer.prototype.process = function process(node, result) {
if (!this.check(node)) {
return undefined;
}
var parent = this.parentPrefix(node);
var prefixes = this.prefixes.filter(function (prefix) {
return !parent || parent === utils.removeNote(prefix);
});
var added = [];
for (var _iterator2 = prefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var prefix = _ref2;
if (this.add(node, prefix, added.concat([prefix]), result)) {
added.push(prefix);
}
}
return added;
};
/**
* Shortcut for Prefixer.clone
*/
Prefixer.prototype.clone = function clone(node, overrides) {
return Prefixer.clone(node, overrides);
};
return Prefixer;
}();
module.exports = Prefixer;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Prefixer = require('./prefixer');
var utils = require('./utils');
var n2f = require('num2fraction');
var regexp = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpi)/gi;
var split = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpi)/i;
var Resolution = function (_Prefixer) {
_inherits(Resolution, _Prefixer);
function Resolution() {
_classCallCheck(this, Resolution);
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
/**
* Return prefixed query name
*/
Resolution.prototype.prefixName = function prefixName(prefix, name) {
var newName = prefix === '-moz-' ? name + '--moz-device-pixel-ratio' : prefix + name + '-device-pixel-ratio';
return newName;
};
/**
* Return prefixed query
*/
Resolution.prototype.prefixQuery = function prefixQuery(prefix, name, colon, value, units) {
if (units === 'dpi') {
value = Number(value / 96);
}
if (prefix === '-o-') {
value = n2f(value);
}
return this.prefixName(prefix, name) + colon + value;
};
/**
* Remove prefixed queries
*/
Resolution.prototype.clean = function clean(rule) {
var _this2 = this;
if (!this.bad) {
this.bad = [];
for (var _iterator = this.prefixes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prefix = _ref;
this.bad.push(this.prefixName(prefix, 'min'));
this.bad.push(this.prefixName(prefix, 'max'));
}
}
rule.params = utils.editList(rule.params, function (queries) {
return queries.filter(function (query) {
return _this2.bad.every(function (i) {
return query.indexOf(i) === -1;
});
});
});
};
/**
* Add prefixed queries
*/
Resolution.prototype.process = function process(rule) {
var _this3 = this;
var parent = this.parentPrefix(rule);
var prefixes = parent ? [parent] : this.prefixes;
rule.params = utils.editList(rule.params, function (origin, prefixed) {
for (var _iterator2 = origin, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var query = _ref2;
if (query.indexOf('min-resolution') === -1 && query.indexOf('max-resolution') === -1) {
prefixed.push(query);
continue;
}
var _loop = function _loop(prefix) {
var processed = query.replace(regexp, function (str) {
var parts = str.match(split);
return _this3.prefixQuery(prefix, parts[1], parts[2], parts[3], parts[4]);
});
prefixed.push(processed);
};
for (var _iterator3 = prefixes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
var prefix = _ref3;
_loop(prefix);
}
prefixed.push(query);
}
return utils.uniq(prefixed);
});
};
return Resolution;
}(Prefixer);
module.exports = Resolution;
\ No newline at end of file
'use strict';
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var OldSelector = require('./old-selector');
var Prefixer = require('./prefixer');
var Browsers = require('./browsers');
var utils = require('./utils');
var Selector = function (_Prefixer) {
_inherits(Selector, _Prefixer);
function Selector(name, prefixes, all) {
_classCallCheck(this, Selector);
var _this = _possibleConstructorReturn(this, _Prefixer.call(this, name, prefixes, all));
_this.regexpCache = {};
return _this;
}
/**
* Is rule selectors need to be prefixed
*/
Selector.prototype.check = function check(rule) {
if (rule.selector.indexOf(this.name) !== -1) {
return !!rule.selector.match(this.regexp());
}
return false;
};
/**
* Return prefixed version of selector
*/
Selector.prototype.prefixed = function prefixed(prefix) {
return this.name.replace(/^([^\w]*)/, '$1' + prefix);
};
/**
* Lazy loadRegExp for name
*/
Selector.prototype.regexp = function regexp(prefix) {
if (this.regexpCache[prefix]) {
return this.regexpCache[prefix];
}
var name = prefix ? this.prefixed(prefix) : this.name;
this.regexpCache[prefix] = new RegExp('(^|[^:"\'=])' + utils.escapeRegexp(name), 'gi');
return this.regexpCache[prefix];
};
/**
* All possible prefixes
*/
Selector.prototype.possible = function possible() {
return Browsers.prefixes();
};
/**
* Return all possible selector prefixes
*/
Selector.prototype.prefixeds = function prefixeds(rule) {
if (rule._autoprefixerPrefixeds) {
return rule._autoprefixerPrefixeds;
}
var prefixeds = {};
for (var _iterator = this.possible(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prefix = _ref;
prefixeds[prefix] = this.replace(rule.selector, prefix);
}
rule._autoprefixerPrefixeds = prefixeds;
return rule._autoprefixerPrefixeds;
};
/**
* Is rule already prefixed before
*/
Selector.prototype.already = function already(rule, prefixeds, prefix) {
var index = rule.parent.index(rule) - 1;
while (index >= 0) {
var before = rule.parent.nodes[index];
if (before.type !== 'rule') {
return false;
}
var some = false;
for (var key in prefixeds) {
var prefixed = prefixeds[key];
if (before.selector === prefixed) {
if (prefix === key) {
return true;
} else {
some = true;
break;
}
}
}
if (!some) {
return false;
}
index -= 1;
}
return false;
};
/**
* Replace selectors by prefixed one
*/
Selector.prototype.replace = function replace(selector, prefix) {
return selector.replace(this.regexp(), '$1' + this.prefixed(prefix));
};
/**
* Clone and add prefixes for at-rule
*/
Selector.prototype.add = function add(rule, prefix) {
var prefixeds = this.prefixeds(rule);
if (this.already(rule, prefixeds, prefix)) {
return;
}
var cloned = this.clone(rule, { selector: prefixeds[prefix] });
rule.parent.insertBefore(rule, cloned);
};
/**
* Return function to fast find prefixed selector
*/
Selector.prototype.old = function old(prefix) {
return new OldSelector(this, prefix);
};
return Selector;
}(Prefixer);
module.exports = Selector;
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.