nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions
-147
View File
@@ -1,147 +0,0 @@
# 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>
+207 -58
View File
@@ -1,6 +1,155 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 9.4.10
* Add warning for named Grid rows.
## 9.4.9
* Fix `grid-template` and `@media` case (by Bogdan Dolin).
## 9.4.8
* Fix `calc()` support in Grid gap.
## 9.4.7
* Fix infinite loop on mismatched parens.
## 9.4.6
* Fix warning text (by Albert Juhé Lluveras).
## 9.4.5
* Fix `text-decoration-skip-ink` support.
## 9.4.4
* Use `direction` value for `-ms-writing-mode` (by Denys Kniazevych).
* Fix warning text (by @zzzzBov).
## 9.4.3
* Add warning to force `flex-start` instead of `start` (by Antoine du Hamel).
* Fix docs (by Christian Oliff).
## 9.4.2
* Fix Grid autoplacement warning.
## 9.4.1
* Fix unnecessary Flexbox prefixes in Grid elements.
## 9.4 “Advance Australia”
* Add Grid autoplacement for `-ms-` (by Bogdan Dolin).
* Improve docs and warnings (by Daniel Tonon).
* Remove some unnecessary warnings for Grid (by Andrey Alexandrov).
## 9.3.1
* Fix Grid prefixes with `repeat()` value (by Bogdan Dolin).
## 9.3 “Labor omnia vincit”
* Add `place-self` support (by Bogdan Dolin).
* Fix Grid row/column span inheritance bug (by Bogdan Dolin).
## 9.2.1
* Fix broken AST.
## 9.2 “Onyi est glavnaya krepost”
* Add `/* autoprefixer grid: on */` control comment (by Andrey Alexandrov).
* Add duplicate `grid-area` support (by Bogdan Dolin).
* Fix `grid-gap` support for rules with different specifity (by Bogdan Dolin).
* Disable Grid in `@supports` at-rule with non-supported Grid features.
* Improve Grid warnings (by Daniel Tonon).
* Improve docs (by Joshua Hall, Mat Gadd, Roy Revelt, and Ivan).
## 9.1.5
* Remove `@babel/register` from dependencies.
## 9.1.4
* Use Babel 7.
## 9.1.3
* Sort properties in `autoprefixer --info` alphabetically.
* Fix old Firefox gradient prefix.
## 9.1.2
* Fix `autoprefixer --info` in new Node.js.
## 9.1.1
* Retain `grid-gap` through `@media` (by Bogdan Dolin).
* Fix `grid-template` and `@media` (by Bogdan Dolin).
* Fix Grid areas searching error (by Bogdan Dolin).
* Fix `span X` Grid prefix (by Bogdan Dolin).
* Fix docs (by Eduard Kyvenko).
## 9.1 “Equality before the law”
* Add `background-clip: text` support.
* Fix adding Grid span for IE (by Bogdan Dolin).
## 9.0.2
* Show warning on Grid area names conflict (by Bogdan Dolin).
* Fix documentation (by Sven Wagner).
## 9.0.1
* Fix nested at-rules in Grid prefixes (by Ivan Malov).
## 9.0 “A Mari Usque Ad Mare”
* Remove Node.js 9 and Node.js 4 support.
* Remove IE and “dead” browsers from Babel.
* Use PostCSS 7.0.
* Use Browserslist 4.0.
## 8.6.5
* Do not show Grid warnings if IE was not selected.
## 8.6.4
* Fix `stretch` prefix in Chrome >= 46.
## 8.6.3
* Add warnings for unsupported Grid features.
* Add warnings about wrong Grid properties.
* Add note about `grid` option for grid properties in `autoprefixer --info`.
## 8.6.2
* Fix error during adding Grid prefixes in `@media` (by Evgeny Petukhov).
## 8.6.1
* Fix `grid-template` with media queries (by Evgeny Petukhov).
## 8.6 “Follow Reason”
* Add `gap` support (by Evgeny Petukhov).
* Add two values support for `grid-gap` and `gap` (by Evgeny Petukhov).
* Add `ignoreUnknownVersions` option for Browserslist.
## 8.5.2
* Fix `grid-template` support wit auto row sizes (by Yury Timofeev).
## 8.5.1
* Remove unnecessary warning on `-webkit-fill-available`.
## 8.5 “Muito Nobre e Sempre Leal”
* Add `grid-gap` support (by Evgeny Petukhov).
* Fix radial gradients direction fix.
* Fix docs (by Phani Kandula and Huáng Jùnliàng).
## 8.4.1
* Fix working in old PostCSS versions (by Diablohu).
## 8.4 “Non in aves, sed in angues”
* Add `/* autoprefixer: ignore next */` control comment (by Pavel Vostrikov).
## 8.3 “Benigno Numine”
* Add `@media` support to `grid-template` (by Evgeny Petukhov).
* Fix `radial-gradient` direction warning (by Gustavo Real).
## 8.2 “Ad Astra per Aspera”
* Add `color-adjust` (by Sergey Lysenko, Stanislav Botev, and Yuriy Alekseyev).
## 8.1 “Rex, Familia et Ultio”
* Add `overscroll-behavior` support.
* Add `grid-template` shortcut support (by Evgeny Petukhov).
* Add better `grid-column-end` and `grid-row-end` support (by Evgeny Petukhov).
* Fix Grid properties support in `@supports`.
## 8.0 “Excelsior”
* Use Browserslist 3.0.
* Rename `autoprefixer-info` CLI tool to `autoprefixer --info`.
* Remove `break-*` to `page-break-*` conversion for Firefox.
## 7.2.6
* Fix `-ms-` prefix for grid cells with same `grid-area` (by Evgeny Petukhov).
@@ -416,46 +565,46 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Better `break-inside` support.
* Fix prefixing, when two same properties are near.
### 20140222:
### 20140222
* Add `touch-action` support.
### 20140226:
### 20140226
* Chrome 33 is moved to released versions.
* Add Chrome 36 data.
### 20140302:
### 20140302
* Add `text-decoration-*` properties support.
* Update browsers usage statistics.
* Use new PostCSS version.
### 20140319:
### 20140319
* Check already prefixed properties after current declaration.
* Normalize spaces before already prefixed check.
* Firefox 28 is moved to released versions.
* Add Firefox 31 data.
* Add some Blackberry data.
### 20140327:
### 20140327
* Don’t use `-ms-transform` in `@keyframes`, because IE 9 doesn’t support
animations.
* Update BlackBerry 10 data.
### 20140403:
### 20140403
* Update browsers usage statistics.
* Opera 20 is moved to released versions.
* Add Opera 22 data.
### 20140410:
### 20140410
* Chrome 34 is moved to released versions.
* Add Chrome 37 data.
* Fix Chrome 36 data.
### 20140429:
### 20140429
* Fix `display: inline-flex` support by 2009 spec.
* Fix old WebKit gradient converter (by Sergey Belov).
* Fix CSS 3 cursors data (by Nick Schonning).
### 20140430:
### 20140430
* Separate 2D and 3D transform prefixes to clean unnecessary `-ms-` prefixes.
* Firefox 29 is moved to released versions.
* Add Firefox 32 data.
@@ -503,38 +652,38 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Binary now shows file name in syntax error.
* Use browserify to build standalone version.
### 20131225:
### 20131225
* Fix deprecated API convertor.
* Add `::placeholder` support for Firefix >= 18.
* Fix vendor prefixes order.
### 20140103:
### 20140103
* Add `-webkit-` prefix for `sticky` position.
* Update browsers popularity statistics.
### 20140109:
### 20140109
* Add selectors and at-rules sections to debug info.
* Fix outdated prefixes cleaning.
### 20140110:
### 20140110
* Add `Firefox ESR` browser requirement.
* Opera 18 is moved to released versions.
* Add Opera 20 data.
### 20140117:
### 20140117
* Chrome 32 is moved to released versions.
* Add Opera 34 data.
### 20140130:
### 20140130
* Fix flexbox properties names in transitions.
* Add Chrome 35 and Firefox 29 data.
### 20140203:
### 20140203
* Android 4.4 stock browser and Opera 19 are moved to released versions.
* Add Opera 21 data.
* Update browsers usage statistics.
### 20140213:
### 20140213
* Add case insensitive to IE’s filter hack (by Dominik Schilling).
* Improve selector prefixing in some rare cases (by Simon Lydell).
* Firefox 27 is moved to released versions.
@@ -553,71 +702,71 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Fix selector prefixes order.
* Fix browser versions order in inspect.
### 20130903:
### 20130903
* Fix old WebKit gradients convertor on rgba() colors.
* Allow to write old direction syntax in gradients.
### 20130906:
### 20130906
* Fix direction syntax in radial gradients.
* Don’t prefix IE filter with modern syntax.
### 20130911:
### 20130911
* Fix parsing property name with spaces.
### 20130919:
### 20130919
* Fix processing custom framework prefixes (by Johannes J. Schmidt).
* Concat outputs if several files compiled to one output.
* Decrease standalone build size by removing unnecessary Binary class.
* iOS 7 is moved to released versions.
* Clean up binary code (by Simon Lydell).
### 20130923:
### 20130923
* Firefox 24 is moved to released versions.
### 20131001:
### 20131001
* Add support for grab, grabbing, zoom-in and zoom-out cursor values.
### 20131006:
### 20131006
* Chrome 30 is moved to released versions.
### 20131007:
### 20131007
* Don’t add another prefixes in rule with prefixed selector.
### 20131009:
### 20131009
* Opera 17 is moved to released versions.
### 20131015:
### 20131015
* Fix converting multiple gradients to old webkit syntax (by Aleksei Androsov).
### 20131017:
### 20131017
* Fix @host at-rule parsing.
### 20131020:
### 20131020
* IE 11 and Andrid 4.3 is moved to released versions.
* Add Opera 18 data.
* Add @namespace support.
* Sort browser versions in data file.
### 20131029:
### 20131029
* Add Safari 6.1 data.
* Add fx alias for Firefox.
### 20131104:
### 20131104
* Update Android future version to 4.4.
* Google Chrome 32 added to future versions list.
* Firefox 25 now is actual version, 27 and 28 added to future versions.
* Browsers statistics are updated.
### 20131205:
### 20131205
* Google Chrome 33 added to future releases list.
* Google Chrome 31 moved to current releases list.
### 20131209:
### 20131209
* Use old webkit gradients for old iOS and Safari (by Chad von Nau).
* Fix direction conversion for old webkit gradients (by Chad von Nau).
* Update browsers popularity statistics.
### 20131213:
### 20131213
* Firefox ESR in default browsers was changed to 24 version.
* Firefox 26 was moved to current releases list.
* Firefox 28 was added to future releases list.
@@ -628,21 +777,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Allow to load support data from Can I Use pull requests.
* Remove deprecated API.
### 20130806:
### 20130806
* Add hyphens support.
### 20130807:
### 20130807
* Add tab-size support.
* Add :fullscreen support.
### 20130808:
### 20130808
* Allow to select browser versions by > and >= operator.
* Fix flex properties in transition.
### 20130810:
### 20130810
* Add Firefox 25 data.
### 20130824:
### 20130824
* Add Chrome 31 and 30 data.
* Fix CSS comments parsing (by vladkens).
@@ -654,22 +803,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Add minor browsers in popularity select.
* Better syntax error messages.
### 20130721:
### 20130721
* Add Chrome 30 data.
### 20130728:
### 20130728
* Don’t remove non-standard -webkit-background-clip: text.
* Don’t remove IE hack on CSS parse.
### 20130729:
### 20130729
* Add Opera 16 data.
* Fix “Invalid range in character class” error on Firefox.
### 20130730:
### 20130730
* Fix correct clone comments inside keyframes (by Alexey Plutalov).
* Fix angle recalculation in gradients (by Roman Komarov).
### 20130731:
### 20130731
* Add border-image support.
## 0.5 “Ours is the Fury”
@@ -677,27 +826,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Use css, instead of Rework, to fix CSS parsing errors faster.
* Fix a lot of CSS parsing errors.
### 20130616:
### 20130616
* More useful message for CSS parsing errors.
* Remove old WebKit gradient syntax.
* Fix parsing error on comment with braces.
### 20130617:
### 20130617
* Remove old Mozilla border-radius.
* Don’t prefix old IE filter.
* Remove old background-clip, background-size and background-origin prefixes.
* Speed up regexps in values.
* Allow to hack property declarations.
### 20130625:
### 20130625
* Convert flexbox properties to 2009 and 2012 specifications.
* Improve messages on syntax errors.
### 20130626:
### 20130626
* Add Firefox 24 data.
* Add prefixes for font-feature-settings.
### 20130629:
### 20130629
* Fix convert flex properties to old box-flex.
## 0.4 “Winter Is Coming”
@@ -705,26 +854,26 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Add border-radius and box-shadow properties to database.
* Change degrees in webkit gradients.
### 20130515:
### 20130515
* Add old syntax in gradient direction.
* Add old syntax for display: flex.
* Update browser global usage statistics.
### 20130521:
### 20130521
* Add Firefox 23 data.
### 20130524:
### 20130524
* Add Chrome 29 data.
### 20130528:
### 20130528
* Fix compatibilty with Rework from git master.
* Add minor browsers to data, which can be selected only directly.
### 20130530:
### 20130530
* Add Opera 15 and iOS 6.1 data.
* Fix iOS versions in properties and values data.
### 20130603:
### 20130603
* Use latest Rework 0.15 with a lot of CSS parsing fixes.
* Update browsers usage statistics.
@@ -739,15 +888,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Add main to component config (by Jonathan Ong).
* Fix documentation (by Sergey Leschina and Mark Vasilkov).
### 20130424:
### 20130424
* Fix value override in prefixer.
### 20130427:
### 20130427
* Prefix several same values in one property.
* Fix Windows support in binary.
* Improve print errors in binary.
### 20130502:
### 20130502
* Don’t add -webkit- prefix to IE filter.
* Don’t duplicate prefixes on second run.
+678 -262
View File
File diff suppressed because it is too large Load Diff
-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/env node
process.stdout.write(require('../')().info() + '\n');
+617 -621
View File
File diff suppressed because it is too large Load Diff
+45 -46
View File
@@ -1,70 +1,69 @@
'use strict';
"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); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
var Prefixer = require('./prefixer');
var AtRule = function (_Prefixer) {
_inherits(AtRule, _Prefixer);
var AtRule =
/*#__PURE__*/
function (_Prefixer) {
_inheritsLoose(AtRule, _Prefixer);
function AtRule() {
_classCallCheck(this, AtRule);
function AtRule() {
return _Prefixer.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
var _proto = AtRule.prototype;
/**
/**
* Clone and add prefixes for at-rule
*/
AtRule.prototype.add = function add(rule, prefix) {
var prefixed = prefix + rule.name;
_proto.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;
});
var already = rule.parent.some(function (i) {
return i.name === prefixed && i.params === rule.params;
});
if (already) {
return undefined;
}
if (already) {
return undefined;
}
var cloned = this.clone(rule, { name: prefixed });
return rule.parent.insertBefore(rule, cloned);
};
/**
var cloned = this.clone(rule, {
name: prefixed
});
return rule.parent.insertBefore(rule, cloned);
}
/**
* Clone node with prefixes
*/
;
_proto.process = function process(node) {
var parent = this.parentPrefix(node);
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;
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;
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prefix = _ref;
var prefix = _ref;
if (!parent || parent === prefix) {
this.add(node, prefix);
}
}
};
if (!parent || parent === prefix) {
this.add(node, prefix);
}
}
};
return AtRule;
return AtRule;
}(Prefixer);
module.exports = AtRule;
+104 -89
View File
@@ -1,126 +1,141 @@
'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; };
"use strict";
var browserslist = require('browserslist');
var postcss = require('postcss');
var agents = require('caniuse-lite').agents;
var Browsers = require('./browsers');
var Prefixes = require('./prefixes');
var data = require('../data/prefixes');
var info = require('./info');
function isPlainObject(obj) {
return Object.prototype.toString.apply(obj) === '[object Object]';
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;
}
if (prefixes.browsers.selected.length === 0) {
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.');
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];
for (var _len = arguments.length, reqs = new Array(_len), _key = 0; _key < _len; _key++) {
reqs[_key] = arguments[_key];
}
var options;
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 brwlstOpts = {
ignoreUnknownVersions: options.ignoreUnknownVersions,
stats: options.stats
};
function loadPrefixes(opts) {
var d = module.exports.data;
var browsers = new Browsers(d.browsers, reqs, opts, brwlstOpts);
var key = browsers.selected.join(', ') + JSON.stringify(options);
if (!cache[key]) {
cache[key] = new Prefixes(d.prefixes, browsers, options);
}
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();
return cache[key];
}
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) {
options = {};
if (options.add !== false) {
prefixes.processor.add(css, result);
}
}
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');
}
plugin.options = options;
plugin.browsers = reqs;
if (options.browsers) {
reqs = options.browsers;
}
plugin.info = function (opts) {
opts = opts || {};
opts.from = opts.from || process.cwd();
return info(loadPrefixes(opts));
};
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;
return plugin;
});
/**
* Autoprefixer data
*/
module.exports.data = {
browsers: require('caniuse-lite').agents,
prefixes: require('../data/prefixes')
browsers: agents,
prefixes: data
/**
* Autoprefixer default browsers
*/
};
/**
* Autoprefixer default browsers
*/
module.exports.defaults = browserslist.defaults;
/**
* Inspect with default Autoprefixer
*/
module.exports.info = function () {
return module.exports().info();
return module.exports().info();
};
+49 -51
View File
@@ -1,71 +1,69 @@
'use strict';
"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];
};
function last(array) {
return array[array.length - 1];
}
var brackets = {
/**
/**
* Parse string to nodes tree
*/
parse: function parse(str) {
var current = [''];
var stack = [current];
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;
}
for (var i = 0; i < str.length; i++) {
var sym = str[i];
if (sym === ')') {
stack.pop();
current = last(stack);
current.push('');
continue;
}
if (sym === '(') {
current = [''];
last(stack).push(current);
stack.push(current);
continue;
}
current[current.length - 1] += sym;
}
if (sym === ')') {
stack.pop();
current = last(stack);
current.push('');
continue;
}
return stack[0];
},
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;
stringify: function stringify(ast) {
var result = '';
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
for (var _iterator = ast, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var i = _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object') {
result += '(' + brackets.stringify(i) + ')';
continue;
}
var i = _ref;
result += i;
}
return result;
if (typeof i === 'object') {
result += "(" + brackets.stringify(i) + ")";
continue;
}
result += i;
}
};
return result;
}
};
module.exports = brackets;
+72 -72
View File
@@ -1,99 +1,99 @@
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
"use strict";
var browserslist = require('browserslist');
var agents = require('caniuse-lite').agents;
var utils = require('./utils');
var Browsers = function () {
/**
var Browsers =
/*#__PURE__*/
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);
Browsers.prefixes = function prefixes() {
if (this.prefixesCache) {
return this.prefixesCache;
}
/**
this.prefixesCache = [];
for (var name in agents) {
this.prefixesCache.push("-" + agents[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 possible 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, browserslistOpts) {
this.data = data;
this.options = options || {};
this.browserslistOpts = browserslistOpts || {};
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
});
};
var _proto = Browsers.prototype;
/**
_proto.parse = function parse(requirements) {
var opts = {};
for (var i in this.browserslistOpts) {
opts[i] = this.browserslistOpts[i];
}
opts.path = this.options.from;
opts.env = this.options.env;
return browserslist(requirements, opts);
}
/**
* Return prefix for selected browser
*/
;
_proto.prefix = function prefix(browser) {
var _browser$split = browser.split(' '),
name = _browser$split[0],
version = _browser$split[1];
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];
var data = this.data[name];
if (!prefix) {
prefix = data.prefix;
}
var prefix = data.prefix_exceptions && data.prefix_exceptions[version];
if (!prefix) {
prefix = data.prefix;
}
return '-' + prefix + '-';
};
/**
return "-" + prefix + "-";
}
/**
* Is browser is selected by requirements
*/
;
_proto.isSelected = function isSelected(browser) {
return this.selected.indexOf(browser) !== -1;
};
Browsers.prototype.isSelected = function isSelected(browser) {
return this.selected.indexOf(browser) !== -1;
};
return Browsers;
return Browsers;
}();
module.exports = Browsers;
+178 -178
View File
@@ -1,261 +1,261 @@
'use strict';
"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); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
var Prefixer = require('./prefixer');
var Browsers = require('./browsers');
var utils = require('./utils');
var Declaration = function (_Prefixer) {
_inherits(Declaration, _Prefixer);
var Declaration =
/*#__PURE__*/
function (_Prefixer) {
_inheritsLoose(Declaration, _Prefixer);
function Declaration() {
_classCallCheck(this, Declaration);
function Declaration() {
return _Prefixer.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
var _proto = Declaration.prototype;
/**
/**
* Always true, because we already get prefixer by property name
*/
Declaration.prototype.check = function check() /* decl */{
return true;
};
/**
_proto.check = function check()
/* decl */
{
return true;
}
/**
* Return prefixed version of property
*/
;
Declaration.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + prop;
};
/**
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + prop;
}
/**
* Return unprefixed version of property
*/
;
Declaration.prototype.normalize = function normalize(prop) {
return prop;
};
/**
_proto.normalize = function normalize(prop) {
return prop;
}
/**
* Check `value`, that it contain other prefixes, rather than `prefix`
*/
;
_proto.otherPrefixes = function otherPrefixes(value, prefix) {
for (var _iterator = Browsers.prefixes(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
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;
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var other = _ref;
var other = _ref;
if (other === prefix) {
continue;
}
if (other === prefix) {
continue;
}
if (value.indexOf(other) !== -1) {
return true;
}
}
return false;
};
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;
};
/**
_proto.set = function set(decl, prefix) {
decl.prop = this.prefixed(decl.prop, prefix);
return decl;
}
/**
* Should we use visual cascade for prefixes
*/
;
_proto.needCascade = function needCascade(decl) {
if (!decl._autoprefixerCascade) {
decl._autoprefixerCascade = this.all.options.cascade !== false && decl.raw('before').indexOf('\n') !== -1;
}
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 decl._autoprefixerCascade;
}
/**
* Return maximum length of possible prefixed property
*/
;
_proto.maxPrefixed = function maxPrefixed(prefixes, decl) {
if (decl._autoprefixerMax) {
return decl._autoprefixerMax;
}
Declaration.prototype.maxPrefixed = function maxPrefixed(prefixes, decl) {
if (decl._autoprefixerMax) {
return decl._autoprefixerMax;
}
var max = 0;
var max = 0;
for (var _iterator2 = prefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
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;
}
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var prefix = _ref2;
var prefix = _ref2;
prefix = utils.removeNote(prefix);
prefix = utils.removeNote(prefix);
if (prefix.length > max) {
max = prefix.length;
}
}
decl._autoprefixerMax = max;
if (prefix.length > max) {
max = prefix.length;
}
}
return decl._autoprefixerMax;
};
/**
decl._autoprefixerMax = max;
return decl._autoprefixerMax;
}
/**
* Calculate indentation to create visual cascade
*/
;
_proto.calcBefore = function calcBefore(prefixes, decl, prefix) {
if (prefix === void 0) {
prefix = '';
}
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');
var max = this.maxPrefixed(prefixes, decl);
var diff = max - utils.removeNote(prefix).length;
if (diff > 0) {
before += Array(diff).fill(' ').join('');
}
var before = decl.raw('before');
if (diff > 0) {
before += Array(diff).fill(' ').join('');
}
return before;
};
/**
return before;
}
/**
* Remove visual cascade
*/
;
_proto.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];
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');
};
/**
if (last.length < min.length) {
min = last;
}
});
lines[lines.length - 1] = min;
decl.raws.before = lines.join('\n');
}
/**
* Clone and insert new declaration
*/
;
_proto.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;
});
Declaration.prototype.insert = function insert(decl, prefix, prefixes) {
var cloned = this.set(this.clone(decl), prefix);
if (!cloned) return undefined;
if (already) {
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);
}
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return decl.parent.insertBefore(decl, cloned);
};
/**
return decl.parent.insertBefore(decl, cloned);
}
/**
* Did this declaration has this prefix above
*/
;
_proto.isAlready = function isAlready(decl, prefixed) {
var already = this.all.group(decl).up(function (i) {
return i.prop === prefixed;
});
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;
};
if (!already) {
already = this.all.group(decl).down(function (i) {
return i.prop === prefixed;
});
}
/**
return already;
}
/**
* Clone and add prefixes for declaration
*/
;
_proto.add = function add(decl, prefix, prefixes, result) {
var prefixed = this.prefixed(decl.prop, prefix);
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);
};
if (this.isAlready(decl, prefixed) || this.otherPrefixes(decl.value, prefix)) {
return undefined;
}
/**
return this.insert(decl, prefix, prefixes, result);
}
/**
* Add spaces for visual cascade
*/
;
_proto.process = function process(decl, result) {
if (!this.needCascade(decl)) {
_Prefixer.prototype.process.call(this, decl, result);
Declaration.prototype.process = function process(decl, result) {
if (!this.needCascade(decl)) {
_Prefixer.prototype.process.call(this, decl, result);
return;
}
return;
}
var prefixes = _Prefixer.prototype.process.call(this, decl, result);
var prefixes = _Prefixer.prototype.process.call(this, decl, result);
if (!prefixes || !prefixes.length) {
return;
}
if (!prefixes || !prefixes.length) {
return;
}
this.restoreBefore(decl);
decl.raws.before = this.calcBefore(prefixes, decl);
};
/**
this.restoreBefore(decl);
decl.raws.before = this.calcBefore(prefixes, decl);
}
/**
* Return list of prefixed properties to clean old prefixes
*/
;
_proto.old = function old(prop, prefix) {
return [this.prefixed(prop, prefix)];
};
Declaration.prototype.old = function old(prop, prefix) {
return [this.prefixed(prop, prefix)];
};
return Declaration;
return Declaration;
}(Prefixer);
module.exports = Declaration;
+59 -63
View File
@@ -1,86 +1,82 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignContent = function (_Declaration) {
_inherits(AlignContent, _Declaration);
var AlignContent =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(AlignContent, _Declaration);
function AlignContent() {
_classCallCheck(this, AlignContent);
function AlignContent() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = AlignContent.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-line-pack';
}
/**
* Change property name for 2012 spec
*/
AlignContent.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
var _flexSpec = flexSpec(prefix);
_proto.normalize = function normalize() {
return 'align-content';
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
return prefix + 'flex-line-pack';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
if (spec === 2012) {
decl.value = AlignContent.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Return property name by final spec
*/
if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
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;
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'
}
});
_defineProperty(AlignContent, "names", ['align-content', 'flex-line-pack']);
_defineProperty(AlignContent, "oldValues", {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
/**
* Change property name for 2012 spec
*/
});
module.exports = AlignContent;
+56 -60
View File
@@ -1,83 +1,79 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignItems = function (_Declaration) {
_inherits(AlignItems, _Declaration);
var AlignItems =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(AlignItems, _Declaration);
function AlignItems() {
_classCallCheck(this, AlignItems);
function AlignItems() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = AlignItems.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-align';
}
/**
* Change property name for 2009 and 2012 specs
*/
AlignItems.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
if (spec === 2012) {
return prefix + 'flex-align';
}
var _flexSpec = flexSpec(prefix);
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.normalize = function normalize() {
return 'align-items';
}
/**
* Change value for 2009 and 2012 specs
*/
;
if (spec === 2009) {
return prefix + 'box-align';
} else if (spec === 2012) {
return prefix + 'flex-align';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
/**
* Return property name by final spec
*/
if (spec === 2009 || spec === 2012) {
decl.value = AlignItems.oldValues[decl.value] || decl.value;
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
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;
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'
}
});
_defineProperty(AlignItems, "names", ['align-items', 'flex-align', 'box-align']);
_defineProperty(AlignItems, "oldValues", {
'flex-end': 'end',
'flex-start': 'start'
/**
* Change property name for 2009 and 2012 specs
*/
});
module.exports = AlignItems;
+63 -61
View File
@@ -1,84 +1,86 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignSelf = function (_Declaration) {
_inherits(AlignSelf, _Declaration);
var AlignSelf =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(AlignSelf, _Declaration);
function AlignSelf() {
_classCallCheck(this, AlignSelf);
function AlignSelf() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = AlignSelf.prototype;
_proto.check = function check(decl) {
return decl.parent && decl.parent.every(function (i) {
return !/^grid-/.test(i.prop);
});
}
/**
* Change property name for 2012 specs
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-item-align';
}
/**
* Change property name for 2012 specs
*/
AlignSelf.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
var _flexSpec = flexSpec(prefix);
_proto.normalize = function normalize() {
return 'align-self';
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
return prefix + 'flex-item-align';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
if (spec === 2012) {
decl.value = AlignSelf.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Return property name by final spec
*/
if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
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;
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'
}
});
_defineProperty(AlignSelf, "names", ['align-self', 'flex-item-align']);
_defineProperty(AlignSelf, "oldValues", {
'flex-end': 'end',
'flex-start': 'start'
});
module.exports = AlignSelf;
+22 -27
View File
@@ -1,42 +1,37 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var Animation = function (_Declaration) {
_inherits(Animation, _Declaration);
var Animation =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Animation, _Declaration);
function Animation() {
_classCallCheck(this, Animation);
function Animation() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = Animation.prototype;
/**
* 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';
});
};
/**
* Don’t add prefixes for modern values.
*/
_proto.check = function check(decl) {
return !decl.value.split(/\s+/).some(function (i) {
var lower = i.toLowerCase();
return lower === 'reverse' || lower === 'alternate-reverse';
});
};
return Animation;
return Animation;
}(Declaration);
Object.defineProperty(Animation, 'names', {
enumerable: true,
writable: true,
value: ['animation', 'animation-direction']
});
_defineProperty(Animation, "names", ['animation', 'animation-direction']);
module.exports = Animation;
+23 -26
View File
@@ -1,44 +1,41 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var utils = require('../utils');
var Appearance = function (_Declaration) {
_inherits(Appearance, _Declaration);
var Appearance =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Appearance, _Declaration);
function Appearance(name, prefixes, all) {
_classCallCheck(this, Appearance);
function Appearance(name, prefixes, all) {
var _this;
var _this = _possibleConstructorReturn(this, _Declaration.call(this, name, prefixes, all));
_this = _Declaration.call(this, name, prefixes, all) || this;
if (_this.prefixes) {
_this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
if (i === '-ms-') {
return '-webkit-';
} else {
return i;
}
}));
if (_this.prefixes) {
_this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
if (i === '-ms-') {
return '-webkit-';
}
return _this;
return i;
}));
}
return Appearance;
return _this;
}
return Appearance;
}(Declaration);
Object.defineProperty(Appearance, 'names', {
enumerable: true,
writable: true,
value: ['appearance']
});
_defineProperty(Appearance, "names", ['appearance']);
module.exports = Appearance;
+24 -27
View File
@@ -1,43 +1,40 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var BackgroundSize = function (_Declaration) {
_inherits(BackgroundSize, _Declaration);
var BackgroundSize =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BackgroundSize, _Declaration);
function BackgroundSize() {
_classCallCheck(this, BackgroundSize);
function BackgroundSize() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BackgroundSize.prototype;
/**
* Duplication parameter for -webkit- browsers
*/
_proto.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;
}
/**
* 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 _Declaration.prototype.set.call(this, decl, prefix);
};
return BackgroundSize;
return BackgroundSize;
}(Declaration);
Object.defineProperty(BackgroundSize, 'names', {
enumerable: true,
writable: true,
value: ['background-size']
});
_defineProperty(BackgroundSize, "names", ['background-size']);
module.exports = BackgroundSize;
+32 -34
View File
@@ -1,52 +1,50 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var BlockLogical = function (_Declaration) {
_inherits(BlockLogical, _Declaration);
var BlockLogical =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BlockLogical, _Declaration);
function BlockLogical() {
_classCallCheck(this, BlockLogical);
function BlockLogical() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BlockLogical.prototype;
/**
* Use old syntax for -moz- and -webkit-
*/
_proto.prefixed = function prefixed(prop, prefix) {
if (prop.indexOf('-start') !== -1) {
return prefix + prop.replace('-block-start', '-before');
}
/**
* 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 prefix + prop.replace('-block-end', '-after');
}
/**
* Return property name by spec
*/
;
/**
* Return property name by spec
*/
_proto.normalize = function normalize(prop) {
if (prop.indexOf('-before') !== -1) {
return prop.replace('-before', '-block-start');
}
return prop.replace('-after', '-block-end');
};
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;
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']
});
_defineProperty(BlockLogical, "names", ['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;
+20 -25
View File
@@ -1,40 +1,35 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var BorderImage = function (_Declaration) {
_inherits(BorderImage, _Declaration);
var BorderImage =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BorderImage, _Declaration);
function BorderImage() {
_classCallCheck(this, BorderImage);
function BorderImage() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = BorderImage.prototype;
/**
* 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);
};
/**
* Remove fill parameter for prefixed declarations
*/
_proto.set = function set(decl, prefix) {
decl.value = decl.value.replace(/\s+fill(\s)/, '$1');
return _Declaration.prototype.set.call(this, decl, prefix);
};
return BorderImage;
return BorderImage;
}(Declaration);
Object.defineProperty(BorderImage, 'names', {
enumerable: true,
writable: true,
value: ['border-image']
});
_defineProperty(BorderImage, "names", ['border-image']);
module.exports = BorderImage;
+45 -57
View File
@@ -1,79 +1,67 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var BorderRadius = function (_Declaration) {
_inherits(BorderRadius, _Declaration);
var BorderRadius =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BorderRadius, _Declaration);
function BorderRadius() {
_classCallCheck(this, BorderRadius);
function BorderRadius() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BorderRadius.prototype;
/**
* Change syntax, when add Mozilla prefix
*/
_proto.prefixed = function prefixed(prop, prefix) {
if (prefix === '-moz-') {
return prefix + (BorderRadius.toMozilla[prop] || prop);
}
/**
* 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 _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return unprefixed version of property
*/
;
/**
* Return unprefixed version of property
*/
_proto.normalize = function normalize(prop) {
return BorderRadius.toNormal[prop] || prop;
};
BorderRadius.prototype.normalize = function normalize(prop) {
return BorderRadius.toNormal[prop] || prop;
};
return BorderRadius;
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: {}
});
_defineProperty(BorderRadius, "names", ['border-radius']);
_defineProperty(BorderRadius, "toMozilla", {});
_defineProperty(BorderRadius, "toNormal", {});
var _arr = ['top', 'bottom'];
for (var _i = 0; _i < _arr.length; _i++) {
var ver = _arr[_i];var _arr2 = ['left', 'right'];
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;
}
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;
+56 -65
View File
@@ -1,87 +1,78 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var BreakProps = function (_Declaration) {
_inherits(BreakProps, _Declaration);
var BreakProps =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BreakProps, _Declaration);
function BreakProps() {
_classCallCheck(this, BreakProps);
function BreakProps() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BreakProps.prototype;
/**
* Change name for -webkit- and -moz- prefix
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + "column-" + prop;
}
/**
* Return property name by final spec
*/
;
_proto.normalize = function normalize(prop) {
if (prop.indexOf('inside') !== -1) {
return 'break-inside';
}
/**
* 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;
}
};
if (prop.indexOf('before') !== -1) {
return 'break-before';
}
/**
* Return property name by final spec
*/
return 'break-after';
}
/**
* Change prefixed value for avoid-column and avoid-page
*/
;
_proto.set = function set(decl, prefix) {
if (decl.prop === 'break-inside' && decl.value === 'avoid-column' || decl.value === 'avoid-page') {
decl.value = 'avoid';
}
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';
}
};
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Don’t prefix some values
*/
;
/**
* Change prefixed value for avoid-column and avoid-page
*/
_proto.insert = function insert(decl, prefix, prefixes) {
if (decl.prop !== 'break-inside') {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
return undefined;
}
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);
};
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
};
/**
* 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;
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']
});
_defineProperty(BreakProps, "names", ['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;
+37 -39
View File
@@ -1,58 +1,56 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Value = require('../value');
var list = require('postcss').list;
var CrossFade = function (_Value) {
_inherits(CrossFade, _Value);
var CrossFade =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(CrossFade, _Value);
function CrossFade() {
_classCallCheck(this, CrossFade);
function CrossFade() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
}
var _proto = CrossFade.prototype;
CrossFade.prototype.replace = function replace(string, prefix) {
var _this2 = this;
_proto.replace = function replace(string, prefix) {
var _this = this;
return list.space(string).map(function (value) {
if (value.slice(0, +_this2.name.length + 1) !== _this2.name + '(') {
return value;
}
return list.space(string).map(function (value) {
if (value.slice(0, +_this.name.length + 1) !== _this.name + '(') {
return value;
}
var close = value.lastIndexOf(')');
var after = value.slice(close + 1);
var args = value.slice(_this2.name.length + 1, close);
var close = value.lastIndexOf(')');
var after = value.slice(close + 1);
var args = value.slice(_this.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(' ');
};
if (prefix === '-webkit-') {
var match = args.match(/\d*.?\d+%?/);
return CrossFade;
if (match) {
args = args.slice(match[0].length).trim();
args += ", " + match[0];
} else {
args += ', 0.5';
}
}
return prefix + _this.name + '(' + args + ')' + after;
}).join(' ');
};
return CrossFade;
}(Value);
Object.defineProperty(CrossFade, 'names', {
enumerable: true,
writable: true,
value: ['cross-fade']
});
_defineProperty(CrossFade, "names", ['cross-fade']);
module.exports = CrossFade;
+67 -73
View File
@@ -1,102 +1,96 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var OldValue = require('../old-value');
var Value = require('../value');
var DisplayFlex = function (_Value) {
_inherits(DisplayFlex, _Value);
var DisplayFlex =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(DisplayFlex, _Value);
function DisplayFlex(name, prefixes) {
_classCallCheck(this, DisplayFlex);
function DisplayFlex(name, prefixes) {
var _this;
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
_this = _Value.call(this, name, prefixes) || this;
if (name === 'display-flex') {
_this.name = 'flex';
}
return _this;
if (name === 'display-flex') {
_this.name = 'flex';
}
/**
* Faster check for flex value
*/
return _this;
}
/**
* Faster check for flex value
*/
DisplayFlex.prototype.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
var _proto = DisplayFlex.prototype;
/**
* Return value by spec
*/
_proto.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
}
/**
* Return value by spec
*/
;
_proto.prefixed = function prefixed(prefix) {
var spec, value;
DisplayFlex.prototype.prefixed = function prefixed(prefix) {
var spec = void 0,
value = void 0;
var _flexSpec = flexSpec(prefix);
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
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
*/
;
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;
}
_proto.replace = function replace(string, prefix) {
return this.prefixed(prefix);
}
/**
* Change value for old specs
*/
;
return prefix + value;
};
_proto.old = function old(prefix) {
var prefixed = this.prefixed(prefix);
if (!prefixed) return undefined;
return new OldValue(this.name, prefixed);
};
/**
* 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;
return DisplayFlex;
}(Value);
Object.defineProperty(DisplayFlex, 'names', {
enumerable: true,
writable: true,
value: ['display-flex', 'inline-flex']
});
_defineProperty(DisplayFlex, "names", ['display-flex', 'inline-flex']);
module.exports = DisplayFlex;
+24 -27
View File
@@ -1,46 +1,43 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Value = require('../value');
var DisplayGrid = function (_Value) {
_inherits(DisplayGrid, _Value);
var DisplayGrid =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(DisplayGrid, _Value);
function DisplayGrid(name, prefixes) {
_classCallCheck(this, DisplayGrid);
function DisplayGrid(name, prefixes) {
var _this;
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
_this = _Value.call(this, name, prefixes) || this;
if (name === 'display-grid') {
_this.name = 'grid';
}
return _this;
if (name === 'display-grid') {
_this.name = 'grid';
}
/**
* Faster check for flex value
*/
return _this;
}
/**
* Faster check for flex value
*/
DisplayGrid.prototype.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
var _proto = DisplayGrid.prototype;
return DisplayGrid;
_proto.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']
});
_defineProperty(DisplayGrid, "names", ['display-grid', 'inline-grid']);
module.exports = DisplayGrid;
+17 -21
View File
@@ -1,37 +1,33 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Value = require('../value');
var FilterValue = function (_Value) {
_inherits(FilterValue, _Value);
var FilterValue =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(FilterValue, _Value);
function FilterValue(name, prefixes) {
_classCallCheck(this, FilterValue);
function FilterValue(name, prefixes) {
var _this;
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
_this = _Value.call(this, name, prefixes) || this;
if (name === 'filter-function') {
_this.name = 'filter';
}
return _this;
if (name === 'filter-function') {
_this.name = 'filter';
}
return FilterValue;
return _this;
}
return FilterValue;
}(Value);
Object.defineProperty(FilterValue, 'names', {
enumerable: true,
writable: true,
value: ['filter', 'filter-function']
});
_defineProperty(FilterValue, "names", ['filter', 'filter-function']);
module.exports = FilterValue;
+20 -25
View File
@@ -1,40 +1,35 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var Filter = function (_Declaration) {
_inherits(Filter, _Declaration);
var Filter =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Filter, _Declaration);
function Filter() {
_classCallCheck(this, Filter);
function Filter() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = Filter.prototype;
/**
* 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;
};
/**
* Check is it Internet Explorer filter
*/
_proto.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;
return Filter;
}(Declaration);
Object.defineProperty(Filter, 'names', {
enumerable: true,
writable: true,
value: ['filter']
});
_defineProperty(Filter, "names", ['filter']);
module.exports = Filter;
+52 -57
View File
@@ -1,79 +1,74 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexBasis = function (_Declaration) {
_inherits(FlexBasis, _Declaration);
var FlexBasis =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexBasis, _Declaration);
function FlexBasis() {
_classCallCheck(this, FlexBasis);
function FlexBasis() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexBasis.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex-basis';
}
/**
* Return flex property for 2012 spec
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-preferred-size';
}
/**
* Return property name by final spec
*/
FlexBasis.prototype.normalize = function normalize() {
return 'flex-basis';
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
;
/**
* Return flex property for 2012 spec
*/
_proto.set = function set(decl, prefix) {
var spec;
var _flexSpec2 = flexSpec(prefix);
FlexBasis.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
var _flexSpec = flexSpec(prefix);
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
spec = _flexSpec[0];
prefix = _flexSpec[1];
return undefined;
};
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;
return FlexBasis;
}(Declaration);
Object.defineProperty(FlexBasis, 'names', {
enumerable: true,
writable: true,
value: ['flex-basis', 'flex-preferred-size']
});
_defineProperty(FlexBasis, "names", ['flex-basis', 'flex-preferred-size']);
module.exports = FlexBasis;
+81 -83
View File
@@ -1,112 +1,110 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexDirection = function (_Declaration) {
_inherits(FlexDirection, _Declaration);
var FlexDirection =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexDirection, _Declaration);
function FlexDirection() {
_classCallCheck(this, FlexDirection);
function FlexDirection() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexDirection.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex-direction';
}
/**
* Use two properties for 2009 spec
*/
;
_proto.insert = function insert(decl, prefix, prefixes) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
/**
* Return property name by final spec
*/
FlexDirection.prototype.normalize = function normalize() {
return 'flex-direction';
};
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
/**
* Use two properties for 2009 spec
*/
if (already) {
return undefined;
}
var v = decl.value;
var orient, dir;
FlexDirection.prototype.insert = function insert(decl, prefix, prefixes) {
var spec = 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 _flexSpec = flexSpec(prefix);
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
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;
}
decl.parent.insertBefore(decl, cloned);
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
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';
}
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
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);
return decl.parent.insertBefore(decl, cloned);
}
/**
* Clean two properties for 2009 spec
*/
;
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);
}
};
_proto.old = function old(prop, prefix) {
var spec;
/**
* Clean two properties for 2009 spec
*/
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
FlexDirection.prototype.old = function old(prop, prefix) {
var spec = void 0;
if (spec === 2009) {
return [prefix + 'box-orient', prefix + 'box-direction'];
} else {
return _Declaration.prototype.old.call(this, prop, prefix);
}
};
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;
return FlexDirection;
}(Declaration);
Object.defineProperty(FlexDirection, 'names', {
enumerable: true,
writable: true,
value: ['flex-direction', 'box-direction', 'box-orient']
});
_defineProperty(FlexDirection, "names", ['flex-direction', 'box-direction', 'box-orient']);
module.exports = FlexDirection;
+59 -59
View File
@@ -1,83 +1,83 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexFlow = function (_Declaration) {
_inherits(FlexFlow, _Declaration);
var FlexFlow =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexFlow, _Declaration);
function FlexFlow() {
_classCallCheck(this, FlexFlow);
function FlexFlow() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexFlow.prototype;
/**
* Use two properties for 2009 spec
*/
_proto.insert = function insert(decl, prefix, prefixes) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
/**
* Use two properties for 2009 spec
*/
FlexFlow.prototype.insert = function insert(decl, prefix, prefixes) {
var spec = void 0;
var values = decl.value.split(/\s+/).filter(function (i) {
return i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse';
});
var _flexSpec = flexSpec(prefix);
if (values.length === 0) {
return undefined;
}
spec = _flexSpec[0];
prefix = _flexSpec[1];
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
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;
}
if (already) {
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;
var value = values[0];
var orient = value.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
var dir = value.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
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);
decl.parent.insertBefore(decl, cloned);
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
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);
}
};
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return FlexFlow;
return decl.parent.insertBefore(decl, cloned);
};
return FlexFlow;
}(Declaration);
Object.defineProperty(FlexFlow, 'names', {
enumerable: true,
writable: true,
value: ['flex-flow', 'box-direction', 'box-orient']
});
_defineProperty(FlexFlow, "names", ['flex-flow', 'box-direction', 'box-orient']);
module.exports = FlexFlow;
+41 -44
View File
@@ -1,62 +1,59 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var Flex = function (_Declaration) {
_inherits(Flex, _Declaration);
var Flex =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Flex, _Declaration);
function Flex() {
_classCallCheck(this, Flex);
function Flex() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = Flex.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex';
}
/**
* Return flex property for 2009 and 2012 specs
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
}
/**
* Return property name by final spec
*/
Flex.prototype.normalize = function normalize() {
return 'flex';
};
if (spec === 2012) {
return prefix + 'flex-positive';
}
/**
* Return flex property for 2009 and 2012 specs
*/
return _Declaration.prototype.prefixed.call(this, prop, prefix);
};
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;
return Flex;
}(Declaration);
Object.defineProperty(Flex, 'names', {
enumerable: true,
writable: true,
value: ['flex-grow', 'flex-positive']
});
_defineProperty(Flex, "names", ['flex-grow', 'flex-positive']);
module.exports = Flex;
+52 -57
View File
@@ -1,79 +1,74 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexShrink = function (_Declaration) {
_inherits(FlexShrink, _Declaration);
var FlexShrink =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexShrink, _Declaration);
function FlexShrink() {
_classCallCheck(this, FlexShrink);
function FlexShrink() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexShrink.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex-shrink';
}
/**
* Return flex property for 2012 spec
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-negative';
}
/**
* Return property name by final spec
*/
FlexShrink.prototype.normalize = function normalize() {
return 'flex-shrink';
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
;
/**
* Return flex property for 2012 spec
*/
_proto.set = function set(decl, prefix) {
var spec;
var _flexSpec2 = flexSpec(prefix);
FlexShrink.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
var _flexSpec = flexSpec(prefix);
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
spec = _flexSpec[0];
prefix = _flexSpec[1];
return undefined;
};
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;
return FlexShrink;
}(Declaration);
Object.defineProperty(FlexShrink, 'names', {
enumerable: true,
writable: true,
value: ['flex-shrink', 'flex-negative']
});
_defineProperty(FlexShrink, "names", ['flex-shrink', 'flex-negative']);
module.exports = FlexShrink;
+14 -13
View File
@@ -1,21 +1,22 @@
'use strict';
"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';
}
var spec;
if (prefix === '-webkit- 2009') {
prefix = '-webkit-';
}
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
spec = 2009;
} else if (prefix === '-ms-') {
spec = 2012;
} else if (prefix === '-webkit-') {
spec = 'final';
}
return [spec, prefix];
if (prefix === '-webkit- 2009') {
prefix = '-webkit-';
}
return [spec, prefix];
};
+25 -27
View File
@@ -1,44 +1,42 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexWrap = function (_Declaration) {
_inherits(FlexWrap, _Declaration);
var FlexWrap =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexWrap, _Declaration);
function FlexWrap() {
_classCallCheck(this, FlexWrap);
function FlexWrap() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexWrap.prototype;
/**
* Don't add prefix for 2009 spec
*/
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec !== 2009) {
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* 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 undefined;
};
return FlexWrap;
return FlexWrap;
}(Declaration);
Object.defineProperty(FlexWrap, 'names', {
enumerable: true,
writable: true,
value: ['flex-wrap']
});
_defineProperty(FlexWrap, "names", ['flex-wrap']);
module.exports = FlexWrap;
+62 -65
View File
@@ -1,91 +1,88 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var list = require('postcss').list;
var Flex = function (_Declaration) {
_inherits(Flex, _Declaration);
var Flex =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Flex, _Declaration);
function Flex() {
_classCallCheck(this, Flex);
function Flex() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = Flex.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
}
/**
* Change property name for 2009 spec
*/
Flex.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
var _flexSpec = flexSpec(prefix);
_proto.normalize = function normalize() {
return 'flex';
}
/**
* Spec 2009 supports only first argument
* Spec 2012 disallows unitless basis
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009) {
return prefix + 'box-flex';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
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);
}
/**
* Return property name by final spec
*/
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(' ');
}
}
Flex.prototype.normalize = function normalize() {
return 'flex';
};
return _Declaration.prototype.set.call(this, decl, prefix);
};
/**
* 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;
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'
}
});
_defineProperty(Flex, "names", ['flex', 'box-flex']);
_defineProperty(Flex, "oldValues", {
auto: '1',
none: '0'
/**
* Change property name for 2009 spec
*/
});
module.exports = Flex;
+26 -29
View File
@@ -1,45 +1,42 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Selector = require('../selector');
var Fullscreen = function (_Selector) {
_inherits(Fullscreen, _Selector);
var Fullscreen =
/*#__PURE__*/
function (_Selector) {
_inheritsLoose(Fullscreen, _Selector);
function Fullscreen() {
_classCallCheck(this, Fullscreen);
function Fullscreen() {
return _Selector.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Selector.apply(this, arguments));
var _proto = Fullscreen.prototype;
/**
* Return different selectors depend on prefix
*/
_proto.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return ':-webkit-full-screen';
}
/**
* 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';
}
};
if (prefix === '-moz-') {
return ':-moz-full-screen';
}
return Fullscreen;
return ":" + prefix + "fullscreen";
};
return Fullscreen;
}(Selector);
Object.defineProperty(Fullscreen, 'names', {
enumerable: true,
writable: true,
value: [':fullscreen']
});
_defineProperty(Fullscreen, "names", [':fullscreen']);
module.exports = Fullscreen;
+510 -452
View File
File diff suppressed because it is too large Load Diff
+35 -67
View File
@@ -1,86 +1,54 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridArea = function (_Declaration) {
_inherits(GridArea, _Declaration);
var utils = require('./grid-utils');
function GridArea() {
_classCallCheck(this, GridArea);
var GridArea =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridArea, _Declaration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
function GridArea() {
return _Declaration.apply(this, arguments) || this;
}
/**
* 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);
var _proto = GridArea.prototype;
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-row';
})) {
return undefined;
}
/**
* Translate grid-area to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var values = utils.parse(decl);
var values = shorthand.parse(decl);
var _utils$translate = utils.translate(values, 0, 2),
rowStart = _utils$translate[0],
rowSpan = _utils$translate[1];
var _shorthand$translate = shorthand.translate(values, 0, 2),
rowStart = _shorthand$translate[0],
rowSpan = _shorthand$translate[1];
var _utils$translate2 = utils.translate(values, 1, 3),
columnStart = _utils$translate2[0],
columnSpan = _utils$translate2[1];
var _shorthand$translate2 = shorthand.translate(values, 1, 3),
columnStart = _shorthand$translate2[0],
columnSpan = _shorthand$translate2[1];
[['grid-row', rowStart], ['grid-row-span', rowSpan], ['grid-column', columnStart], ['grid-column-span', columnSpan]].forEach(function (_ref) {
var prop = _ref[0],
value = _ref[1];
utils.insertDecl(decl, prop, value);
});
utils.warnTemplateSelectorNotFound(decl, result);
utils.warnIfGridRowColumnExists(decl, result);
return undefined;
};
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;
return GridArea;
}(Declaration);
Object.defineProperty(GridArea, 'names', {
enumerable: true,
writable: true,
value: ['grid-area']
});
_defineProperty(GridArea, "names", ['grid-area']);
module.exports = GridArea;
+33 -40
View File
@@ -1,57 +1,50 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var GridColumnAlign = function (_Declaration) {
_inherits(GridColumnAlign, _Declaration);
var GridColumnAlign =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridColumnAlign, _Declaration);
function GridColumnAlign() {
_classCallCheck(this, GridColumnAlign);
function GridColumnAlign() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = GridColumnAlign.prototype;
/**
* Do not prefix flexbox values
*/
GridColumnAlign.prototype.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
};
/**
* Do not prefix flexbox values
*/
_proto.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
}
/**
* Change property name for IE
*/
;
/**
* Change property name for IE
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-column-align';
}
/**
* Change IE property back
*/
;
_proto.normalize = function normalize() {
return 'justify-self';
};
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;
return GridColumnAlign;
}(Declaration);
Object.defineProperty(GridColumnAlign, 'names', {
enumerable: true,
writable: true,
value: ['grid-column-align']
});
_defineProperty(GridColumnAlign, "names", ['grid-column-align']);
module.exports = GridColumnAlign;
+45 -54
View File
@@ -1,73 +1,64 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var GridEnd = function (_Declaration) {
_inherits(GridEnd, _Declaration);
var GridEnd =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridEnd, _Declaration);
function GridEnd() {
_classCallCheck(this, GridEnd);
function GridEnd() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = GridEnd.prototype;
/**
* Change repeating syntax for IE
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var clonedDecl = this.clone(decl);
var startProp = decl.prop.replace(/end$/, 'start');
var spanProp = prefix + decl.prop.replace(/end$/, 'span');
if (decl.parent.some(function (i) {
return i.prop === spanProp;
})) {
return undefined;
}
/**
* Do not add prefix for unsupported value in IE
*/
GridEnd.prototype.check = function check(decl) {
return decl.value.indexOf('span') !== -1;
};
clonedDecl.prop = spanProp;
/**
* Return a final spec property
*/
if (decl.value.includes('span')) {
clonedDecl.value = decl.value.replace(/span\s/i, '');
} else {
var startDecl;
decl.parent.walkDecls(startProp, function (d) {
startDecl = d;
});
if (startDecl) {
var value = Number(decl.value) - Number(startDecl.value) + '';
clonedDecl.value = value;
} else {
decl.warn(result, "Can not prefix " + decl.prop + " (" + startProp + " is not found)");
}
}
GridEnd.prototype.normalize = function normalize(prop) {
return prop.replace(/(-span|-end)/, '');
};
decl.cloneBefore(clonedDecl);
return undefined;
};
/**
* 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;
return GridEnd;
}(Declaration);
Object.defineProperty(GridEnd, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-end', 'grid-column-end', 'grid-row-span', 'grid-column-span']
});
_defineProperty(GridEnd, "names", ['grid-row-end', 'grid-column-end']);
module.exports = GridEnd;
+33 -40
View File
@@ -1,57 +1,50 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var GridRowAlign = function (_Declaration) {
_inherits(GridRowAlign, _Declaration);
var GridRowAlign =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridRowAlign, _Declaration);
function GridRowAlign() {
_classCallCheck(this, GridRowAlign);
function GridRowAlign() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = GridRowAlign.prototype;
/**
* Do not prefix flexbox values
*/
GridRowAlign.prototype.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
};
/**
* Do not prefix flexbox values
*/
_proto.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
}
/**
* Change property name for IE
*/
;
/**
* Change property name for IE
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-row-align';
}
/**
* Change IE property back
*/
;
_proto.normalize = function normalize() {
return 'align-self';
};
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;
return GridRowAlign;
}(Declaration);
Object.defineProperty(GridRowAlign, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-align']
});
_defineProperty(GridRowAlign, "names", ['grid-row-align']);
module.exports = GridRowAlign;
+38 -46
View File
@@ -1,62 +1,54 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridRowColumn = function (_Declaration) {
_inherits(GridRowColumn, _Declaration);
var utils = require('./grid-utils');
function GridRowColumn() {
_classCallCheck(this, GridRowColumn);
var GridRowColumn =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridRowColumn, _Declaration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
function GridRowColumn() {
return _Declaration.apply(this, arguments) || this;
}
var _proto = GridRowColumn.prototype;
/**
* Translate grid-row / grid-column to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var values = utils.parse(decl);
var _utils$translate = utils.translate(values, 0, 1),
start = _utils$translate[0],
span = _utils$translate[1];
var hasStartValueSpan = values[0] && values[0].includes('span');
if (hasStartValueSpan) {
span = values[0].join('').replace(/\D/g, '');
}
/**
* 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);
[[decl.prop, start], [decl.prop + "-span", span]].forEach(function (_ref) {
var prop = _ref[0],
value = _ref[1];
utils.insertDecl(decl, prop, value);
});
return undefined;
};
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;
return GridRowColumn;
}(Declaration);
Object.defineProperty(GridRowColumn, 'names', {
enumerable: true,
writable: true,
value: ['grid-row', 'grid-column']
});
_defineProperty(GridRowColumn, "names", ['grid-row', 'grid-column']);
module.exports = GridRowColumn;
+123 -39
View File
@@ -1,65 +1,149 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridRowsColumns = function (_Declaration) {
_inherits(GridRowsColumns, _Declaration);
var _require = require('./grid-utils'),
prefixTrackProp = _require.prefixTrackProp,
prefixTrackValue = _require.prefixTrackValue,
autoplaceGridItems = _require.autoplaceGridItems,
getGridGap = _require.getGridGap,
inheritGridGap = _require.inheritGridGap;
function GridRowsColumns() {
_classCallCheck(this, GridRowsColumns);
var Processor = require('../processor');
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var GridRowsColumns =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridRowsColumns, _Declaration);
function GridRowsColumns() {
return _Declaration.apply(this, arguments) || this;
}
var _proto = GridRowsColumns.prototype;
/**
* Change property name for IE
*/
_proto.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return prefixTrackProp({
prop: prop,
prefix: prefix
});
}
/**
* 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);
}
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Change IE property back
*/
;
_proto.normalize = function normalize(prop) {
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1');
};
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var parent = decl.parent,
prop = decl.prop,
value = decl.value;
var isRowProp = prop.includes('rows');
var isColumnProp = prop.includes('columns');
var hasGridTemplate = parent.some(function (i) {
return i.prop === 'grid-template' || i.prop === 'grid-template-areas';
});
/**
* Change IE property back
* Not to prefix rows declaration if grid-template(-areas) is present
*/
if (hasGridTemplate && isRowProp) {
return false;
}
GridRowsColumns.prototype.normalize = function normalize(prop) {
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1');
};
var processor = new Processor({});
var status = processor.gridStatus(parent, result);
var gap = getGridGap(decl);
gap = inheritGridGap(decl, gap) || gap;
var gapValue = isRowProp ? gap.row : gap.column;
if ((status === 'no-autoplace' || status === true) && !hasGridTemplate) {
gapValue = null;
}
var prefixValue = prefixTrackValue({
value: value,
gap: gapValue
});
/**
* Change repeating syntax for IE
* Insert prefixes
*/
decl.cloneBefore({
prop: prefixTrackProp({
prop: prop,
prefix: prefix
}),
value: prefixValue
});
var autoflow = parent.nodes.find(function (i) {
return i.prop === 'grid-auto-flow';
});
var autoflowValue = 'row';
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);
};
if (autoflow && !processor.disabled(autoflow, result)) {
autoflowValue = autoflow.value.trim();
}
return GridRowsColumns;
if (status === 'autoplace') {
/**
* Show warning if grid-template-rows decl is not found
*/
var rowDecl = parent.nodes.find(function (i) {
return i.prop === 'grid-template-rows';
});
if (!rowDecl && hasGridTemplate) {
return undefined;
} else if (!rowDecl && !hasGridTemplate) {
decl.warn(result, "Autoplacement does not work without grid-template-rows property");
return undefined;
}
/**
* Show warning if grid-template-columns decl is not found
*/
var columnDecl = parent.nodes.find(function (i) {
return i.prop === 'grid-template-columns';
});
if (!columnDecl && !hasGridTemplate) {
decl.warn(result, "Autoplacement does not work without grid-template-columns property");
}
/**
* Autoplace grid items
*/
if (isColumnProp && !hasGridTemplate) {
autoplaceGridItems(decl, result, gap, autoflowValue);
}
}
return undefined;
};
return GridRowsColumns;
}(Declaration);
Object.defineProperty(GridRowsColumns, 'names', {
enumerable: true,
writable: true,
value: ['grid-template-rows', 'grid-template-columns', 'grid-rows', 'grid-columns']
});
_defineProperty(GridRowsColumns, "names", ['grid-template-rows', 'grid-template-columns', 'grid-rows', 'grid-columns']);
module.exports = GridRowsColumns;
-160
View File
@@ -1,160 +0,0 @@
'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
};
+41 -46
View File
@@ -1,62 +1,57 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var GridStart = function (_Declaration) {
_inherits(GridStart, _Declaration);
var GridStart =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridStart, _Declaration);
function GridStart() {
_classCallCheck(this, GridStart);
function GridStart() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = GridStart.prototype;
/**
* Do not add prefix for unsupported value in IE
*/
_proto.check = function check(decl) {
var value = decl.value;
return value.indexOf('/') === -1 || value.indexOf('span') !== -1;
}
/**
* Return a final spec property
*/
;
_proto.normalize = function normalize(prop) {
return prop.replace('-start', '');
}
/**
* Change property name for IE
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-ms-') {
result = result.replace('-start', '');
}
/**
* 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 result;
};
/**
* 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;
return GridStart;
}(Declaration);
Object.defineProperty(GridStart, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-start', 'grid-column-start']
});
_defineProperty(GridStart, "names", ['grid-row-start', 'grid-column-start']);
module.exports = GridStart;
+79 -113
View File
@@ -1,137 +1,103 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var DOTS = /^\.+$/;
var _require = require('./grid-utils'),
parseGridAreas = _require.parseGridAreas,
warnMissedAreas = _require.warnMissedAreas,
prefixTrackProp = _require.prefixTrackProp,
prefixTrackValue = _require.prefixTrackValue,
getGridGap = _require.getGridGap,
warnGridGap = _require.warnGridGap,
inheritGridGap = _require.inheritGridGap;
function track(start, end) {
return { start: start, end: end, span: end - start };
function getGridRows(tpl) {
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
}
function getRows(tpl) {
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
}
var GridTemplateAreas =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridTemplateAreas, _Declaration);
function getColumns(line) {
return line.trim().split(/\s+/g);
}
function GridTemplateAreas() {
return _Declaration.apply(this, arguments) || this;
}
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;
var _proto = GridTemplateAreas.prototype;
/**
* Translate grid-template-areas to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var hasColumns = false;
var hasRows = false;
var parent = decl.parent;
var gap = getGridGap(decl);
gap = inheritGridGap(decl, gap) || gap; // remove already prefixed rows
// to prevent doubling prefixes
column.start = Math.min(column.start, columnIndex + 1);
column.end = Math.max(column.end, columnIndex + 2);
column.span = column.end - column.start;
parent.walkDecls(/-ms-grid-rows/, function (i) {
return i.remove();
}); // add empty tracks to rows
row.start = Math.min(row.start, rowIndex + 1);
row.end = Math.max(row.end, rowIndex + 2);
row.span = row.end - row.start;
}
parent.walkDecls(/grid-template-(rows|columns)/, function (trackDecl) {
if (trackDecl.prop === 'grid-template-rows') {
hasRows = true;
var prop = trackDecl.prop,
value = trackDecl.value;
trackDecl.cloneBefore({
prop: prefixTrackProp({
prop: prop,
prefix: prefix
}),
value: prefixTrackValue({
value: value,
gap: gap.row
})
});
return areas;
}, {});
}
} else {
hasColumns = true;
}
});
var gridRows = getGridRows(decl.value);
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
*/
if (hasColumns && !hasRows && gap.row && gridRows.length > 1) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: prefixTrackValue({
value: "repeat(" + gridRows.length + ", auto)",
gap: gap.row
}),
raws: {}
});
} // warnings
GridTemplateAreas.prototype.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
warnGridGap({
gap: gap,
hasColumns: hasColumns,
decl: decl,
result: result
});
var areas = parseGridAreas({
rows: gridRows,
gap: gap
});
warnMissedAreas(areas, decl, result);
return decl;
};
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;
return GridTemplateAreas;
}(Declaration);
Object.defineProperty(GridTemplateAreas, 'names', {
enumerable: true,
writable: true,
value: ['grid-template-areas']
});
_defineProperty(GridTemplateAreas, "names", ['grid-template-areas']);
module.exports = GridTemplateAreas;
+69 -52
View File
@@ -1,75 +1,92 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridTemplate = function (_Declaration) {
_inherits(GridTemplate, _Declaration);
var _require = require('./grid-utils'),
parseTemplate = _require.parseTemplate,
warnMissedAreas = _require.warnMissedAreas,
getGridGap = _require.getGridGap,
warnGridGap = _require.warnGridGap,
inheritGridGap = _require.inheritGridGap;
function GridTemplate() {
_classCallCheck(this, GridTemplate);
var GridTemplate =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridTemplate, _Declaration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
function GridTemplate() {
return _Declaration.apply(this, arguments) || this;
}
var _proto = GridTemplate.prototype;
/**
* Translate grid-template to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
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 gap = getGridGap(decl);
/**
* 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('\'');
};
* we must insert inherited gap values in some cases:
* if we are inside media query && if we have no grid-gap value
*/
/**
* Translate grid-template to separate -ms- prefixed properties
*/
var inheritedGap = inheritGridGap(decl, gap);
var _parseTemplate = parseTemplate({
decl: decl,
gap: inheritedGap || gap
}),
rows = _parseTemplate.rows,
columns = _parseTemplate.columns,
areas = _parseTemplate.areas;
GridTemplate.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var hasAreas = Object.keys(areas).length > 0;
var hasRows = Boolean(rows);
var hasColumns = Boolean(columns);
warnGridGap({
gap: gap,
hasColumns: hasColumns,
decl: decl,
result: result
});
warnMissedAreas(areas, decl, result);
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-rows';
})) {
return undefined;
}
if (hasRows && hasColumns || hasAreas) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: rows,
raws: {}
});
}
var _shorthand$parseTempl = shorthand.parseTemplateShortcut(decl),
templateRows = _shorthand$parseTempl[0],
templateColumns = _shorthand$parseTempl[1];
if (hasColumns) {
decl.cloneBefore({
prop: '-ms-grid-columns',
value: columns,
raws: {}
});
}
if (templateRows) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: shorthand.changeRepeat(templateRows.join(''))
});
}
return decl;
};
if (templateColumns) {
decl.cloneBefore({
prop: '-ms-grid-columns',
value: shorthand.changeRepeat(templateColumns.join(''))
});
}
return decl;
};
return GridTemplate;
return GridTemplate;
}(Declaration);
Object.defineProperty(GridTemplate, 'names', {
enumerable: true,
writable: true,
value: ['grid-template']
});
_defineProperty(GridTemplate, "names", ['grid-template']);
module.exports = GridTemplate;
+54 -63
View File
@@ -1,82 +1,73 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var ImageRendering = function (_Declaration) {
_inherits(ImageRendering, _Declaration);
var ImageRendering =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(ImageRendering, _Declaration);
function ImageRendering() {
_classCallCheck(this, ImageRendering);
function ImageRendering() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = ImageRendering.prototype;
/**
* Add hack only for crisp-edges
*/
_proto.check = function check(decl) {
return decl.value === 'pixelated';
}
/**
* Change property name for IE
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return '-ms-interpolation-mode';
}
/**
* Add hack only for crisp-edges
*/
ImageRendering.prototype.check = function check(decl) {
return decl.value === 'pixelated';
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Change property and value for IE
*/
;
/**
* Change property name for IE
*/
_proto.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
*/
;
_proto.normalize = function normalize() {
return 'image-rendering';
}
/**
* Warn on old value
*/
;
ImageRendering.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return '-ms-interpolation-mode';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.process = function process(node, result) {
return _Declaration.prototype.process.call(this, node, result);
};
/**
* 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;
return ImageRendering;
}(Declaration);
Object.defineProperty(ImageRendering, 'names', {
enumerable: true,
writable: true,
value: ['image-rendering', 'interpolation-mode']
});
_defineProperty(ImageRendering, "names", ['image-rendering', 'interpolation-mode']);
module.exports = ImageRendering;
+24 -27
View File
@@ -1,43 +1,40 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Value = require('../value');
var ImageSet = function (_Value) {
_inherits(ImageSet, _Value);
var ImageSet =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(ImageSet, _Value);
function ImageSet() {
_classCallCheck(this, ImageSet);
function ImageSet() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
var _proto = ImageSet.prototype;
/**
* Use non-standard name for WebKit and Firefox
*/
_proto.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');
}
/**
* 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 fixed;
};
return ImageSet;
return ImageSet;
}(Value);
Object.defineProperty(ImageSet, 'names', {
enumerable: true,
writable: true,
value: ['image-set']
});
_defineProperty(ImageSet, "names", ['image-set']);
module.exports = ImageSet;
+26 -32
View File
@@ -1,48 +1,42 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var InlineLogical = function (_Declaration) {
_inherits(InlineLogical, _Declaration);
var InlineLogical =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(InlineLogical, _Declaration);
function InlineLogical() {
_classCallCheck(this, InlineLogical);
function InlineLogical() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = InlineLogical.prototype;
/**
* Use old syntax for -moz- and -webkit-
*/
InlineLogical.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + prop.replace('-inline', '');
};
/**
* Use old syntax for -moz- and -webkit-
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + prop.replace('-inline', '');
}
/**
* Return property name by spec
*/
;
/**
* Return property name by spec
*/
_proto.normalize = function normalize(prop) {
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2');
};
InlineLogical.prototype.normalize = function normalize(prop) {
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2');
};
return InlineLogical;
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']
});
_defineProperty(InlineLogical, "names", ['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;
+52 -51
View File
@@ -1,75 +1,76 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var OldValue = require('../old-value');
var Value = require('../value');
function _regexp(name) {
return new RegExp('(^|[\\s,(])(' + name + '($|[\\s),]))', 'gi');
return new RegExp("(^|[\\s,(])(" + name + "($|[\\s),]))", 'gi');
}
var Intrinsic = function (_Value) {
_inherits(Intrinsic, _Value);
var Intrinsic =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(Intrinsic, _Value);
function Intrinsic() {
_classCallCheck(this, Intrinsic);
function Intrinsic() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
var _proto = Intrinsic.prototype;
_proto.regexp = function regexp() {
if (!this.regexpCache) this.regexpCache = _regexp(this.name);
return this.regexpCache;
};
_proto.isStretch = function isStretch() {
return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
};
_proto.replace = function replace(string, prefix) {
if (prefix === '-moz-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-moz-available$3');
}
Intrinsic.prototype.regexp = function regexp() {
if (!this.regexpCache) this.regexpCache = _regexp(this.name);
return this.regexpCache;
};
if (prefix === '-webkit-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-webkit-fill-available$3');
}
Intrinsic.prototype.isStretch = function isStretch() {
return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
};
return _Value.prototype.replace.call(this, string, prefix);
};
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);
}
};
_proto.old = function old(prefix) {
var prefixed = prefix + this.name;
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));
};
if (this.isStretch()) {
if (prefix === '-moz-') {
prefixed = '-moz-available';
} else if (prefix === '-webkit-') {
prefixed = '-webkit-fill-available';
}
}
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 new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
};
return Intrinsic;
_proto.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']
});
_defineProperty(Intrinsic, "names", ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']);
module.exports = Intrinsic;
+64 -67
View File
@@ -1,91 +1,88 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var JustifyContent = function (_Declaration) {
_inherits(JustifyContent, _Declaration);
var JustifyContent =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(JustifyContent, _Declaration);
function JustifyContent() {
_classCallCheck(this, JustifyContent);
function JustifyContent() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = JustifyContent.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-pack';
}
/**
* Change property name for 2009 and 2012 specs
*/
JustifyContent.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
if (spec === 2012) {
return prefix + 'flex-pack';
}
var _flexSpec = flexSpec(prefix);
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.normalize = function normalize() {
return 'justify-content';
}
/**
* Change value for 2009 and 2012 specs
*/
;
if (spec === 2009) {
return prefix + 'box-pack';
} else if (spec === 2012) {
return prefix + 'flex-pack';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
/**
* Return property name by final spec
*/
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);
}
JustifyContent.prototype.normalize = function normalize() {
return 'justify-content';
};
return undefined;
};
/**
* 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;
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'
}
});
_defineProperty(JustifyContent, "names", ['justify-content', 'flex-pack', 'box-pack']);
_defineProperty(JustifyContent, "oldValues", {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
/**
* Change property name for 2009 and 2012 specs
*/
});
module.exports = JustifyContent;
+32 -36
View File
@@ -1,52 +1,48 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var MaskBorder = function (_Declaration) {
_inherits(MaskBorder, _Declaration);
var MaskBorder =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(MaskBorder, _Declaration);
function MaskBorder() {
_classCallCheck(this, MaskBorder);
function MaskBorder() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = MaskBorder.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return this.name.replace('box-image', 'border');
}
/**
* Return flex property for 2012 spec
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-webkit-') {
result = result.replace('border', 'box-image');
}
/**
* Return property name by final spec
*/
MaskBorder.prototype.normalize = function normalize() {
return this.name.replace('box-image', 'border');
};
return result;
};
/**
* 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;
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']
});
_defineProperty(MaskBorder, "names", ['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;
+52 -55
View File
@@ -1,77 +1,74 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var Order = function (_Declaration) {
_inherits(Order, _Declaration);
var Order =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Order, _Declaration);
function Order() {
_classCallCheck(this, Order);
function Order() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = Order.prototype;
/**
* Change property name for 2009 and 2012 specs
*/
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-ordinal-group';
}
/**
* Change property name for 2009 and 2012 specs
*/
Order.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
if (spec === 2012) {
return prefix + 'flex-order';
}
var _flexSpec = flexSpec(prefix);
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.normalize = function normalize() {
return 'order';
}
/**
* Fix value for 2009 spec
*/
;
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);
}
};
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
/**
* Return property name by final spec
*/
if (spec === 2009 && /\d/.test(decl.value)) {
decl.value = (parseInt(decl.value) + 1).toString();
return _Declaration.prototype.set.call(this, decl, prefix);
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
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;
return Order;
}(Declaration);
Object.defineProperty(Order, 'names', {
enumerable: true,
writable: true,
value: ['order', 'flex-order', 'box-ordinal-group']
});
_defineProperty(Order, "names", ['order', 'flex-order', 'box-ordinal-group']);
module.exports = Order;
+40 -41
View File
@@ -1,61 +1,60 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var OldValue = require('../old-value');
var Value = require('../value');
var Pixelated = function (_Value) {
_inherits(Pixelated, _Value);
var Pixelated =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(Pixelated, _Value);
function Pixelated() {
_classCallCheck(this, Pixelated);
function Pixelated() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
var _proto = Pixelated.prototype;
/**
* Use non-standard name for WebKit and Firefox
*/
_proto.replace = function replace(string, prefix) {
if (prefix === '-webkit-') {
return string.replace(this.regexp(), '$1-webkit-optimize-contrast');
}
/**
* 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);
}
};
if (prefix === '-moz-') {
return string.replace(this.regexp(), '$1-moz-crisp-edges');
}
/**
* Different name for WebKit and Firefox
*/
return _Value.prototype.replace.call(this, string, prefix);
}
/**
* Different name for WebKit and Firefox
*/
;
_proto.old = function old(prefix) {
if (prefix === '-webkit-') {
return new OldValue(this.name, '-webkit-optimize-contrast');
}
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);
}
};
if (prefix === '-moz-') {
return new OldValue(this.name, '-moz-crisp-edges');
}
return Pixelated;
return _Value.prototype.old.call(this, prefix);
};
return Pixelated;
}(Value);
Object.defineProperty(Pixelated, 'names', {
enumerable: true,
writable: true,
value: ['pixelated']
});
_defineProperty(Pixelated, "names", ['pixelated']);
module.exports = Pixelated;
+39 -39
View File
@@ -1,58 +1,58 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Selector = require('../selector');
var Placeholder = function (_Selector) {
_inherits(Placeholder, _Selector);
var Placeholder =
/*#__PURE__*/
function (_Selector) {
_inheritsLoose(Placeholder, _Selector);
function Placeholder() {
_classCallCheck(this, Placeholder);
function Placeholder() {
return _Selector.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Selector.apply(this, arguments));
var _proto = Placeholder.prototype;
/**
* Add old mozilla to possible prefixes
*/
_proto.possible = function possible() {
return _Selector.prototype.possible.call(this).concat(['-moz- old', '-ms- old']);
}
/**
* Return different selectors depend on prefix
*/
;
_proto.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-input-placeholder';
}
/**
* Add old mozilla to possible prefixes
*/
Placeholder.prototype.possible = function possible() {
return _Selector.prototype.possible.call(this).concat(['-moz- old', '-ms- old']);
};
if (prefix === '-ms-') {
return '::-ms-input-placeholder';
}
/**
* Return different selectors depend on prefix
*/
if (prefix === '-ms- old') {
return ':-ms-input-placeholder';
}
if (prefix === '-moz- old') {
return ':-moz-placeholder';
}
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 "::" + prefix + "placeholder";
};
return Placeholder;
return Placeholder;
}(Selector);
Object.defineProperty(Placeholder, 'names', {
enumerable: true,
writable: true,
value: ['::placeholder']
});
_defineProperty(Placeholder, "names", ['::placeholder']);
module.exports = Placeholder;
+21 -26
View File
@@ -1,43 +1,38 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var BASIC = ['none', 'underline', 'overline', 'line-through', 'blink', 'inherit', 'initial', 'unset'];
var TextDecoration = function (_Declaration) {
_inherits(TextDecoration, _Declaration);
var TextDecoration =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(TextDecoration, _Declaration);
function TextDecoration() {
_classCallCheck(this, TextDecoration);
function TextDecoration() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = TextDecoration.prototype;
/**
* 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;
});
};
/**
* Do not add prefixes for basic values.
*/
_proto.check = function check(decl) {
return decl.value.split(/\s+/).some(function (i) {
return BASIC.indexOf(i) === -1;
});
};
return TextDecoration;
return TextDecoration;
}(Declaration);
Object.defineProperty(TextDecoration, 'names', {
enumerable: true,
writable: true,
value: ['text-decoration']
});
_defineProperty(TextDecoration, "names", ['text-decoration']);
module.exports = TextDecoration;
+19 -23
View File
@@ -1,39 +1,35 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var TextEmphasisPosition = function (_Declaration) {
_inherits(TextEmphasisPosition, _Declaration);
var TextEmphasisPosition =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(TextEmphasisPosition, _Declaration);
function TextEmphasisPosition() {
_classCallCheck(this, TextEmphasisPosition);
function TextEmphasisPosition() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = TextEmphasisPosition.prototype;
_proto.set = function set(decl, prefix) {
if (prefix === '-webkit-') {
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '');
}
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 _Declaration.prototype.set.call(this, decl, prefix);
};
return TextEmphasisPosition;
return TextEmphasisPosition;
}(Declaration);
Object.defineProperty(TextEmphasisPosition, 'names', {
enumerable: true,
writable: true,
value: ['text-emphasis-position']
});
_defineProperty(TextEmphasisPosition, "names", ['text-emphasis-position']);
module.exports = TextEmphasisPosition;
+84 -90
View File
@@ -1,118 +1,112 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var TransformDecl = function (_Declaration) {
_inherits(TransformDecl, _Declaration);
var TransformDecl =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(TransformDecl, _Declaration);
function TransformDecl() {
_classCallCheck(this, TransformDecl);
function TransformDecl() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = TransformDecl.prototype;
/**
* Recursively check all parents for @keyframes
*/
_proto.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;
}
/**
* Recursively check all parents for @keyframes
*/
TransformDecl.prototype.keyframeParents = function keyframeParents(decl) {
var parent = decl.parent;
return false;
}
/**
* Is transform contain 3D commands
*/
;
while (parent) {
if (parent.type === 'atrule' && parent.name === 'keyframes') {
return true;
}
var _parent = parent;
parent = _parent.parent;
}
return false;
};
_proto.contain3d = function contain3d(decl) {
if (decl.prop === 'transform-origin') {
return false;
}
/**
* Is transform contain 3D commands
*/
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;
}
TransformDecl.prototype.contain3d = function contain3d(decl) {
if (decl.prop === 'transform-origin') {
return false;
}
var func = _ref;
for (var _iterator = TransformDecl.functions3d, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (decl.value.indexOf(func + "(") !== -1) {
return true;
}
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
return false;
}
/**
* Replace rotateZ to rotate for IE 9
*/
;
var func = _ref;
_proto.set = function set(decl, prefix) {
decl = _Declaration.prototype.set.call(this, decl, prefix);
if (decl.value.indexOf(func + '(') !== -1) {
return true;
}
}
if (prefix === '-ms-') {
decl.value = decl.value.replace(/rotateZ/gi, 'rotate');
}
return false;
};
return decl;
}
/**
* Don't add prefix for IE in keyframes
*/
;
/**
* Replace rotateZ to rotate for IE 9
*/
_proto.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;
};
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;
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']
});
_defineProperty(TransformDecl, "names", ['transform', 'transform-origin']);
_defineProperty(TransformDecl, "functions3d", ['matrix3d', 'translate3d', 'translateZ', 'scale3d', 'scaleZ', 'rotate3d', 'rotateX', 'rotateY', 'perspective']);
module.exports = TransformDecl;
+44 -33
View File
@@ -1,50 +1,61 @@
'use strict';
"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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
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); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Declaration = require('../declaration');
var WritingMode = function (_Declaration) {
_inherits(WritingMode, _Declaration);
var WritingMode =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(WritingMode, _Declaration);
function WritingMode() {
_classCallCheck(this, WritingMode);
function WritingMode() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = WritingMode.prototype;
_proto.insert = function insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
var cloned = this.set(this.clone(decl), prefix);
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
var direction = 'ltr';
decl.parent.nodes.forEach(function (i) {
if (i.prop === 'direction') {
if (i.value === 'rtl' || i.value === 'ltr') direction = i.value;
}
});
cloned.value = WritingMode.msValues[direction][decl.value] || decl.value;
return decl.parent.insertBefore(decl, cloned);
}
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 _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
};
return WritingMode;
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'
}
});
_defineProperty(WritingMode, "names", ['writing-mode']);
_defineProperty(WritingMode, "msValues", {
ltr: {
'horizontal-tb': 'lr-tb',
'vertical-rl': 'tb-rl',
'vertical-lr': 'tb-lr'
},
rtl: {
'horizontal-tb': 'rl-tb',
'vertical-rl': 'bt-rl',
'vertical-lr': 'bt-lr'
}
});
module.exports = WritingMode;
+144 -120
View File
@@ -1,152 +1,176 @@
'use strict';
"use strict";
var browserslist = require('browserslist');
function capitalize(str) {
return str.slice(0, 1).toUpperCase() + str.slice(1);
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 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;
};
function prefix(name, prefixes, note) {
var out = " " + name;
if (note) out += ' *';
out += ': ';
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';
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 versions = {};
for (var _iterator = prefixes.browsers.selected, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var _browser = _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var parts = _browser.split(' ');
var browser = _ref;
var _name2 = parts[0];
var version = parts[1];
_name2 = NAMES[_name2] || capitalize(_name2);
var _browser$split = browser.split(' '),
name = _browser$split[0],
version = _browser$split[1];
if (versions[_name2]) {
versions[_name2].push(version);
} else {
versions[_name2] = [version];
}
}
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.push(prefix(name, data.prefixes));
}
}
if (atrules.length > 0) {
out += "\nAt-Rules:\n" + atrules.sort().join('');
}
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 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 selector = _ref2;
if (selector.prefixes) {
selectors.push(prefix(selector.name, selector.prefixes));
}
}
if (selectors.length > 0) {
out += "\nSelectors:\n" + selectors.sort().join('');
}
var values = [];
var props = [];
var hadGrid = false;
for (var _name in prefixes.add) {
var _data = prefixes.add[_name];
if (_name[0] !== '@' && _data.prefixes) {
var grid = _name.indexOf('grid-') === 0;
if (grid) hadGrid = true;
props.push(prefix(_name, _data.prefixes, grid));
}
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;
if (!Array.isArray(_data.values)) {
continue;
}
var selectors = '';
for (var _iterator2 = prefixes.add.selectors, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
for (var _iterator3 = _data.values, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
var selector = _ref2;
var value = _ref3;
if (selector.prefixes) {
selectors += prefix(selector.name, selector.prefixes);
}
}
if (selectors !== '') {
out += '\nSelectors:\n' + selectors;
var _grid = value.name.indexOf('grid') !== -1;
if (_grid) hadGrid = true;
var string = prefix(value.name, value.prefixes, _grid);
if (values.indexOf(string) === -1) {
values.push(string);
}
}
}
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 (props.length > 0) {
out += "\nProperties:\n" + props.sort().join('');
}
if (!_data.values) {
continue;
}
for (var _iterator3 = _data.values, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (values.length > 0) {
out += "\nValues:\n" + values.sort().join('');
}
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
if (hadGrid) {
out += '\n* - Prefixes will be added only on grid: true option.\n';
}
var value = _ref3;
if (!atrules.length && !selectors.length && !props.length && !values.length) {
out += '\nAwesome! Your browsers don\'t require any vendor prefixes.' + '\nNow you can remove Autoprefixer from build steps.';
}
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;
return out;
};
+71 -70
View File
@@ -1,94 +1,95 @@
"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();
}
/**
var OldSelector =
/*#__PURE__*/
function () {
function OldSelector(selector, prefix) {
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;
var _proto = OldSelector.prototype;
while (index < rules.length) {
var before = rules[index].selector;
if (!before) {
return true;
}
_proto.isHack = function isHack(rule) {
var index = rule.parent.index(rule) + 1;
var rules = rule.parent.nodes;
if (before.indexOf(this.unprefixed) !== -1 && before.match(this.nameRegexp)) {
return false;
}
while (index < rules.length) {
var before = rules[index].selector;
var some = false;
for (var _iterator = this.prefixeds, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref2;
if (!before) {
return true;
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref2 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref2 = _i.value;
}
if (before.indexOf(this.unprefixed) !== -1 && before.match(this.nameRegexp)) {
return false;
}
var _ref = _ref2;
var string = _ref[0];
var regexp = _ref[1];
var some = false;
if (before.indexOf(string) !== -1 && before.match(regexp)) {
some = true;
break;
}
}
for (var _iterator = this.prefixeds, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (!some) {
return true;
}
index += 1;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
return true;
};
var _ref2 = _ref,
string = _ref2[0],
regexp = _ref2[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
*/
;
_proto.check = function check(rule) {
if (rule.selector.indexOf(this.prefixed) === -1) {
return false;
}
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;
};
if (!rule.selector.match(this.regexp)) {
return false;
}
return OldSelector;
if (this.isHack(rule)) {
return false;
}
return true;
};
return OldSelector;
}();
module.exports = OldSelector;
+21 -21
View File
@@ -1,32 +1,32 @@
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
"use strict";
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);
}
/**
var OldValue =
/*#__PURE__*/
function () {
function OldValue(unprefixed, prefixed, string, regexp) {
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;
};
var _proto = OldValue.prototype;
return OldValue;
_proto.check = function check(value) {
if (value.indexOf(this.string) !== -1) {
return !!value.match(this.regexp);
}
return false;
};
return OldValue;
}();
module.exports = OldValue;
+136 -148
View File
@@ -1,188 +1,176 @@
'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"); } }
"use strict";
var Browsers = require('./browsers');
var utils = require('./utils');
var vendor = require('postcss').vendor;
/**
* Recursivly clone objects
* Recursively clone objects
*/
function _clone(obj, parent) {
var cloned = new obj.constructor();
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;
var _arr = Object.keys(obj || {});
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
for (var _i = 0; _i < _arr.length; _i++) {
var i = _arr[_i];
var value = obj[i];
var i = _ref;
if (i === 'parent' && 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 === 'object' && value !== null) {
value = _clone(value, cloned);
}
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;
}
cloned[i] = value;
}
}
return cloned;
}
var Prefixer =
/*#__PURE__*/
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;
}
};
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;
}
/**
function Prefixer(name, prefixes, all) {
this.prefixes = prefixes;
this.name = name;
this.all = all;
}
/**
* Find prefix in node parents
*/
Prefixer.prototype.parentPrefix = function parentPrefix(node) {
var prefix = void 0;
var _proto = Prefixer.prototype;
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);
}
_proto.parentPrefix = function parentPrefix(node) {
var prefix;
if (Browsers.prefixes().indexOf(prefix) === -1) {
prefix = false;
}
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);
}
node._autoprefixerPrefix = prefix;
if (Browsers.prefixes().indexOf(prefix) === -1) {
prefix = false;
}
return node._autoprefixerPrefix;
};
/**
node._autoprefixerPrefix = prefix;
return node._autoprefixerPrefix;
}
/**
* Clone node with prefixes
*/
;
_proto.process = function process(node, result) {
if (!this.check(node)) {
return undefined;
}
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 = [];
var parent = this.parentPrefix(node);
for (var _iterator = prefixes, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var prefixes = this.prefixes.filter(function (prefix) {
return !parent || parent === utils.removeNote(prefix);
});
if (_isArray) {
if (_i2 >= _iterator.length) break;
_ref = _iterator[_i2++];
} else {
_i2 = _iterator.next();
if (_i2.done) break;
_ref = _i2.value;
}
var added = [];
for (var _iterator2 = prefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
var prefix = _ref;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
if (this.add(node, prefix, added.concat([prefix]), result)) {
added.push(prefix);
}
}
var prefix = _ref2;
if (this.add(node, prefix, added.concat([prefix]), result)) {
added.push(prefix);
}
}
return added;
};
/**
return added;
}
/**
* Shortcut for Prefixer.clone
*/
;
_proto.clone = function clone(node, overrides) {
return Prefixer.clone(node, overrides);
};
Prefixer.prototype.clone = function clone(node, overrides) {
return Prefixer.clone(node, overrides);
};
return Prefixer;
return Prefixer;
}();
module.exports = Prefixer;
+420 -390
View File
@@ -1,23 +1,29 @@
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
"use strict";
var Declaration = require('./declaration');
var Resolution = require('./resolution');
var Transition = require('./transition');
var Processor = require('./processor');
var Supports = require('./supports');
var Browsers = require('./browsers');
var Selector = require('./selector');
var AtRule = require('./at-rule');
var Value = require('./value');
var utils = require('./utils');
var vendor = require('postcss').vendor;
Selector.hack(require('./hacks/fullscreen'));
Selector.hack(require('./hacks/placeholder'));
Declaration.hack(require('./hacks/flex'));
Declaration.hack(require('./hacks/order'));
Declaration.hack(require('./hacks/filter'));
@@ -27,6 +33,7 @@ Declaration.hack(require('./hacks/flex-flow'));
Declaration.hack(require('./hacks/flex-grow'));
Declaration.hack(require('./hacks/flex-wrap'));
Declaration.hack(require('./hacks/grid-area'));
Declaration.hack(require('./hacks/place-self'));
Declaration.hack(require('./hacks/grid-start'));
Declaration.hack(require('./hacks/align-self'));
Declaration.hack(require('./hacks/appearance'));
@@ -35,6 +42,7 @@ Declaration.hack(require('./hacks/mask-border'));
Declaration.hack(require('./hacks/align-items'));
Declaration.hack(require('./hacks/flex-shrink'));
Declaration.hack(require('./hacks/break-props'));
Declaration.hack(require('./hacks/color-adjust'));
Declaration.hack(require('./hacks/writing-mode'));
Declaration.hack(require('./hacks/border-image'));
Declaration.hack(require('./hacks/align-content'));
@@ -46,15 +54,17 @@ Declaration.hack(require('./hacks/grid-row-align'));
Declaration.hack(require('./hacks/transform-decl'));
Declaration.hack(require('./hacks/flex-direction'));
Declaration.hack(require('./hacks/image-rendering'));
Declaration.hack(require('./hacks/background-clip'));
Declaration.hack(require('./hacks/text-decoration'));
Declaration.hack(require('./hacks/justify-content'));
Declaration.hack(require('./hacks/background-size'));
Declaration.hack(require('./hacks/grid-row-column'));
Declaration.hack(require('./hacks/grid-rows-columns'));
Declaration.hack(require('./hacks/grid-column-align'));
Declaration.hack(require('./hacks/overscroll-behavior'));
Declaration.hack(require('./hacks/grid-template-areas'));
Declaration.hack(require('./hacks/text-emphasis-position'));
Declaration.hack(require('./hacks/text-decoration-skip-ink'));
Value.hack(require('./hacks/gradient'));
Value.hack(require('./hacks/intrinsic'));
Value.hack(require('./hacks/pixelated'));
@@ -63,448 +73,468 @@ Value.hack(require('./hacks/cross-fade'));
Value.hack(require('./hacks/display-flex'));
Value.hack(require('./hacks/display-grid'));
Value.hack(require('./hacks/filter-value'));
var declsCache = {};
var Prefixes = function () {
function Prefixes(data, browsers) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
_classCallCheck(this, Prefixes);
this.data = data;
this.browsers = browsers;
this.options = options;
var _preprocess = this.preprocess(this.select(this.data));
this.add = _preprocess[0];
this.remove = _preprocess[1];
this.transition = new Transition(this);
this.processor = new Processor(this);
var Prefixes =
/*#__PURE__*/
function () {
function Prefixes(data, browsers, options) {
if (options === void 0) {
options = {};
}
/**
this.data = data;
this.browsers = browsers;
this.options = options;
var _this$preprocess = this.preprocess(this.select(this.data));
this.add = _this$preprocess[0];
this.remove = _this$preprocess[1];
this.transition = new Transition(this);
this.processor = new Processor(this);
}
/**
* Return clone instance to remove all prefixes
*/
Prefixes.prototype.cleaner = function cleaner() {
if (this.cleanerCache) {
return this.cleanerCache;
}
var _proto = Prefixes.prototype;
if (this.browsers.selected.length) {
var empty = new Browsers(this.browsers.data, []);
this.cleanerCache = new Prefixes(this.data, empty, this.options);
} else {
return this;
}
_proto.cleaner = function cleaner() {
if (this.cleanerCache) {
return this.cleanerCache;
}
return this.cleanerCache;
};
if (this.browsers.selected.length) {
var empty = new Browsers(this.browsers.data, []);
this.cleanerCache = new Prefixes(this.data, empty, this.options);
} else {
return this;
}
/**
return this.cleanerCache;
}
/**
* Select prefixes from data, which is necessary for selected browsers
*/
;
_proto.select = function select(list) {
var _this = this;
Prefixes.prototype.select = function select(list) {
var _this = this;
var selected = { add: {}, remove: {} };
var _loop = function _loop(name) {
var data = list[name];
var add = data.browsers.map(function (i) {
var params = i.split(' ');
return {
browser: params[0] + ' ' + params[1],
note: params[2]
};
});
var notes = add.filter(function (i) {
return i.note;
}).map(function (i) {
return _this.browsers.prefix(i.browser) + ' ' + i.note;
});
notes = utils.uniq(notes);
add = add.filter(function (i) {
return _this.browsers.isSelected(i.browser);
}).map(function (i) {
var prefix = _this.browsers.prefix(i.browser);
if (i.note) {
return prefix + ' ' + i.note;
} else {
return prefix;
}
});
add = _this.sort(utils.uniq(add));
if (_this.options.flexbox === 'no-2009') {
add = add.filter(function (i) {
return i.indexOf('2009') === -1;
});
}
var all = data.browsers.map(function (i) {
return _this.browsers.prefix(i);
});
if (data.mistakes) {
all = all.concat(data.mistakes);
}
all = all.concat(notes);
all = utils.uniq(all);
if (add.length) {
selected.add[name] = add;
if (add.length < all.length) {
selected.remove[name] = all.filter(function (i) {
return add.indexOf(i) === -1;
});
}
} else {
selected.remove[name] = all;
}
};
for (var name in list) {
_loop(name);
}
return selected;
var selected = {
add: {},
remove: {}
};
/**
var _loop = function _loop(name) {
var data = list[name];
var add = data.browsers.map(function (i) {
var params = i.split(' ');
return {
browser: params[0] + " " + params[1],
note: params[2]
};
});
var notes = add.filter(function (i) {
return i.note;
}).map(function (i) {
return _this.browsers.prefix(i.browser) + " " + i.note;
});
notes = utils.uniq(notes);
add = add.filter(function (i) {
return _this.browsers.isSelected(i.browser);
}).map(function (i) {
var prefix = _this.browsers.prefix(i.browser);
if (i.note) {
return prefix + " " + i.note;
} else {
return prefix;
}
});
add = _this.sort(utils.uniq(add));
if (_this.options.flexbox === 'no-2009') {
add = add.filter(function (i) {
return i.indexOf('2009') === -1;
});
}
var all = data.browsers.map(function (i) {
return _this.browsers.prefix(i);
});
if (data.mistakes) {
all = all.concat(data.mistakes);
}
all = all.concat(notes);
all = utils.uniq(all);
if (add.length) {
selected.add[name] = add;
if (add.length < all.length) {
selected.remove[name] = all.filter(function (i) {
return add.indexOf(i) === -1;
});
}
} else {
selected.remove[name] = all;
}
};
for (var name in list) {
_loop(name);
}
return selected;
}
/**
* Sort vendor prefixes
*/
;
_proto.sort = function sort(prefixes) {
return prefixes.sort(function (a, b) {
var aLength = utils.removeNote(a).length;
var bLength = utils.removeNote(b).length;
Prefixes.prototype.sort = function sort(prefixes) {
return prefixes.sort(function (a, b) {
var aLength = utils.removeNote(a).length;
var bLength = utils.removeNote(b).length;
if (aLength === bLength) {
return b.length - a.length;
} else {
return bLength - aLength;
}
});
};
/**
if (aLength === bLength) {
return b.length - a.length;
} else {
return bLength - aLength;
}
});
}
/**
* Cache prefixes data to fast CSS processing
*/
;
Prefixes.prototype.preprocess = function preprocess(selected) {
var add = {
'selectors': [],
'@supports': new Supports(Prefixes, this)
};
for (var name in selected.add) {
var prefixes = selected.add[name];
if (name === '@keyframes' || name === '@viewport') {
add[name] = new AtRule(name, prefixes, this);
} else if (name === '@resolution') {
add[name] = new Resolution(name, prefixes, this);
} else if (this.data[name].selector) {
add.selectors.push(Selector.load(name, prefixes, this));
} else {
var props = this.data[name].props;
if (props) {
var value = Value.load(name, prefixes, this);
for (var _iterator = props, _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 prop = _ref;
if (!add[prop]) {
add[prop] = { values: [] };
}
add[prop].values.push(value);
}
} else {
var values = add[name] && add[name].values || [];
add[name] = Declaration.load(name, prefixes, this);
add[name].values = values;
}
}
}
var remove = { selectors: [] };
for (var _name in selected.remove) {
var _prefixes = selected.remove[_name];
if (this.data[_name].selector) {
var selector = Selector.load(_name, _prefixes);
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;
remove.selectors.push(selector.old(prefix));
}
} else if (_name === '@keyframes' || _name === '@viewport') {
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;
var prefixed = '@' + _prefix + _name.slice(1);
remove[prefixed] = { remove: true };
}
} else if (_name === '@resolution') {
remove[_name] = new Resolution(_name, _prefixes, this);
} else {
var _props = this.data[_name].props;
if (_props) {
var _value = Value.load(_name, [], this);
for (var _iterator4 = _prefixes, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref4;
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref4 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref4 = _i4.value;
}
var _prefix2 = _ref4;
var old = _value.old(_prefix2);
if (old) {
for (var _iterator5 = _props, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
var _ref5;
if (_isArray5) {
if (_i5 >= _iterator5.length) break;
_ref5 = _iterator5[_i5++];
} else {
_i5 = _iterator5.next();
if (_i5.done) break;
_ref5 = _i5.value;
}
var _prop = _ref5;
if (!remove[_prop]) {
remove[_prop] = {};
}
if (!remove[_prop].values) {
remove[_prop].values = [];
}
remove[_prop].values.push(old);
}
}
}
} else {
for (var _iterator6 = _prefixes, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
var _ref6;
if (_isArray6) {
if (_i6 >= _iterator6.length) break;
_ref6 = _iterator6[_i6++];
} else {
_i6 = _iterator6.next();
if (_i6.done) break;
_ref6 = _i6.value;
}
var _prefix3 = _ref6;
var olds = this.decl(_name).old(_name, _prefix3);
if (_name === 'align-self') {
var a = add[_name] && add[_name].prefixes;
if (a) {
if (_prefix3 === '-webkit- 2009' && a.indexOf('-webkit-') !== -1) {
continue;
} else if (_prefix3 === '-webkit-' && a.indexOf('-webkit- 2009') !== -1) {
continue;
}
}
}
for (var _iterator7 = olds, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
var _ref7;
if (_isArray7) {
if (_i7 >= _iterator7.length) break;
_ref7 = _iterator7[_i7++];
} else {
_i7 = _iterator7.next();
if (_i7.done) break;
_ref7 = _i7.value;
}
var _prefixed = _ref7;
if (!remove[_prefixed]) {
remove[_prefixed] = {};
}
remove[_prefixed].remove = true;
}
}
}
}
}
return [add, remove];
_proto.preprocess = function preprocess(selected) {
var add = {
'selectors': [],
'@supports': new Supports(Prefixes, this)
};
/**
for (var name in selected.add) {
var prefixes = selected.add[name];
if (name === '@keyframes' || name === '@viewport') {
add[name] = new AtRule(name, prefixes, this);
} else if (name === '@resolution') {
add[name] = new Resolution(name, prefixes, this);
} else if (this.data[name].selector) {
add.selectors.push(Selector.load(name, prefixes, this));
} else {
var props = this.data[name].props;
if (props) {
var value = Value.load(name, prefixes, this);
for (var _iterator = props, _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 prop = _ref;
if (!add[prop]) {
add[prop] = {
values: []
};
}
add[prop].values.push(value);
}
} else {
var values = add[name] && add[name].values || [];
add[name] = Declaration.load(name, prefixes, this);
add[name].values = values;
}
}
}
var remove = {
selectors: []
};
for (var _name in selected.remove) {
var _prefixes = selected.remove[_name];
if (this.data[_name].selector) {
var selector = Selector.load(_name, _prefixes);
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;
remove.selectors.push(selector.old(prefix));
}
} else if (_name === '@keyframes' || _name === '@viewport') {
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;
var prefixed = "@" + _prefix + _name.slice(1);
remove[prefixed] = {
remove: true
};
}
} else if (_name === '@resolution') {
remove[_name] = new Resolution(_name, _prefixes, this);
} else {
var _props = this.data[_name].props;
if (_props) {
var _value = Value.load(_name, [], this);
for (var _iterator4 = _prefixes, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref4;
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref4 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref4 = _i4.value;
}
var _prefix2 = _ref4;
var old = _value.old(_prefix2);
if (old) {
for (var _iterator5 = _props, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
var _ref5;
if (_isArray5) {
if (_i5 >= _iterator5.length) break;
_ref5 = _iterator5[_i5++];
} else {
_i5 = _iterator5.next();
if (_i5.done) break;
_ref5 = _i5.value;
}
var _prop = _ref5;
if (!remove[_prop]) {
remove[_prop] = {};
}
if (!remove[_prop].values) {
remove[_prop].values = [];
}
remove[_prop].values.push(old);
}
}
}
} else {
for (var _iterator6 = _prefixes, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
var _ref6;
if (_isArray6) {
if (_i6 >= _iterator6.length) break;
_ref6 = _iterator6[_i6++];
} else {
_i6 = _iterator6.next();
if (_i6.done) break;
_ref6 = _i6.value;
}
var _prefix3 = _ref6;
var olds = this.decl(_name).old(_name, _prefix3);
if (_name === 'align-self') {
var a = add[_name] && add[_name].prefixes;
if (a) {
if (_prefix3 === '-webkit- 2009' && a.indexOf('-webkit-') !== -1) {
continue;
} else if (_prefix3 === '-webkit-' && a.indexOf('-webkit- 2009') !== -1) {
continue;
}
}
}
for (var _iterator7 = olds, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
var _ref7;
if (_isArray7) {
if (_i7 >= _iterator7.length) break;
_ref7 = _iterator7[_i7++];
} else {
_i7 = _iterator7.next();
if (_i7.done) break;
_ref7 = _i7.value;
}
var _prefixed = _ref7;
if (!remove[_prefixed]) {
remove[_prefixed] = {};
}
remove[_prefixed].remove = true;
}
}
}
}
}
return [add, remove];
}
/**
* Declaration loader with caching
*/
;
_proto.decl = function decl(prop) {
var decl = declsCache[prop];
Prefixes.prototype.decl = function decl(prop) {
var decl = declsCache[prop];
if (decl) {
return decl;
} else {
declsCache[prop] = Declaration.load(prop);
return declsCache[prop];
}
};
/**
if (decl) {
return decl;
} else {
declsCache[prop] = Declaration.load(prop);
return declsCache[prop];
}
}
/**
* Return unprefixed version of property
*/
;
_proto.unprefixed = function unprefixed(prop) {
var value = this.normalize(vendor.unprefixed(prop));
Prefixes.prototype.unprefixed = function unprefixed(prop) {
var value = this.normalize(vendor.unprefixed(prop));
if (value === 'flex-direction') {
value = 'flex-flow';
}
return value;
};
if (value === 'flex-direction') {
value = 'flex-flow';
}
/**
return value;
}
/**
* Normalize prefix for remover
*/
;
Prefixes.prototype.normalize = function normalize(prop) {
return this.decl(prop).normalize(prop);
};
/**
_proto.normalize = function normalize(prop) {
return this.decl(prop).normalize(prop);
}
/**
* Return prefixed version of property
*/
;
Prefixes.prototype.prefixed = function prefixed(prop, prefix) {
prop = vendor.unprefixed(prop);
return this.decl(prop).prefixed(prop, prefix);
};
/**
_proto.prefixed = function prefixed(prop, prefix) {
prop = vendor.unprefixed(prop);
return this.decl(prop).prefixed(prop, prefix);
}
/**
* Return values, which must be prefixed in selected property
*/
;
_proto.values = function values(type, prop) {
var data = this[type];
var global = data['*'] && data['*'].values;
var values = data[prop] && data[prop].values;
Prefixes.prototype.values = function values(type, prop) {
var data = this[type];
var global = data['*'] && data['*'].values;
var values = data[prop] && data[prop].values;
if (global && values) {
return utils.uniq(global.concat(values));
} else {
return global || values || [];
}
};
/**
if (global && values) {
return utils.uniq(global.concat(values));
} else {
return global || values || [];
}
}
/**
* Group declaration by unprefixed property to check them
*/
;
_proto.group = function group(decl) {
var _this2 = this;
Prefixes.prototype.group = function group(decl) {
var _this2 = this;
var rule = decl.parent;
var index = rule.index(decl);
var length = rule.nodes.length;
var unprefixed = this.unprefixed(decl.prop);
var rule = decl.parent;
var index = rule.index(decl);
var length = rule.nodes.length;
var checker = function checker(step, callback) {
index += step;
var unprefixed = this.unprefixed(decl.prop);
while (index >= 0 && index < length) {
var other = rule.nodes[index];
var checker = function checker(step, callback) {
index += step;
while (index >= 0 && index < length) {
var other = rule.nodes[index];
if (other.type === 'decl') {
if (step === -1 && other.prop === unprefixed) {
if (!Browsers.withPrefix(other.value)) {
break;
}
}
if (_this2.unprefixed(other.prop) !== unprefixed) {
break;
} else if (callback(other) === true) {
return true;
}
if (step === +1 && other.prop === unprefixed) {
if (!Browsers.withPrefix(other.value)) {
break;
}
}
}
index += step;
if (other.type === 'decl') {
if (step === -1 && other.prop === unprefixed) {
if (!Browsers.withPrefix(other.value)) {
break;
}
return false;
};
}
return {
up: function up(callback) {
return checker(-1, callback);
},
down: function down(callback) {
return checker(+1, callback);
if (_this2.unprefixed(other.prop) !== unprefixed) {
break;
} else if (callback(other) === true) {
return true;
}
if (step === +1 && other.prop === unprefixed) {
if (!Browsers.withPrefix(other.value)) {
break;
}
};
}
}
index += step;
}
return false;
};
return Prefixes;
return {
up: function up(callback) {
return checker(-1, callback);
},
down: function down(callback) {
return checker(+1, callback);
}
};
};
return Prefixes;
}();
module.exports = Prefixes;
+685 -386
View File
File diff suppressed because it is too large Load Diff
+109 -107
View File
@@ -1,154 +1,156 @@
'use strict';
"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); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _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 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);
var Resolution =
/*#__PURE__*/
function (_Prefixer) {
_inheritsLoose(Resolution, _Prefixer);
function Resolution() {
_classCallCheck(this, Resolution);
function Resolution() {
return _Prefixer.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
var _proto = Resolution.prototype;
/**
/**
* 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;
};
/**
_proto.prefixName = function prefixName(prefix, name) {
if (prefix === '-moz-') {
return name + '--moz-device-pixel-ratio';
} else {
return prefix + name + '-device-pixel-ratio';
}
}
/**
* Return prefixed query
*/
;
_proto.prefixQuery = function prefixQuery(prefix, name, colon, value, units) {
if (units === 'dpi') {
value = Number(value / 96);
}
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;
};
if (prefix === '-o-') {
value = n2f(value);
}
/**
return this.prefixName(prefix, name) + colon + value;
}
/**
* Remove prefixed queries
*/
;
_proto.clean = function clean(rule) {
var _this = this;
Resolution.prototype.clean = function clean(rule) {
var _this2 = this;
if (!this.bad) {
this.bad = [];
if (!this.bad) {
this.bad = [];
for (var _iterator = this.prefixes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
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'));
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
rule.params = utils.editList(rule.params, function (queries) {
return queries.filter(function (query) {
return _this2.bad.every(function (i) {
return query.indexOf(i) === -1;
});
});
});
};
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 _this.bad.every(function (i) {
return query.indexOf(i) === -1;
});
});
});
}
/**
* Add prefixed queries
*/
;
_proto.process = function process(rule) {
var _this2 = this;
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;
var parent = this.parentPrefix(rule);
var prefixes = parent ? [parent] : this.prefixes;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
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;
var query = _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
if (query.indexOf('min-resolution') === -1 && query.indexOf('max-resolution') === -1) {
prefixed.push(query);
continue;
}
var query = _ref2;
var _loop = function _loop() {
if (_isArray3) {
if (_i3 >= _iterator3.length) return "break";
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) return "break";
_ref3 = _i3.value;
}
if (query.indexOf('min-resolution') === -1 && query.indexOf('max-resolution') === -1) {
prefixed.push(query);
continue;
}
var prefix = _ref3;
var processed = query.replace(REGEXP, function (str) {
var parts = str.match(SPLIT);
return _this2.prefixQuery(prefix, parts[1], parts[2], parts[3], parts[4]);
});
prefixed.push(processed);
};
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;
for (var _iterator3 = prefixes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
var _ret = _loop();
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
if (_ret === "break") break;
}
var prefix = _ref3;
prefixed.push(query);
}
_loop(prefix);
}
prefixed.push(query);
}
return utils.uniq(prefixed);
});
};
return utils.uniq(prefixed);
});
};
return Resolution;
return Resolution;
}(Prefixer);
module.exports = Resolution;
+121 -123
View File
@@ -1,180 +1,178 @@
'use strict';
"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); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _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);
var Selector =
/*#__PURE__*/
function (_Prefixer) {
_inheritsLoose(Selector, _Prefixer);
function Selector(name, prefixes, all) {
_classCallCheck(this, Selector);
function Selector(name, prefixes, all) {
var _this;
var _this = _possibleConstructorReturn(this, _Prefixer.call(this, name, prefixes, all));
_this.regexpCache = {};
return _this;
}
/**
_this = _Prefixer.call(this, name, prefixes, all) || this;
_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());
}
var _proto = Selector.prototype;
return false;
};
_proto.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);
};
/**
_proto.prefixed = function prefixed(prefix) {
return this.name.replace(/^([^\w]*)/, "$1" + prefix);
}
/**
* Lazy loadRegExp for name
*/
;
_proto.regexp = function regexp(prefix) {
if (this.regexpCache[prefix]) {
return this.regexpCache[prefix];
}
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];
};
/**
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();
};
/**
_proto.possible = function possible() {
return Browsers.prefixes();
}
/**
* Return all possible selector prefixes
*/
;
_proto.prefixeds = function prefixeds(rule) {
if (rule._autoprefixerPrefixeds) {
return rule._autoprefixerPrefixeds;
}
Selector.prototype.prefixeds = function prefixeds(rule) {
if (rule._autoprefixerPrefixeds) {
return rule._autoprefixerPrefixeds;
}
var prefixeds = {};
var prefixeds = {};
for (var _iterator = this.possible(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
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;
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prefix = _ref;
var prefix = _ref;
prefixeds[prefix] = this.replace(rule.selector, prefix);
}
prefixeds[prefix] = this.replace(rule.selector, prefix);
}
rule._autoprefixerPrefixeds = prefixeds;
return rule._autoprefixerPrefixeds;
};
/**
rule._autoprefixerPrefixeds = prefixeds;
return rule._autoprefixerPrefixeds;
}
/**
* Is rule already prefixed before
*/
;
_proto.already = function already(rule, prefixeds, prefix) {
var index = rule.parent.index(rule) - 1;
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;
}
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));
};
/**
_proto.replace = function replace(selector, prefix) {
return selector.replace(this.regexp(), "$1" + this.prefixed(prefix));
}
/**
* Clone and add prefixes for at-rule
*/
;
_proto.add = function add(rule, prefix) {
var prefixeds = this.prefixeds(rule);
Selector.prototype.add = function add(rule, prefix) {
var prefixeds = this.prefixeds(rule);
if (this.already(rule, prefixeds, prefix)) {
return;
}
if (this.already(rule, prefixeds, prefix)) {
return;
}
var cloned = this.clone(rule, { selector: prefixeds[prefix] });
rule.parent.insertBefore(rule, cloned);
};
/**
var cloned = this.clone(rule, {
selector: prefixeds[prefix]
});
rule.parent.insertBefore(rule, cloned);
}
/**
* Return function to fast find prefixed selector
*/
;
_proto.old = function old(prefix) {
return new OldSelector(this, prefix);
};
Selector.prototype.old = function old(prefix) {
return new OldSelector(this, prefix);
};
return Selector;
return Selector;
}(Prefixer);
module.exports = Selector;
+283 -277
View File
@@ -1,380 +1,386 @@
'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"); } }
"use strict";
var Browsers = require('./browsers');
var brackets = require('./brackets');
var Value = require('./value');
var utils = require('./utils');
var postcss = require('postcss');
var supported = [];
var data = require('caniuse-lite').feature(require('caniuse-lite/data/features/css-featurequeries.js'));
for (var browser in data.stats) {
var versions = data.stats[browser];
for (var version in versions) {
var support = versions[version];
if (/y/.test(support)) {
supported.push(browser + ' ' + version);
}
var versions = data.stats[browser];
for (var version in versions) {
var support = versions[version];
if (/y/.test(support)) {
supported.push(browser + ' ' + version);
}
}
}
var Supports = function () {
function Supports(Prefixes, all) {
_classCallCheck(this, Supports);
this.Prefixes = Prefixes;
this.all = all;
}
/**
var Supports =
/*#__PURE__*/
function () {
function Supports(Prefixes, all) {
this.Prefixes = Prefixes;
this.all = all;
}
/**
* Return prefixer only with @supports supported browsers
*/
Supports.prototype.prefixer = function prefixer() {
if (this.prefixerCache) {
return this.prefixerCache;
}
var _proto = Supports.prototype;
var filtered = this.all.browsers.selected.filter(function (i) {
return supported.indexOf(i) !== -1;
});
_proto.prefixer = function prefixer() {
if (this.prefixerCache) {
return this.prefixerCache;
}
var browsers = new Browsers(this.all.browsers.data, filtered, this.all.options);
this.prefixerCache = new this.Prefixes(this.all.data, browsers, this.all.options);
return this.prefixerCache;
};
/**
var filtered = this.all.browsers.selected.filter(function (i) {
return supported.indexOf(i) !== -1;
});
var browsers = new Browsers(this.all.browsers.data, filtered, this.all.options);
this.prefixerCache = new this.Prefixes(this.all.data, browsers, this.all.options);
return this.prefixerCache;
}
/**
* Parse string into declaration property and value
*/
;
Supports.prototype.parse = function parse(str) {
var _str$split = str.split(':'),
prop = _str$split[0],
value = _str$split[1];
if (!value) value = '';
return [prop.trim(), value.trim()];
};
/**
_proto.parse = function parse(str) {
var parts = str.split(':');
var prop = parts[0];
var value = parts[1];
if (!value) value = '';
return [prop.trim(), value.trim()];
}
/**
* Create virtual rule to process it by prefixer
*/
;
_proto.virtual = function virtual(str) {
var _this$parse = this.parse(str),
prop = _this$parse[0],
value = _this$parse[1];
Supports.prototype.virtual = function virtual(str) {
var _parse = this.parse(str),
prop = _parse[0],
value = _parse[1];
var rule = postcss.parse('a{}').first;
rule.append({ prop: prop, value: value, raws: { before: '' } });
return rule;
};
/**
var rule = postcss.parse('a{}').first;
rule.append({
prop: prop,
value: value,
raws: {
before: ''
}
});
return rule;
}
/**
* Return array of Declaration with all necessary prefixes
*/
;
_proto.prefixed = function prefixed(str) {
var rule = this.virtual(str);
Supports.prototype.prefixed = function prefixed(str) {
var rule = this.virtual(str);
if (this.disabled(rule.first)) {
return rule.nodes;
}
if (this.disabled(rule.first)) {
return rule.nodes;
}
var prefixer = this.prefixer().add[rule.first.prop];
prefixer && prefixer.process && prefixer.process(rule.first);
for (var _iterator = rule.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 decl = _ref;
for (var _iterator2 = this.prefixer().values('add', rule.first.prop), _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 value = _ref2;
value.process(decl);
}
Value.save(this.all, decl);
}
return rule.nodes;
var result = {
warn: function warn() {
return null;
}
};
var prefixer = this.prefixer().add[rule.first.prop];
prefixer && prefixer.process && prefixer.process(rule.first, result);
/**
for (var _iterator = rule.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 decl = _ref;
for (var _iterator2 = this.prefixer().values('add', rule.first.prop), _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 value = _ref2;
value.process(decl);
}
Value.save(this.all, decl);
}
return rule.nodes;
}
/**
* Return true if brackets node is "not" word
*/
;
Supports.prototype.isNot = function isNot(node) {
return typeof node === 'string' && /not\s*/i.test(node);
};
/**
_proto.isNot = function isNot(node) {
return typeof node === 'string' && /not\s*/i.test(node);
}
/**
* Return true if brackets node is "or" word
*/
;
Supports.prototype.isOr = function isOr(node) {
return typeof node === 'string' && /\s*or\s*/i.test(node);
};
/**
_proto.isOr = function isOr(node) {
return typeof node === 'string' && /\s*or\s*/i.test(node);
}
/**
* Return true if brackets node is (prop: value)
*/
;
Supports.prototype.isProp = function isProp(node) {
return (typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object' && node.length === 1 && typeof node[0] === 'string';
};
/**
_proto.isProp = function isProp(node) {
return typeof node === 'object' && node.length === 1 && typeof node[0] === 'string';
}
/**
* Return true if prefixed property has no unprefixed
*/
;
Supports.prototype.isHack = function isHack(all, unprefixed) {
var check = new RegExp('(\\(|\\s)' + utils.escapeRegexp(unprefixed) + ':');
return !check.test(all);
};
/**
_proto.isHack = function isHack(all, unprefixed) {
var check = new RegExp("(\\(|\\s)" + utils.escapeRegexp(unprefixed) + ":");
return !check.test(all);
}
/**
* Return true if we need to remove node
*/
;
_proto.toRemove = function toRemove(str, all) {
var _this$parse2 = this.parse(str),
prop = _this$parse2[0],
value = _this$parse2[1];
Supports.prototype.toRemove = function toRemove(str, all) {
var _parse2 = this.parse(str),
prop = _parse2[0],
value = _parse2[1];
var unprefixed = this.all.unprefixed(prop);
var cleaner = this.all.cleaner();
var unprefixed = this.all.unprefixed(prop);
if (cleaner.remove[prop] && cleaner.remove[prop].remove && !this.isHack(all, unprefixed)) {
return true;
}
var cleaner = this.all.cleaner();
for (var _iterator3 = cleaner.values('remove', unprefixed), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (cleaner.remove[prop] && cleaner.remove[prop].remove && !this.isHack(all, unprefixed)) {
return true;
}
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
for (var _iterator3 = cleaner.values('remove', unprefixed), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
var checker = _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
if (checker.check(value)) {
return true;
}
}
var checker = _ref3;
if (checker.check(value)) {
return true;
}
}
return false;
};
/**
return false;
}
/**
* Remove all unnecessary prefixes
*/
;
_proto.remove = function remove(nodes, all) {
var i = 0;
Supports.prototype.remove = function remove(nodes, all) {
var i = 0;
while (i < nodes.length) {
if (!this.isNot(nodes[i - 1]) && this.isProp(nodes[i]) && this.isOr(nodes[i + 1])) {
if (this.toRemove(nodes[i][0], all)) {
nodes.splice(i, 2);
continue;
}
i += 2;
continue;
}
if (_typeof(nodes[i]) === 'object') {
nodes[i] = this.remove(nodes[i], all);
}
i += 1;
while (i < nodes.length) {
if (!this.isNot(nodes[i - 1]) && this.isProp(nodes[i]) && this.isOr(nodes[i + 1])) {
if (this.toRemove(nodes[i][0], all)) {
nodes.splice(i, 2);
continue;
}
return nodes;
};
/**
i += 2;
continue;
}
if (typeof nodes[i] === 'object') {
nodes[i] = this.remove(nodes[i], all);
}
i += 1;
}
return nodes;
}
/**
* Clean brackets with one child
*/
;
_proto.cleanBrackets = function cleanBrackets(nodes) {
var _this = this;
Supports.prototype.cleanBrackets = function cleanBrackets(nodes) {
var _this = this;
return nodes.map(function (i) {
if (typeof i !== 'object') {
return i;
}
return nodes.map(function (i) {
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) !== 'object') {
return i;
}
if (i.length === 1 && typeof i[0] === 'object') {
return _this.cleanBrackets(i[0]);
}
if (i.length === 1 && _typeof(i[0]) === 'object') {
return _this.cleanBrackets(i[0]);
}
return _this.cleanBrackets(i);
});
};
/**
return _this.cleanBrackets(i);
});
}
/**
* Add " or " between properties and convert it to brackets format
*/
;
_proto.convert = function convert(progress) {
var result = [''];
Supports.prototype.convert = function convert(progress) {
var result = [''];
for (var _iterator4 = progress, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref4;
for (var _iterator4 = progress, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref4;
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref4 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref4 = _i4.value;
}
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref4 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref4 = _i4.value;
}
var i = _ref4;
var i = _ref4;
result.push([i.prop + ": " + i.value]);
result.push(' or ');
}
result.push([i.prop + ': ' + i.value]);
result.push(' or ');
}
result[result.length - 1] = '';
return result;
};
/**
result[result.length - 1] = '';
return result;
}
/**
* Compress value functions into a string nodes
*/
;
_proto.normalize = function normalize(nodes) {
var _this2 = this;
Supports.prototype.normalize = function normalize(nodes) {
var _this2 = this;
if (typeof nodes !== 'object') {
return nodes;
}
if ((typeof nodes === 'undefined' ? 'undefined' : _typeof(nodes)) !== 'object') {
return nodes;
}
nodes = nodes.filter(function (i) {
return i !== '';
});
nodes = nodes.filter(function (i) {
return i !== '';
});
if (typeof nodes[0] === 'string' && nodes[0].indexOf(':') !== -1) {
return [brackets.stringify(nodes)];
}
if (typeof nodes[0] === 'string' && nodes[0].indexOf(':') !== -1) {
return [brackets.stringify(nodes)];
}
return nodes.map(function (i) {
return _this2.normalize(i);
});
};
/**
return nodes.map(function (i) {
return _this2.normalize(i);
});
}
/**
* Add prefixes
*/
;
_proto.add = function add(nodes, all) {
var _this3 = this;
Supports.prototype.add = function add(nodes, all) {
var _this3 = this;
return nodes.map(function (i) {
if (_this3.isProp(i)) {
var prefixed = _this3.prefixed(i[0]);
return nodes.map(function (i) {
if (_this3.isProp(i)) {
var prefixed = _this3.prefixed(i[0]);
if (prefixed.length > 1) {
return _this3.convert(prefixed);
}
if (prefixed.length > 1) {
return _this3.convert(prefixed);
}
return i;
}
return i;
}
if ((typeof i === 'undefined' ? 'undefined' : _typeof(i)) === 'object') {
return _this3.add(i, all);
}
if (typeof i === 'object') {
return _this3.add(i, all);
}
return i;
});
};
/**
return i;
});
}
/**
* Add prefixed declaration
*/
;
Supports.prototype.process = function process(rule) {
var ast = brackets.parse(rule.params);
ast = this.normalize(ast);
ast = this.remove(ast, rule.params);
ast = this.add(ast, rule.params);
ast = this.cleanBrackets(ast);
rule.params = brackets.stringify(ast);
};
/**
_proto.process = function process(rule) {
var ast = brackets.parse(rule.params);
ast = this.normalize(ast);
ast = this.remove(ast, rule.params);
ast = this.add(ast, rule.params);
ast = this.cleanBrackets(ast);
rule.params = brackets.stringify(ast);
}
/**
* Check global options
*/
;
_proto.disabled = function disabled(node) {
if (!this.all.options.grid) {
if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
return true;
}
Supports.prototype.disabled = function disabled(node) {
if (!this.all.options.grid) {
if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
return true;
}
if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
return true;
}
}
if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
return true;
}
}
if (this.all.options.flexbox === false) {
if (node.prop === 'display' && node.value.indexOf('flex') !== -1) {
return true;
}
var other = ['order', 'justify-content', 'align-items', 'align-content'];
if (node.prop.indexOf('flex') !== -1 || other.indexOf(node.prop) !== -1) {
return true;
}
}
if (this.all.options.flexbox === false) {
if (node.prop === 'display' && node.value.indexOf('flex') !== -1) {
return true;
}
return false;
};
var other = ['order', 'justify-content', 'align-items', 'align-content'];
return Supports;
if (node.prop.indexOf('flex') !== -1 || other.indexOf(node.prop) !== -1) {
return true;
}
}
return false;
};
return Supports;
}();
module.exports = Supports;
+442 -421
View File
@@ -1,446 +1,467 @@
'use strict';
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var parser = require('postcss-value-parser');
var vendor = require('postcss').vendor;
var list = require('postcss').list;
var Transition = function () {
function Transition(prefixes) {
_classCallCheck(this, Transition);
var Transition =
/*#__PURE__*/
function () {
function Transition(prefixes) {
_defineProperty(this, "props", ['transition', 'transition-property']);
Object.defineProperty(this, 'props', {
enumerable: true,
writable: true,
value: ['transition', 'transition-property']
});
this.prefixes = prefixes;
}
/**
* Process transition and add prefixes for all necessary properties
*/
this.prefixes = prefixes;
var _proto = Transition.prototype;
_proto.add = function add(decl, result) {
var _this = this;
var prefix, prop;
var add = this.prefixes.add[decl.prop];
var declPrefixes = add && add.prefixes || [];
var params = this.parse(decl.value);
var names = params.map(function (i) {
return _this.findProp(i);
});
var added = [];
if (names.some(function (i) {
return i[0] === '-';
})) {
return;
}
/**
* Process transition and add prefies for all necessary properties
*/
for (var _iterator = params, _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;
}
Transition.prototype.add = function add(decl, result) {
var _this = this;
var param = _ref;
prop = this.findProp(param);
if (prop[0] === '-') continue;
var prefixer = this.prefixes.add[prop];
if (!prefixer || !prefixer.prefixes) continue;
var prefix = void 0,
prop = void 0;
var declPrefixes = this.prefixes.add[decl.prop] && this.prefixes.add[decl.prop].prefixes || [];
var params = this.parse(decl.value);
var names = params.map(function (i) {
return _this.findProp(i);
});
var added = [];
if (names.some(function (i) {
return i[0] === '-';
})) {
return;
for (var _iterator3 = prefixer.prefixes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
prefix = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
prefix = _i3.value;
}
for (var _iterator = params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var prefixed = this.prefixes.prefixed(prop, prefix);
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var param = _ref;
prop = this.findProp(param);
if (prop[0] === '-') continue;
var prefixer = this.prefixes.add[prop];
if (!prefixer || !prefixer.prefixes) continue;
for (var _iterator3 = prefixer.prefixes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
prefix = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
prefix = _i3.value;
}
var prefixed = this.prefixes.prefixed(prop, prefix);
if (prefixed !== '-ms-transform' && names.indexOf(prefixed) === -1) {
if (!this.disabled(prop, prefix)) {
added.push(this.clone(prop, prefixed, param));
}
}
}
if (prefixed !== '-ms-transform' && names.indexOf(prefixed) === -1) {
if (!this.disabled(prop, prefix)) {
added.push(this.clone(prop, prefixed, param));
}
}
}
}
params = params.concat(added);
var value = this.stringify(params);
params = params.concat(added);
var value = this.stringify(params);
var webkitClean = this.stringify(this.cleanFromUnprefixed(params, '-webkit-'));
var webkitClean = this.stringify(this.cleanFromUnprefixed(params, '-webkit-'));
if (declPrefixes.indexOf('-webkit-') !== -1) {
this.cloneBefore(decl, '-webkit-' + decl.prop, webkitClean);
}
this.cloneBefore(decl, decl.prop, webkitClean);
if (declPrefixes.indexOf('-o-') !== -1) {
var operaClean = this.stringify(this.cleanFromUnprefixed(params, '-o-'));
this.cloneBefore(decl, '-o-' + decl.prop, operaClean);
}
for (var _iterator2 = declPrefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
prefix = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
prefix = _i2.value;
}
if (prefix !== '-webkit-' && prefix !== '-o-') {
var prefixValue = this.stringify(this.cleanOtherPrefixes(params, prefix));
this.cloneBefore(decl, prefix + decl.prop, prefixValue);
}
}
if (value !== decl.value && !this.already(decl, decl.prop, value)) {
this.checkForWarning(result, decl);
decl.cloneBefore();
decl.value = value;
}
};
/**
* Find property name
*/
Transition.prototype.findProp = function findProp(param) {
var prop = param[0].value;
if (/^\d/.test(prop)) {
for (var i = 0; i < param.length; i++) {
var token = param[i];
if (i !== 0 && token.type === 'word') {
return token.value;
}
}
}
return prop;
};
/**
* Does we aready have this declaration
*/
Transition.prototype.already = function already(decl, prop, value) {
return decl.parent.some(function (i) {
return i.prop === prop && i.value === value;
});
};
/**
* Add declaration if it is not exist
*/
Transition.prototype.cloneBefore = function cloneBefore(decl, prop, value) {
if (!this.already(decl, prop, value)) {
decl.cloneBefore({ prop: prop, value: value });
}
};
/**
* Show transition-property warning
*/
Transition.prototype.checkForWarning = function checkForWarning(result, decl) {
if (decl.prop !== 'transition-property') {
return;
}
decl.parent.each(function (i) {
if (i.type !== 'decl') {
return undefined;
}
if (i.prop.indexOf('transition-') !== 0) {
return undefined;
}
if (i.prop === 'transition-property') {
return undefined;
}
if (list.comma(i.value).length > 1) {
decl.warn(result, 'Replace transition-property to transition, ' + 'because Autoprefixer could not support ' + 'any cases of transition-property ' + 'and other transition-*');
}
return false;
});
};
/**
* Process transition and remove all unnecessary properties
*/
Transition.prototype.remove = function remove(decl) {
var _this2 = this;
var params = this.parse(decl.value);
params = params.filter(function (i) {
var prop = _this2.prefixes.remove[_this2.findProp(i)];
return !prop || !prop.remove;
});
var value = this.stringify(params);
if (decl.value === value) {
return;
}
if (params.length === 0) {
decl.remove();
return;
}
var double = decl.parent.some(function (i) {
return i.prop === decl.prop && i.value === value;
});
var smaller = decl.parent.some(function (i) {
return i !== decl && i.prop === decl.prop && i.value.length > value.length;
});
if (double || smaller) {
decl.remove();
return;
}
decl.value = value;
};
/**
* Parse properties list to array
*/
Transition.prototype.parse = function parse(value) {
var ast = parser(value);
var result = [];
var param = [];
for (var _iterator4 = ast.nodes, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref2;
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref2 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref2 = _i4.value;
}
var node = _ref2;
param.push(node);
if (node.type === 'div' && node.value === ',') {
result.push(param);
param = [];
}
}
result.push(param);
return result.filter(function (i) {
return i.length > 0;
});
};
/**
* Return properties string from array
*/
Transition.prototype.stringify = function stringify(params) {
if (params.length === 0) {
return '';
}
var nodes = [];
for (var _iterator5 = params, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
var _ref3;
if (_isArray5) {
if (_i5 >= _iterator5.length) break;
_ref3 = _iterator5[_i5++];
} else {
_i5 = _iterator5.next();
if (_i5.done) break;
_ref3 = _i5.value;
}
var param = _ref3;
if (param[param.length - 1].type !== 'div') {
param.push(this.div(params));
}
nodes = nodes.concat(param);
}
if (nodes[0].type === 'div') {
nodes = nodes.slice(1);
}
if (nodes[nodes.length - 1].type === 'div') {
nodes = nodes.slice(0, +-2 + 1 || undefined);
}
return parser.stringify({ nodes: nodes });
};
/**
* Return new param array with different name
*/
Transition.prototype.clone = function clone(origin, name, param) {
var result = [];
var changed = false;
for (var _iterator6 = param, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
var _ref4;
if (_isArray6) {
if (_i6 >= _iterator6.length) break;
_ref4 = _iterator6[_i6++];
} else {
_i6 = _iterator6.next();
if (_i6.done) break;
_ref4 = _i6.value;
}
var i = _ref4;
if (!changed && i.type === 'word' && i.value === origin) {
result.push({ type: 'word', value: name });
changed = true;
} else {
result.push(i);
}
}
return result;
};
/**
* Find or create seperator
*/
Transition.prototype.div = function div(params) {
for (var _iterator7 = params, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
var _ref5;
if (_isArray7) {
if (_i7 >= _iterator7.length) break;
_ref5 = _iterator7[_i7++];
} else {
_i7 = _iterator7.next();
if (_i7.done) break;
_ref5 = _i7.value;
}
var param = _ref5;
for (var _iterator8 = param, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
var _ref6;
if (_isArray8) {
if (_i8 >= _iterator8.length) break;
_ref6 = _iterator8[_i8++];
} else {
_i8 = _iterator8.next();
if (_i8.done) break;
_ref6 = _i8.value;
}
var node = _ref6;
if (node.type === 'div' && node.value === ',') {
return node;
}
}
}
return { type: 'div', value: ',', after: ' ' };
};
Transition.prototype.cleanOtherPrefixes = function cleanOtherPrefixes(params, prefix) {
var _this3 = this;
return params.filter(function (param) {
var current = vendor.prefix(_this3.findProp(param));
return current === '' || current === prefix;
});
};
/**
* Remove all non-webkit prefixes and unprefixed params if we have prefixed
*/
Transition.prototype.cleanFromUnprefixed = function cleanFromUnprefixed(params, prefix) {
var _this4 = this;
var remove = params.map(function (i) {
return _this4.findProp(i);
}).filter(function (i) {
return i.slice(0, prefix.length) === prefix;
}).map(function (i) {
return _this4.prefixes.unprefixed(i);
});
var result = [];
for (var _iterator9 = params, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
var _ref7;
if (_isArray9) {
if (_i9 >= _iterator9.length) break;
_ref7 = _iterator9[_i9++];
} else {
_i9 = _iterator9.next();
if (_i9.done) break;
_ref7 = _i9.value;
}
var param = _ref7;
var prop = this.findProp(param);
var p = vendor.prefix(prop);
if (remove.indexOf(prop) === -1 && (p === prefix || p === '')) {
result.push(param);
}
}
return result;
};
/**
* Check property for disabled by option
*/
Transition.prototype.disabled = function disabled(prop, prefix) {
var other = ['order', 'justify-content', 'align-self', 'align-content'];
if (prop.indexOf('flex') !== -1 || other.indexOf(prop) !== -1) {
if (this.prefixes.options.flexbox === false) {
return true;
}
if (this.prefixes.options.flexbox === 'no-2009') {
return prefix.indexOf('2009') !== -1;
}
if (declPrefixes.indexOf('-webkit-') !== -1) {
this.cloneBefore(decl, "-webkit-" + decl.prop, webkitClean);
}
this.cloneBefore(decl, decl.prop, webkitClean);
if (declPrefixes.indexOf('-o-') !== -1) {
var operaClean = this.stringify(this.cleanFromUnprefixed(params, '-o-'));
this.cloneBefore(decl, "-o-" + decl.prop, operaClean);
}
for (var _iterator2 = declPrefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
prefix = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
prefix = _i2.value;
}
if (prefix !== '-webkit-' && prefix !== '-o-') {
var prefixValue = this.stringify(this.cleanOtherPrefixes(params, prefix));
this.cloneBefore(decl, prefix + decl.prop, prefixValue);
}
}
if (value !== decl.value && !this.already(decl, decl.prop, value)) {
this.checkForWarning(result, decl);
decl.cloneBefore();
decl.value = value;
}
}
/**
* Find property name
*/
;
_proto.findProp = function findProp(param) {
var prop = param[0].value;
if (/^\d/.test(prop)) {
for (var i = 0; i < param.length; i++) {
var token = param[i];
if (i !== 0 && token.type === 'word') {
return token.value;
}
}
}
return prop;
}
/**
* Does we already have this declaration
*/
;
_proto.already = function already(decl, prop, value) {
return decl.parent.some(function (i) {
return i.prop === prop && i.value === value;
});
}
/**
* Add declaration if it is not exist
*/
;
_proto.cloneBefore = function cloneBefore(decl, prop, value) {
if (!this.already(decl, prop, value)) {
decl.cloneBefore({
prop: prop,
value: value
});
}
}
/**
* Show transition-property warning
*/
;
_proto.checkForWarning = function checkForWarning(result, decl) {
if (decl.prop !== 'transition-property') {
return;
}
decl.parent.each(function (i) {
if (i.type !== 'decl') {
return undefined;
};
}
return Transition;
if (i.prop.indexOf('transition-') !== 0) {
return undefined;
}
if (i.prop === 'transition-property') {
return undefined;
}
if (list.comma(i.value).length > 1) {
decl.warn(result, 'Replace transition-property to transition, ' + 'because Autoprefixer could not support ' + 'any cases of transition-property ' + 'and other transition-*');
}
return false;
});
}
/**
* Process transition and remove all unnecessary properties
*/
;
_proto.remove = function remove(decl) {
var _this2 = this;
var params = this.parse(decl.value);
params = params.filter(function (i) {
var prop = _this2.prefixes.remove[_this2.findProp(i)];
return !prop || !prop.remove;
});
var value = this.stringify(params);
if (decl.value === value) {
return;
}
if (params.length === 0) {
decl.remove();
return;
}
var double = decl.parent.some(function (i) {
return i.prop === decl.prop && i.value === value;
});
var smaller = decl.parent.some(function (i) {
return i !== decl && i.prop === decl.prop && i.value.length > value.length;
});
if (double || smaller) {
decl.remove();
return;
}
decl.value = value;
}
/**
* Parse properties list to array
*/
;
_proto.parse = function parse(value) {
var ast = parser(value);
var result = [];
var param = [];
for (var _iterator4 = ast.nodes, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref2;
if (_isArray4) {
if (_i4 >= _iterator4.length) break;
_ref2 = _iterator4[_i4++];
} else {
_i4 = _iterator4.next();
if (_i4.done) break;
_ref2 = _i4.value;
}
var node = _ref2;
param.push(node);
if (node.type === 'div' && node.value === ',') {
result.push(param);
param = [];
}
}
result.push(param);
return result.filter(function (i) {
return i.length > 0;
});
}
/**
* Return properties string from array
*/
;
_proto.stringify = function stringify(params) {
if (params.length === 0) {
return '';
}
var nodes = [];
for (var _iterator5 = params, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
var _ref3;
if (_isArray5) {
if (_i5 >= _iterator5.length) break;
_ref3 = _iterator5[_i5++];
} else {
_i5 = _iterator5.next();
if (_i5.done) break;
_ref3 = _i5.value;
}
var param = _ref3;
if (param[param.length - 1].type !== 'div') {
param.push(this.div(params));
}
nodes = nodes.concat(param);
}
if (nodes[0].type === 'div') {
nodes = nodes.slice(1);
}
if (nodes[nodes.length - 1].type === 'div') {
nodes = nodes.slice(0, +-2 + 1 || undefined);
}
return parser.stringify({
nodes: nodes
});
}
/**
* Return new param array with different name
*/
;
_proto.clone = function clone(origin, name, param) {
var result = [];
var changed = false;
for (var _iterator6 = param, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
var _ref4;
if (_isArray6) {
if (_i6 >= _iterator6.length) break;
_ref4 = _iterator6[_i6++];
} else {
_i6 = _iterator6.next();
if (_i6.done) break;
_ref4 = _i6.value;
}
var i = _ref4;
if (!changed && i.type === 'word' && i.value === origin) {
result.push({
type: 'word',
value: name
});
changed = true;
} else {
result.push(i);
}
}
return result;
}
/**
* Find or create separator
*/
;
_proto.div = function div(params) {
for (var _iterator7 = params, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
var _ref5;
if (_isArray7) {
if (_i7 >= _iterator7.length) break;
_ref5 = _iterator7[_i7++];
} else {
_i7 = _iterator7.next();
if (_i7.done) break;
_ref5 = _i7.value;
}
var param = _ref5;
for (var _iterator8 = param, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) {
var _ref6;
if (_isArray8) {
if (_i8 >= _iterator8.length) break;
_ref6 = _iterator8[_i8++];
} else {
_i8 = _iterator8.next();
if (_i8.done) break;
_ref6 = _i8.value;
}
var node = _ref6;
if (node.type === 'div' && node.value === ',') {
return node;
}
}
}
return {
type: 'div',
value: ',',
after: ' '
};
};
_proto.cleanOtherPrefixes = function cleanOtherPrefixes(params, prefix) {
var _this3 = this;
return params.filter(function (param) {
var current = vendor.prefix(_this3.findProp(param));
return current === '' || current === prefix;
});
}
/**
* Remove all non-webkit prefixes and unprefixed params if we have prefixed
*/
;
_proto.cleanFromUnprefixed = function cleanFromUnprefixed(params, prefix) {
var _this4 = this;
var remove = params.map(function (i) {
return _this4.findProp(i);
}).filter(function (i) {
return i.slice(0, prefix.length) === prefix;
}).map(function (i) {
return _this4.prefixes.unprefixed(i);
});
var result = [];
for (var _iterator9 = params, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
var _ref7;
if (_isArray9) {
if (_i9 >= _iterator9.length) break;
_ref7 = _iterator9[_i9++];
} else {
_i9 = _iterator9.next();
if (_i9.done) break;
_ref7 = _i9.value;
}
var param = _ref7;
var prop = this.findProp(param);
var p = vendor.prefix(prop);
if (remove.indexOf(prop) === -1 && (p === prefix || p === '')) {
result.push(param);
}
}
return result;
}
/**
* Check property for disabled by option
*/
;
_proto.disabled = function disabled(prop, prefix) {
var other = ['order', 'justify-content', 'align-self', 'align-content'];
if (prop.indexOf('flex') !== -1 || other.indexOf(prop) !== -1) {
if (this.prefixes.options.flexbox === false) {
return true;
}
if (this.prefixes.options.flexbox === 'no-2009') {
return prefix.indexOf('2009') !== -1;
}
}
return undefined;
};
return Transition;
}();
module.exports = Transition;
+76 -61
View File
@@ -1,93 +1,108 @@
'use strict';
"use strict";
var list = require('postcss').list;
module.exports = {
/**
/**
* Throw special error, to tell beniary,
* that this error is from Autoprefixer.
*/
error: function error(text) {
var err = new Error(text);
err.autoprefixer = true;
throw err;
},
error: function error(text) {
var err = new Error(text);
err.autoprefixer = true;
throw err;
},
/**
/**
* Return array, that doesn’t contain duplicates.
*/
uniq: function uniq(array) {
var filtered = [];
for (var _iterator = array, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
uniq: function uniq(array) {
var filtered = [];
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
for (var _iterator = array, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var i = _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
if (filtered.indexOf(i) === -1) {
filtered.push(i);
}
}
return filtered;
},
var i = _ref;
if (filtered.indexOf(i) === -1) {
filtered.push(i);
}
}
/**
return filtered;
},
/**
* Return "-webkit-" on "-webkit- old"
*/
removeNote: function removeNote(string) {
if (string.indexOf(' ') === -1) {
return string;
}
removeNote: function removeNote(string) {
if (string.indexOf(' ') === -1) {
return string;
}
return string.split(' ')[0];
},
return string.split(' ')[0];
},
/**
/**
* Escape RegExp symbols
*/
escapeRegexp: function escapeRegexp(string) {
return string.replace(/[.?*+\^\$\[\]\\(){}|\-]/g, '\\$&');
},
escapeRegexp: function escapeRegexp(string) {
return string.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&');
},
/**
/**
* Return regexp to check, that CSS string contain word
*/
regexp: function regexp(word) {
var escape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
regexp: function regexp(word, escape) {
if (escape === void 0) {
escape = true;
}
if (escape) {
word = this.escapeRegexp(word);
}
return new RegExp('(^|[\\s,(])(' + word + '($|[\\s(,]))', 'gi');
},
if (escape) {
word = this.escapeRegexp(word);
}
return new RegExp("(^|[\\s,(])(" + word + "($|[\\s(,]))", 'gi');
},
/**
/**
* Change comma list
*/
editList: function editList(value, callback) {
var origin = list.comma(value);
var changed = callback(origin, []);
editList: function editList(value, callback) {
var origin = list.comma(value);
var changed = callback(origin, []);
if (origin === changed) {
return value;
}
var join = value.match(/,\s*/);
join = join ? join[0] : ', ';
return changed.join(join);
if (origin === changed) {
return value;
}
var join = value.match(/,\s*/);
join = join ? join[0] : ', ';
return changed.join(join);
},
/**
* Split the selector into parts.
* It returns 3 level deep array because selectors can be comma
* separated (1), space separated (2), and combined (3)
* @param {String} selector selector string
* @return {Array<Array<Array>>} 3 level deep array of split selector
* @see utils.test.js for examples
*/
splitSelector: function splitSelector(selector) {
return list.comma(selector).map(function (i) {
return list.space(i).map(function (k) {
return k.split(/(?=\.|#)/g);
});
});
}
};
+110 -112
View File
@@ -1,168 +1,166 @@
'use strict';
"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); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
var Prefixer = require('./prefixer');
var OldValue = require('./old-value');
var utils = require('./utils');
var vendor = require('postcss').vendor;
var Value = function (_Prefixer) {
_inherits(Value, _Prefixer);
var Value =
/*#__PURE__*/
function (_Prefixer) {
_inheritsLoose(Value, _Prefixer);
function Value() {
_classCallCheck(this, Value);
function Value() {
return _Prefixer.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
}
/**
/**
* Clone decl for each prefixed values
*/
Value.save = function save(prefixes, decl) {
var _this2 = this;
Value.save = function save(prefixes, decl) {
var _this = this;
var prop = decl.prop;
var result = [];
var prop = decl.prop;
var result = [];
var _loop = function _loop(prefix) {
var value = decl._autoprefixerValues[prefix];
var _loop = function _loop(prefix) {
var value = decl._autoprefixerValues[prefix];
if (value === decl.value) {
return 'continue';
}
if (value === decl.value) {
return "continue";
}
var item = void 0;
var propPrefix = vendor.prefix(prop);
var item = void 0;
var propPrefix = vendor.prefix(prop);
if (propPrefix === '-pie-') {
return 'continue';
}
if (propPrefix === '-pie-') {
return "continue";
}
if (propPrefix === prefix) {
item = decl.value = value;
result.push(item);
return 'continue';
}
if (propPrefix === prefix) {
item = decl.value = value;
result.push(item);
return "continue";
}
var prefixed = prefixes.prefixed(prop, prefix);
var rule = decl.parent;
var prefixed = prefixes.prefixed(prop, prefix);
var rule = decl.parent;
if (!rule.every(function (i) {
return i.prop !== prefixed;
})) {
result.push(item);
return 'continue';
}
if (!rule.every(function (i) {
return i.prop !== prefixed;
})) {
result.push(item);
return "continue";
}
var trimmed = value.replace(/\s+/, ' ');
var already = rule.some(function (i) {
return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
});
var trimmed = value.replace(/\s+/, ' ');
var already = rule.some(function (i) {
return i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed;
});
if (already) {
result.push(item);
return 'continue';
}
if (already) {
result.push(item);
return "continue";
}
var cloned = _this2.clone(decl, { value: value });
item = decl.parent.insertBefore(decl, cloned);
var cloned = _this.clone(decl, {
value: value
});
result.push(item);
};
for (var prefix in decl._autoprefixerValues) {
var _ret = _loop(prefix);
if (_ret === 'continue') continue;
}
return result;
item = decl.parent.insertBefore(decl, cloned);
result.push(item);
};
/**
for (var prefix in decl._autoprefixerValues) {
var _ret = _loop(prefix);
if (_ret === "continue") continue;
}
return result;
}
/**
* Is declaration need to be prefixed
*/
;
var _proto = Value.prototype;
Value.prototype.check = function check(decl) {
var value = decl.value;
if (value.indexOf(this.name) === -1) {
return false;
}
_proto.check = function check(decl) {
var value = decl.value;
return !!value.match(this.regexp());
};
if (value.indexOf(this.name) === -1) {
return false;
}
/**
return !!value.match(this.regexp());
}
/**
* Lazy regexp loading
*/
;
Value.prototype.regexp = function regexp() {
return this.regexpCache || (this.regexpCache = utils.regexp(this.name));
};
/**
_proto.regexp = function regexp() {
return this.regexpCache || (this.regexpCache = utils.regexp(this.name));
}
/**
* Add prefix to values in string
*/
;
Value.prototype.replace = function replace(string, prefix) {
return string.replace(this.regexp(), '$1' + prefix + '$2');
};
/**
_proto.replace = function replace(string, prefix) {
return string.replace(this.regexp(), "$1" + prefix + "$2");
}
/**
* Get value with comments if it was not changed
*/
;
Value.prototype.value = function value(decl) {
if (decl.raws.value && decl.raws.value.value === decl.value) {
return decl.raws.value.raw;
} else {
return decl.value;
}
};
/**
_proto.value = function value(decl) {
if (decl.raws.value && decl.raws.value.value === decl.value) {
return decl.raws.value.raw;
} else {
return decl.value;
}
}
/**
* Save values with next prefixed token
*/
;
_proto.add = function add(decl, prefix) {
if (!decl._autoprefixerValues) {
decl._autoprefixerValues = {};
}
Value.prototype.add = function add(decl, prefix) {
if (!decl._autoprefixerValues) {
decl._autoprefixerValues = {};
}
var value = decl._autoprefixerValues[prefix] || this.value(decl);
var value = decl._autoprefixerValues[prefix] || this.value(decl);
var before;
var before = void 0;
do {
before = value;
value = this.replace(value, prefix);
if (value === false) return;
} while (value !== before);
do {
before = value;
value = this.replace(value, prefix);
if (value === false) return;
} while (value !== before);
decl._autoprefixerValues[prefix] = value;
};
/**
decl._autoprefixerValues[prefix] = value;
}
/**
* Return function to fast find prefixed value
*/
;
_proto.old = function old(prefix) {
return new OldValue(this.name, prefix + this.name);
};
Value.prototype.old = function old(prefix) {
return new OldValue(this.name, prefix + this.name);
};
return Value;
return Value;
}(Prefixer);
module.exports = Value;
+18 -560
View File
@@ -1,593 +1,51 @@
{
"_from": "autoprefixer@^7.2.6",
"_id": "autoprefixer@7.2.6",
"_from": "autoprefixer@^9.4.2",
"_id": "autoprefixer@9.4.10",
"_inBundle": false,
"_integrity": "sha512-Iq8TRIB+/9eQ8rbGhcP7ct5cYb/3qjNYAR2SnzLCEcwF6rvVOax8+9+fccgXk4bEhQGjOZd5TLhsksmAdsbGqQ==",
"_integrity": "sha512-XR8XZ09tUrrSzgSlys4+hy5r2/z4Jp7Ag3pHm31U4g/CTccYPOVe19AkaJ4ey/vRd1sfj+5TtuD6I0PXtutjvQ==",
"_location": "/autoprefixer",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "autoprefixer@^7.2.6",
"raw": "autoprefixer@^9.4.2",
"name": "autoprefixer",
"escapedName": "autoprefixer",
"rawSpec": "^7.2.6",
"rawSpec": "^9.4.2",
"saveSpec": null,
"fetchSpec": "^7.2.6"
"fetchSpec": "^9.4.2"
},
"_requiredBy": [
"/laravel-mix"
],
"_resolved": "http://registry.npmjs.org/autoprefixer/-/autoprefixer-7.2.6.tgz",
"_shasum": "256672f86f7c735da849c4f07d008abb056067dc",
"_spec": "autoprefixer@^7.2.6",
"_resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.10.tgz",
"_shasum": "e1be61fc728bacac8f4252ed242711ec0dcc6a7b",
"_spec": "autoprefixer@^9.4.2",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\laravel-mix",
"author": {
"name": "Andrey Sitnik",
"email": "andrey@sitnik.ru"
},
"bin": {
"autoprefixer-info": "./bin/autoprefixer-info"
"autoprefixer": "./bin/autoprefixer"
},
"bugs": {
"url": "https://github.com/postcss/autoprefixer/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Aaron",
"email": "me@aaron.md"
},
{
"name": "Adam Lynch",
"email": "contact@adamlynch.ie"
},
{
"name": "Adonis K",
"email": "aklp08@gmail.com"
},
{
"name": "Adriaan",
"email": "https://github.com/harianus"
},
{
"name": "Aleksei Androsov",
"email": "aandrosov@yandex-team.ru"
},
{
"name": "Aleksey Shvayka",
"email": "shvaikalesh@gmail.com"
},
{
"name": "Aleks Hudochenkov",
"email": "aleks@hudochenkov.com"
},
{
"name": "Alexey Komarov",
"email": "alex7kom@gmail.com"
},
{
"name": "Alexey Plutalov",
"email": "demiazz.py@gmail.com"
},
{
"name": "Anders Olsen Sandvik",
"email": "https://github.com/Andersos"
},
{
"name": "Andreas Haller",
"email": "Andreas.Haller@invision.de"
},
{
"name": "Andreas Lind",
"email": "andreas@one.com"
},
{
"name": "Andrew Rhoads"
},
{
"name": "Andrey Deryabin",
"email": "deriabin@gmail.com"
},
{
"name": "Andrey Sitnik",
"email": "andrey@sitnik.ru"
},
{
"name": "Andrey Taritsyn",
"email": "taritsyn@gmail.com"
},
{
"name": "Andy Trevorah",
"email": "a.trevorah@gmail.com"
},
{
"name": "Anton Khlynovskiy",
"email": "subzey@gmail.com"
},
{
"name": "Artem Yavorsky",
"email": "info@yavorsky.org"
},
{
"name": "aruseni",
"email": "aruseni.magiku@gmail.com"
},
{
"name": "Ben Briggs",
"email": "beneb.info@gmail.com"
},
{
"name": "bernig",
"email": "https://github.com/bernig"
},
{
"name": "Bogdan Chadkin",
"email": "trysound@yandex.ru"
},
{
"name": "brainopia",
"email": "brainopia@evilmartians.com"
},
{
"name": "Brandon Mathis",
"email": "brandon@imathis.com"
},
{
"name": "Chad von Nau",
"email": "chad@vonnau.com"
},
{
"name": "Chi Vinh Le",
"email": "vinh@wikiwi.io"
},
{
"name": "Cory House",
"email": "housecor@gmail.com"
},
{
"name": "Cory Simmons",
"email": "cory@mojotech.com"
},
{
"name": "Craig Martin",
"email": "https://github.com/craigmichaelmartin"
},
{
"name": "Damon",
"email": "motoxer4533@gmail.com"
},
{
"name": "Daniel Garcia-Carrillo",
"email": "garciacarrillo.daniel@gmail.com"
},
{
"name": "Daniel Tschinder",
"email": "daniel@tschinder.de"
},
{
"name": "Danny Pule",
"email": "kojikusan@gmail.com"
},
{
"name": "Darius"
},
{
"name": "David Narbutovich",
"email": "vamnemne@gmail.com"
},
{
"name": "David Pike",
"email": "david@evolution7.com.au"
},
{
"name": "Denis Sokolov",
"email": "denis@sokolov.cc"
},
{
"name": "Dominik Porada",
"email": "dominik@porada.co"
},
{
"name": "Dominik Schilling",
"email": "dominikschilling+git@gmail.com"
},
{
"name": "dotch",
"email": "ch.weiss@hotmail.de"
},
{
"name": "Dmitry Semigradsky",
"email": "semigradskyd@gmail.com"
},
{
"name": "Efremov Alexey",
"email": "lexich121@gmail.com"
},
{
"name": "eitanr",
"email": "eitanr@wix.com"
},
{
"name": "Erik Sundahl",
"email": "esundahl@gmail.com"
},
{
"name": "Eugene Datsky",
"email": "eugene@datsky.ru"
},
{
"name": "Evgeny Petukhov",
"email": "petukhov.yevgeny@gmail.com"
},
{
"name": "Evilebot Tnawi",
"email": "sheo13666q@gmail.com"
},
{
"name": "Fangzhou Li",
"email": "riophaelee@gmail.com"
},
{
"name": "Forrest York",
"email": "https://github.com/badisa"
},
{
"name": "Google Inc."
},
{
"name": "Gregory Eremin",
"email": "magnolia_fan@me.com"
},
{
"name": "GU Yiling",
"email": "justice360@gmail.com"
},
{
"name": "Hallvord R. M. Steen",
"email": "hallvord@hallvord.com"
},
{
"name": "heady",
"email": "https://github.com/heady"
},
{
"name": "Iain Beeston",
"email": "iain.beeston@gmail.com"
},
{
"name": "Igor Adamenko",
"email": "https://github.com/igoradamenko"
},
{
"name": "Jack Moore",
"email": "hello@jacklmoore.com"
},
{
"name": "Jason Kuhrt",
"email": "jasonkuhrt@me.com"
},
{
"name": "Jeff Escalante",
"email": "hello@jenius.me"
},
{
"name": "Joan León",
"email": "joan.leon@gmail.com"
},
{
"name": "Johannes J. Schmidt",
"email": "schmidt@netzmerk.com"
},
{
"name": "John Kreitlow",
"email": "jkreitlow@deepfocus.net"
},
{
"name": "Jonathan Ong",
"email": "jonathanrichardong@gmail.com"
},
{
"name": "Josh Gillies",
"email": "github@joshgilli.es"
},
{
"name": "Junliang Huang"
},
{
"name": "jvdanilo",
"email": "jvdanilo@gmail.com"
},
{
"name": "Kevin Pfefferle",
"email": "kevin@rebaseinteractive.com"
},
{
"name": "Kieran",
"email": "Kieranju@gmail.com"
},
{
"name": "Kir Shatrov",
"email": "shatrov@me.com"
},
{
"name": "Kiwi",
"email": "vinh@wikiwi.io"
},
{
"name": "kizu",
"email": "kizmarh@gmail.com"
},
{
"name": "Leonya Khachaturov",
"email": "leonidkhachaturov@gmail.com"
},
{
"name": "Lovchikov Anton",
"email": "besyanya@yandex.ru"
},
{
"name": "L.T",
"email": "ec.huyinghuan@gmail.com"
},
{
"name": "Lucas Caton",
"email": "lucascaton@gmail.com"
},
{
"name": "Luciano Battagliero",
"email": "lucianobattagliero+git@gmail.com"
},
{
"name": "Luke Page",
"email": "luke.a.page@gmail.com"
},
{
"name": "martco",
"email": "martco@gmail.com"
},
{
"name": "Matt Smith",
"email": "runner_28@hotmail.com"
},
{
"name": "Maxime Thirouin",
"email": "m@moox.io"
},
{
"name": "Max Mechanic",
"email": "max@philo.com"
},
{
"name": "Michael Beil",
"email": "michaelbeil@me.com"
},
{
"name": "Michael Scott Hertzberg",
"email": "mshertzberg@gmail.com"
},
{
"name": "Michał Gołębiowski-Owczarek",
"email": "m.goleb@gmail.com"
},
{
"name": "Mikael Jorhult",
"email": "mikael@jorhult.se"
},
{
"name": "Morton Fox",
"email": "github@qslw.com"
},
{
"name": "mvasilkov",
"email": "mvasilkov@gmail.com"
},
{
"name": "Nick Howes",
"email": "nick@nickhowes.co.uk"
},
{
"name": "Nick Marchenko",
"email": "n30n1ck@gmail.com"
},
{
"name": "Nick Schonning",
"email": "nschonni@gmail.com"
},
{
"name": "nickspielgist",
"email": "dev@nickspiel.me"
},
{
"name": "Niels Dequeker",
"email": "niels.dequeker@gmail.com"
},
{
"name": "Nikolay Burlov",
"email": "kohgpat@gmail.com"
},
{
"name": "Oleksandr Sergiienko",
"email": "sigerello@gmail.com"
},
{
"name": "Pavel Pustovalov",
"email": "pustovalov.pavel@gmail.com"
},
{
"name": "Paul Statezny",
"email": "Paulstatezny@gmail.com"
},
{
"name": "Peter van Westen",
"email": "info@regularlabs.com"
},
{
"name": "Peter Zotov",
"email": "whitequark@whitequark.org"
},
{
"name": "Phil Dokas",
"email": "phil@jetless.org"
},
{
"name": "Rafael Silva",
"email": "rafael@rafaelsilva.net"
},
{
"name": "Ray Lehnhoff",
"email": "raymond.lehnhoff@gmail.com"
},
{
"name": "ReadmeCritic",
"email": "frankensteinbot@gmail.com"
},
{
"name": "Reinaldo Schiehll",
"email": "rn.schiehll@gmail.com"
},
{
"name": "René Stalder",
"email": "rene@whatwedo.ch"
},
{
"name": "Richard Wang",
"email": "richardwa@google.com"
},
{
"name": "Rob Howell",
"email": "rob@robhowell.com"
},
{
"name": "Roland Warmerdam",
"email": "rowno@webspirited.com"
},
{
"name": "Roman Dvornov",
"email": "rdvornov@gmail.com"
},
{
"name": "Ryan Zimmerman"
},
{
"name": "Sami Suo-Heikki",
"email": "suoheikki.sami@gmail.com"
},
{
"name": "Sasha Koss",
"email": "koss@nocorp.me"
},
{
"name": "Sean Anderson",
"email": "Sean.Palmer.Anderson@gmail.com"
},
{
"name": "Sergey Belov",
"email": "peimei@ya.ru"
},
{
"name": "Sergey Leschina",
"email": "mail@putnik.ws"
},
{
"name": "sethjgore",
"email": "sethjgore@gmail.com"
},
{
"name": "Šime Vidas",
"email": "sime.vidas@gmail.com"
},
{
"name": "Simon Lydell",
"email": "simon.lydell@gmail.com"
},
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "Stephen Edgar",
"email": "stephen@netweb.com.au"
},
{
"name": "Steve Mao",
"email": "https://github.com/stevemao"
},
{
"name": "Stig Otnes Kolstad",
"email": "stig@stigok.net"
},
{
"name": "Subash Pathak",
"email": "sbspk@msn.com"
},
{
"name": "sunhao",
"email": "sunhao_1988@msn.cn"
},
{
"name": "tomdavenport",
"email": "playmusic@me.com"
},
{
"name": "Tony Ganch",
"email": "tonyganch@gmail.com"
},
{
"name": "Vegard Andreas Larsen",
"email": "vegard@xaltra.net"
},
{
"name": "Vera Surkova",
"email": "vera@surkova.se"
},
{
"name": "Vincent De Oliveira",
"email": "vincent@iamvdo.me"
},
{
"name": "Vishnu Ravi",
"email": "vishnu@vishnu.io"
},
{
"name": "Vladimir Pouzanov",
"email": "farcaller@gmail.com"
},
{
"name": "vladkens",
"email": "vladkens@yandex.ru"
},
{
"name": "Yet Another Minion",
"email": "yam@thinkalexandria.com"
},
{
"name": "Даниил Пронин",
"email": "mail@grawl.ru"
},
{
"name": "一丝",
"email": "jie.lijie@alibaba-inc.com"
},
{
"name": "刘祺",
"email": "gucong@gmail.com"
},
{
"name": "忆初",
"email": "baby@justjavac.com"
}
],
"dependencies": {
"browserslist": "^2.11.3",
"caniuse-lite": "^1.0.30000805",
"browserslist": "^4.4.2",
"caniuse-lite": "^1.0.30000940",
"normalize-range": "^0.1.2",
"num2fraction": "^1.2.2",
"postcss": "^6.0.17",
"postcss-value-parser": "^3.2.3"
"postcss": "^7.0.14",
"postcss-value-parser": "^3.3.1"
},
"deprecated": false,
"description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
"engines": {
"node": ">=6.0.0"
},
"homepage": "https://github.com/postcss/autoprefixer#readme",
"keywords": [
"autoprefixer",
@@ -603,5 +61,5 @@
"type": "git",
"url": "git+https://github.com/postcss/autoprefixer.git"
},
"version": "7.2.6"
"version": "9.4.10"
}