Начат фронтенд
This commit is contained in:
6
node_modules/autoprefixer/README.md
generated
vendored
6
node_modules/autoprefixer/README.md
generated
vendored
@@ -1,7 +1,7 @@
|
||||
# Autoprefixer [![Cult Of Martians][cult-img]][cult]
|
||||
|
||||
<img align="right" width="94" height="71"
|
||||
src="https://postcss.github.io/autoprefixer/logo.svg"
|
||||
src="http://postcss.github.io/autoprefixer/logo.svg"
|
||||
title="Autoprefixer logo by Anton Lovchikov">
|
||||
|
||||
[PostCSS] plugin to parse CSS and add vendor prefixes to CSS rules using values
|
||||
@@ -57,9 +57,9 @@ Twitter account for news and releases: [@autoprefixer].
|
||||
[interactive demo]: https://autoprefixer.github.io/
|
||||
[@autoprefixer]: https://twitter.com/autoprefixer
|
||||
[Can I Use]: https://caniuse.com/
|
||||
[cult-img]: https://cultofmartians.com/assets/badges/badge.svg
|
||||
[cult-img]: http://cultofmartians.com/assets/badges/badge.svg
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
[cult]: https://cultofmartians.com/tasks/autoprefixer-grid.html
|
||||
[cult]: http://cultofmartians.com/tasks/autoprefixer-grid.html
|
||||
|
||||
|
||||
## Docs
|
||||
|
||||
382
node_modules/autoprefixer/data/prefixes.js
generated
vendored
382
node_modules/autoprefixer/data/prefixes.js
generated
vendored
@@ -68,9 +68,9 @@ f(prefixBorderRadius, browsers =>
|
||||
'border-bottom-left-radius'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
mistakes: ['-khtml-', '-ms-', '-o-'],
|
||||
feature: 'border-radius',
|
||||
mistakes: ['-khtml-', '-ms-', '-o-']
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -80,9 +80,9 @@ let prefixBoxshadow = require('caniuse-lite/data/features/css-boxshadow')
|
||||
|
||||
f(prefixBoxshadow, browsers =>
|
||||
prefix(['box-shadow'], {
|
||||
browsers,
|
||||
mistakes: ['-khtml-'],
|
||||
feature: 'css-boxshadow',
|
||||
mistakes: ['-khtml-']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -104,9 +104,9 @@ f(prefixAnimation, browsers =>
|
||||
'@keyframes'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
mistakes: ['-khtml-', '-ms-'],
|
||||
feature: 'css-animation',
|
||||
mistakes: ['-khtml-', '-ms-']
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -124,9 +124,9 @@ f(prefixTransition, browsers =>
|
||||
'transition-timing-function'
|
||||
],
|
||||
{
|
||||
mistakes: ['-khtml-', '-ms-'],
|
||||
browsers,
|
||||
feature: 'css-transitions',
|
||||
mistakes: ['-khtml-', '-ms-']
|
||||
feature: 'css-transitions'
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -136,8 +136,8 @@ let prefixTransform2d = require('caniuse-lite/data/features/transforms2d')
|
||||
|
||||
f(prefixTransform2d, browsers =>
|
||||
prefix(['transform', 'transform-origin'], {
|
||||
browsers,
|
||||
feature: 'transforms2d'
|
||||
feature: 'transforms2d',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -146,21 +146,21 @@ let prefixTransforms3d = require('caniuse-lite/data/features/transforms3d')
|
||||
|
||||
f(prefixTransforms3d, browsers => {
|
||||
prefix(['perspective', 'perspective-origin'], {
|
||||
browsers,
|
||||
feature: 'transforms3d'
|
||||
feature: 'transforms3d',
|
||||
browsers
|
||||
})
|
||||
return prefix(['transform-style'], {
|
||||
mistakes: ['-ms-', '-o-'],
|
||||
browsers,
|
||||
feature: 'transforms3d',
|
||||
mistakes: ['-ms-', '-o-']
|
||||
feature: 'transforms3d'
|
||||
})
|
||||
})
|
||||
|
||||
f(prefixTransforms3d, { match: /y\sx|y\s#2/ }, browsers =>
|
||||
prefix(['backface-visibility'], {
|
||||
browsers,
|
||||
mistakes: ['-ms-', '-o-'],
|
||||
feature: 'transforms3d',
|
||||
mistakes: ['-ms-', '-o-']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -176,9 +176,6 @@ f(prefixGradients, { match: /y\sx/ }, browsers =>
|
||||
'repeating-radial-gradient'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-gradients',
|
||||
mistakes: ['-ms-'],
|
||||
props: [
|
||||
'background',
|
||||
'background-image',
|
||||
@@ -188,7 +185,10 @@ f(prefixGradients, { match: /y\sx/ }, browsers =>
|
||||
'list-style-image',
|
||||
'content',
|
||||
'mask-image'
|
||||
]
|
||||
],
|
||||
mistakes: ['-ms-'],
|
||||
feature: 'css-gradients',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -209,8 +209,8 @@ f(prefixGradients, { match: /a\sx/ }, browsers => {
|
||||
'repeating-radial-gradient'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-gradients'
|
||||
feature: 'css-gradients',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
})
|
||||
@@ -220,8 +220,8 @@ let prefixBoxsizing = require('caniuse-lite/data/features/css3-boxsizing')
|
||||
|
||||
f(prefixBoxsizing, browsers =>
|
||||
prefix(['box-sizing'], {
|
||||
browsers,
|
||||
feature: 'css3-boxsizing'
|
||||
feature: 'css3-boxsizing',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -230,8 +230,8 @@ let prefixFilters = require('caniuse-lite/data/features/css-filters')
|
||||
|
||||
f(prefixFilters, browsers =>
|
||||
prefix(['filter'], {
|
||||
browsers,
|
||||
feature: 'css-filters'
|
||||
feature: 'css-filters',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -240,8 +240,6 @@ let prefixFilterFunction = require('caniuse-lite/data/features/css-filter-functi
|
||||
|
||||
f(prefixFilterFunction, browsers =>
|
||||
prefix(['filter-function'], {
|
||||
browsers,
|
||||
feature: 'css-filter-function',
|
||||
props: [
|
||||
'background',
|
||||
'background-image',
|
||||
@@ -251,17 +249,19 @@ f(prefixFilterFunction, browsers =>
|
||||
'list-style-image',
|
||||
'content',
|
||||
'mask-image'
|
||||
]
|
||||
],
|
||||
feature: 'css-filter-function',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
// Backdrop-filter
|
||||
let prefixBackdropFilter = require('caniuse-lite/data/features/css-backdrop-filter')
|
||||
let prefixBackdrop = require('caniuse-lite/data/features/css-backdrop-filter')
|
||||
|
||||
f(prefixBackdropFilter, { match: /y\sx|y\s#2/ }, browsers =>
|
||||
f(prefixBackdrop, { match: /y\sx|y\s#2/ }, browsers =>
|
||||
prefix(['backdrop-filter'], {
|
||||
browsers,
|
||||
feature: 'css-backdrop-filter'
|
||||
feature: 'css-backdrop-filter',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -270,8 +270,6 @@ let prefixElementFunction = require('caniuse-lite/data/features/css-element-func
|
||||
|
||||
f(prefixElementFunction, browsers =>
|
||||
prefix(['element'], {
|
||||
browsers,
|
||||
feature: 'css-element-function',
|
||||
props: [
|
||||
'background',
|
||||
'background-image',
|
||||
@@ -281,7 +279,9 @@ f(prefixElementFunction, browsers =>
|
||||
'list-style-image',
|
||||
'content',
|
||||
'mask-image'
|
||||
]
|
||||
],
|
||||
feature: 'css-element-function',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -303,15 +303,15 @@ f(prefixMulticolumns, browsers => {
|
||||
'column-fill'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'multicolumn'
|
||||
feature: 'multicolumn',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
|
||||
let noff = browsers.filter(i => !/firefox/.test(i))
|
||||
prefix(['break-before', 'break-after', 'break-inside'], {
|
||||
browsers: noff,
|
||||
feature: 'multicolumn'
|
||||
feature: 'multicolumn',
|
||||
browsers: noff
|
||||
})
|
||||
})
|
||||
|
||||
@@ -320,9 +320,9 @@ let prefixUserSelect = require('caniuse-lite/data/features/user-select-none')
|
||||
|
||||
f(prefixUserSelect, browsers =>
|
||||
prefix(['user-select'], {
|
||||
browsers,
|
||||
mistakes: ['-khtml-'],
|
||||
feature: 'user-select-none',
|
||||
mistakes: ['-khtml-']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -338,13 +338,13 @@ f(prefixFlexbox, { match: /a\sx/ }, browsers => {
|
||||
}
|
||||
})
|
||||
prefix(['display-flex', 'inline-flex'], {
|
||||
browsers,
|
||||
props: ['display'],
|
||||
feature: 'flexbox',
|
||||
props: ['display']
|
||||
browsers
|
||||
})
|
||||
prefix(['flex', 'flex-grow', 'flex-shrink', 'flex-basis'], {
|
||||
browsers,
|
||||
feature: 'flexbox'
|
||||
feature: 'flexbox',
|
||||
browsers
|
||||
})
|
||||
prefix(
|
||||
[
|
||||
@@ -358,20 +358,20 @@ f(prefixFlexbox, { match: /a\sx/ }, browsers => {
|
||||
'align-content'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'flexbox'
|
||||
feature: 'flexbox',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
f(prefixFlexbox, { match: /y\sx/ }, browsers => {
|
||||
add(['display-flex', 'inline-flex'], {
|
||||
browsers,
|
||||
feature: 'flexbox'
|
||||
feature: 'flexbox',
|
||||
browsers
|
||||
})
|
||||
add(['flex', 'flex-grow', 'flex-shrink', 'flex-basis'], {
|
||||
browsers,
|
||||
feature: 'flexbox'
|
||||
feature: 'flexbox',
|
||||
browsers
|
||||
})
|
||||
add(
|
||||
[
|
||||
@@ -385,8 +385,8 @@ f(prefixFlexbox, { match: /y\sx/ }, browsers => {
|
||||
'align-content'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'flexbox'
|
||||
feature: 'flexbox',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
})
|
||||
@@ -396,9 +396,9 @@ let prefixCalc = require('caniuse-lite/data/features/calc')
|
||||
|
||||
f(prefixCalc, browsers =>
|
||||
prefix(['calc'], {
|
||||
browsers,
|
||||
props: ['*'],
|
||||
feature: 'calc',
|
||||
props: ['*']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -407,8 +407,8 @@ let prefixBackgroundOptions = require('caniuse-lite/data/features/background-img
|
||||
|
||||
f(prefixBackgroundOptions, browsers =>
|
||||
prefix(['background-origin', 'background-size'], {
|
||||
browsers,
|
||||
feature: 'background-img-opts'
|
||||
feature: 'background-img-opts',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -417,8 +417,8 @@ let prefixBackgroundClipText = require('caniuse-lite/data/features/background-cl
|
||||
|
||||
f(prefixBackgroundClipText, browsers =>
|
||||
prefix(['background-clip'], {
|
||||
browsers,
|
||||
feature: 'background-clip-text'
|
||||
feature: 'background-clip-text',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -433,8 +433,8 @@ f(prefixFontFeature, browsers =>
|
||||
'font-language-override'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'font-feature'
|
||||
feature: 'font-feature',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -444,8 +444,8 @@ let prefixFontKerning = require('caniuse-lite/data/features/font-kerning')
|
||||
|
||||
f(prefixFontKerning, browsers =>
|
||||
prefix(['font-kerning'], {
|
||||
browsers,
|
||||
feature: 'font-kerning'
|
||||
feature: 'font-kerning',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -454,8 +454,8 @@ let prefixBorderImage = require('caniuse-lite/data/features/border-image')
|
||||
|
||||
f(prefixBorderImage, browsers =>
|
||||
prefix(['border-image'], {
|
||||
browsers,
|
||||
feature: 'border-image'
|
||||
feature: 'border-image',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -464,9 +464,9 @@ let prefixSelection = require('caniuse-lite/data/features/css-selection')
|
||||
|
||||
f(prefixSelection, browsers =>
|
||||
prefix(['::selection'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'css-selection',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -475,9 +475,9 @@ let prefixPlaceholder = require('caniuse-lite/data/features/css-placeholder')
|
||||
|
||||
f(prefixPlaceholder, browsers => {
|
||||
prefix(['::placeholder'], {
|
||||
browsers: browsers.concat(['ie 10 old', 'ie 11 old', 'firefox 18 old']),
|
||||
selector: true,
|
||||
feature: 'css-placeholder',
|
||||
selector: true
|
||||
browsers: browsers.concat(['ie 10 old', 'ie 11 old', 'firefox 18 old'])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -486,9 +486,9 @@ let prefixPlaceholderShown = require('caniuse-lite/data/features/css-placeholder
|
||||
|
||||
f(prefixPlaceholderShown, browsers => {
|
||||
prefix([':placeholder-shown'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'css-placeholder-shown',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
})
|
||||
|
||||
@@ -497,8 +497,8 @@ let prefixHyphens = require('caniuse-lite/data/features/css-hyphens')
|
||||
|
||||
f(prefixHyphens, browsers =>
|
||||
prefix(['hyphens'], {
|
||||
browsers,
|
||||
feature: 'css-hyphens'
|
||||
feature: 'css-hyphens',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -507,21 +507,17 @@ let prefixFullscreen = require('caniuse-lite/data/features/fullscreen')
|
||||
|
||||
f(prefixFullscreen, browsers =>
|
||||
prefix([':fullscreen'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'fullscreen',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
// ::backdrop pseudo-element
|
||||
// https://caniuse.com/mdn-css_selectors_backdrop
|
||||
let prefixBackdrop = require('caniuse-lite/data/features/mdn-css-backdrop-pseudo-element')
|
||||
|
||||
f(prefixBackdrop, browsers =>
|
||||
f(prefixFullscreen, { match: /x(\s#2|$)/ }, browsers =>
|
||||
prefix(['::backdrop'], {
|
||||
browsers,
|
||||
feature: 'backdrop',
|
||||
selector: true
|
||||
selector: true,
|
||||
feature: 'fullscreen',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -530,9 +526,9 @@ let prefixFileSelectorButton = require('caniuse-lite/data/features/css-file-sele
|
||||
|
||||
f(prefixFileSelectorButton, browsers =>
|
||||
prefix(['::file-selector-button'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'file-selector-button',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -541,9 +537,9 @@ let prefixAutofill = require('caniuse-lite/data/features/css-autofill')
|
||||
|
||||
f(prefixAutofill, browsers =>
|
||||
prefix([':autofill'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'css-autofill',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -552,8 +548,8 @@ let prefixTabsize = require('caniuse-lite/data/features/css3-tabsize')
|
||||
|
||||
f(prefixTabsize, browsers =>
|
||||
prefix(['tab-size'], {
|
||||
browsers,
|
||||
feature: 'css3-tabsize'
|
||||
feature: 'css3-tabsize',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -583,35 +579,27 @@ let sizeProps = [
|
||||
|
||||
f(prefixIntrinsic, browsers =>
|
||||
prefix(['max-content', 'min-content'], {
|
||||
browsers,
|
||||
props: sizeProps,
|
||||
feature: 'intrinsic-width',
|
||||
props: sizeProps
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
f(prefixIntrinsic, { match: /x|\s#4/ }, browsers =>
|
||||
prefix(['fill', 'fill-available'], {
|
||||
browsers,
|
||||
props: sizeProps,
|
||||
feature: 'intrinsic-width',
|
||||
props: sizeProps
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
f(prefixIntrinsic, { match: /x|\s#5/ }, browsers => {
|
||||
let ffFix = browsers.filter(i => {
|
||||
let [name, version] = i.split(' ')
|
||||
if (name === 'firefox' || name === 'and_ff') {
|
||||
return parseInt(version) < 94
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
return prefix(['fit-content'], {
|
||||
browsers: ffFix,
|
||||
f(prefixIntrinsic, { match: /x|\s#5/ }, browsers =>
|
||||
prefix(['fit-content'], {
|
||||
props: sizeProps,
|
||||
feature: 'intrinsic-width',
|
||||
props: sizeProps
|
||||
browsers
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
// Stretch value
|
||||
|
||||
@@ -619,9 +607,9 @@ let prefixStretch = require('caniuse-lite/data/features/css-width-stretch')
|
||||
|
||||
f(prefixStretch, browsers =>
|
||||
prefix(['stretch'], {
|
||||
browsers,
|
||||
props: sizeProps,
|
||||
feature: 'css-width-stretch',
|
||||
props: sizeProps
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -630,9 +618,9 @@ let prefixCursorsNewer = require('caniuse-lite/data/features/css3-cursors-newer'
|
||||
|
||||
f(prefixCursorsNewer, browsers =>
|
||||
prefix(['zoom-in', 'zoom-out'], {
|
||||
browsers,
|
||||
props: ['cursor'],
|
||||
feature: 'css3-cursors-newer',
|
||||
props: ['cursor']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -641,9 +629,9 @@ let prefixCursorsGrab = require('caniuse-lite/data/features/css3-cursors-grab')
|
||||
|
||||
f(prefixCursorsGrab, browsers =>
|
||||
prefix(['grab', 'grabbing'], {
|
||||
browsers,
|
||||
props: ['cursor'],
|
||||
feature: 'css3-cursors-grab',
|
||||
props: ['cursor']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -652,9 +640,9 @@ let prefixSticky = require('caniuse-lite/data/features/css-sticky')
|
||||
|
||||
f(prefixSticky, browsers =>
|
||||
prefix(['sticky'], {
|
||||
browsers,
|
||||
props: ['position'],
|
||||
feature: 'css-sticky',
|
||||
props: ['position']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -663,8 +651,8 @@ let prefixPointer = require('caniuse-lite/data/features/pointer')
|
||||
|
||||
f(prefixPointer, browsers =>
|
||||
prefix(['touch-action'], {
|
||||
browsers,
|
||||
feature: 'pointer'
|
||||
feature: 'pointer',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -673,8 +661,8 @@ let prefixDecoration = require('caniuse-lite/data/features/text-decoration')
|
||||
|
||||
f(prefixDecoration, { match: /x.*#[235]/ }, browsers =>
|
||||
prefix(['text-decoration-skip', 'text-decoration-skip-ink'], {
|
||||
browsers,
|
||||
feature: 'text-decoration'
|
||||
feature: 'text-decoration',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -682,8 +670,8 @@ let prefixDecorationShorthand = require('caniuse-lite/data/features/mdn-text-dec
|
||||
|
||||
f(prefixDecorationShorthand, browsers =>
|
||||
prefix(['text-decoration'], {
|
||||
browsers,
|
||||
feature: 'text-decoration'
|
||||
feature: 'text-decoration',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -691,8 +679,8 @@ let prefixDecorationColor = require('caniuse-lite/data/features/mdn-text-decorat
|
||||
|
||||
f(prefixDecorationColor, browsers =>
|
||||
prefix(['text-decoration-color'], {
|
||||
browsers,
|
||||
feature: 'text-decoration'
|
||||
feature: 'text-decoration',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -700,8 +688,8 @@ let prefixDecorationLine = require('caniuse-lite/data/features/mdn-text-decorati
|
||||
|
||||
f(prefixDecorationLine, browsers =>
|
||||
prefix(['text-decoration-line'], {
|
||||
browsers,
|
||||
feature: 'text-decoration'
|
||||
feature: 'text-decoration',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -709,8 +697,8 @@ let prefixDecorationStyle = require('caniuse-lite/data/features/mdn-text-decorat
|
||||
|
||||
f(prefixDecorationStyle, browsers =>
|
||||
prefix(['text-decoration-style'], {
|
||||
browsers,
|
||||
feature: 'text-decoration'
|
||||
feature: 'text-decoration',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -719,8 +707,8 @@ let prefixTextSizeAdjust = require('caniuse-lite/data/features/text-size-adjust'
|
||||
|
||||
f(prefixTextSizeAdjust, browsers =>
|
||||
prefix(['text-size-adjust'], {
|
||||
browsers,
|
||||
feature: 'text-size-adjust'
|
||||
feature: 'text-size-adjust',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -739,8 +727,8 @@ f(prefixCssMasks, browsers => {
|
||||
'mask-border-source'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-masks'
|
||||
feature: 'css-masks',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
prefix(
|
||||
@@ -754,8 +742,8 @@ f(prefixCssMasks, browsers => {
|
||||
'mask-border-slice'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-masks'
|
||||
feature: 'css-masks',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
})
|
||||
@@ -765,8 +753,8 @@ let prefixClipPath = require('caniuse-lite/data/features/css-clip-path')
|
||||
|
||||
f(prefixClipPath, browsers =>
|
||||
prefix(['clip-path'], {
|
||||
browsers,
|
||||
feature: 'css-clip-path'
|
||||
feature: 'css-clip-path',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -775,8 +763,8 @@ let prefixBoxdecoration = require('caniuse-lite/data/features/css-boxdecorationb
|
||||
|
||||
f(prefixBoxdecoration, browsers =>
|
||||
prefix(['box-decoration-break'], {
|
||||
browsers,
|
||||
feature: 'css-boxdecorationbreak'
|
||||
feature: 'css-boxdecorationbreak',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -785,8 +773,8 @@ let prefixObjectFit = require('caniuse-lite/data/features/object-fit')
|
||||
|
||||
f(prefixObjectFit, browsers =>
|
||||
prefix(['object-fit', 'object-position'], {
|
||||
browsers,
|
||||
feature: 'object-fit'
|
||||
feature: 'object-fit',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -795,8 +783,8 @@ let prefixShapes = require('caniuse-lite/data/features/css-shapes')
|
||||
|
||||
f(prefixShapes, browsers =>
|
||||
prefix(['shape-margin', 'shape-outside', 'shape-image-threshold'], {
|
||||
browsers,
|
||||
feature: 'css-shapes'
|
||||
feature: 'css-shapes',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -805,8 +793,8 @@ let prefixTextOverflow = require('caniuse-lite/data/features/text-overflow')
|
||||
|
||||
f(prefixTextOverflow, browsers =>
|
||||
prefix(['text-overflow'], {
|
||||
browsers,
|
||||
feature: 'text-overflow'
|
||||
feature: 'text-overflow',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -815,8 +803,8 @@ let prefixDeviceadaptation = require('caniuse-lite/data/features/css-deviceadapt
|
||||
|
||||
f(prefixDeviceadaptation, browsers =>
|
||||
prefix(['@viewport'], {
|
||||
browsers,
|
||||
feature: 'css-deviceadaptation'
|
||||
feature: 'css-deviceadaptation',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -825,8 +813,8 @@ let prefixResolut = require('caniuse-lite/data/features/css-media-resolution')
|
||||
|
||||
f(prefixResolut, { match: /( x($| )|a #2)/ }, browsers =>
|
||||
prefix(['@resolution'], {
|
||||
browsers,
|
||||
feature: 'css-media-resolution'
|
||||
feature: 'css-media-resolution',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -835,8 +823,8 @@ let prefixTextAlignLast = require('caniuse-lite/data/features/css-text-align-las
|
||||
|
||||
f(prefixTextAlignLast, browsers =>
|
||||
prefix(['text-align-last'], {
|
||||
browsers,
|
||||
feature: 'css-text-align-last'
|
||||
feature: 'css-text-align-last',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -845,16 +833,16 @@ let prefixCrispedges = require('caniuse-lite/data/features/css-crisp-edges')
|
||||
|
||||
f(prefixCrispedges, { match: /y x|a x #1/ }, browsers =>
|
||||
prefix(['pixelated'], {
|
||||
browsers,
|
||||
props: ['image-rendering'],
|
||||
feature: 'css-crisp-edges',
|
||||
props: ['image-rendering']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
f(prefixCrispedges, { match: /a x #2/ }, browsers =>
|
||||
prefix(['image-rendering'], {
|
||||
browsers,
|
||||
feature: 'css-crisp-edges'
|
||||
feature: 'css-crisp-edges',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -872,8 +860,8 @@ f(prefixLogicalProps, browsers =>
|
||||
'padding-inline-end'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-logical-props'
|
||||
feature: 'css-logical-props',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -889,8 +877,8 @@ f(prefixLogicalProps, { match: /x\s#2/ }, browsers =>
|
||||
'padding-block-end'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-logical-props'
|
||||
feature: 'css-logical-props',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -900,8 +888,8 @@ let prefixAppearance = require('caniuse-lite/data/features/css-appearance')
|
||||
|
||||
f(prefixAppearance, { match: /#2|x/ }, browsers =>
|
||||
prefix(['appearance'], {
|
||||
browsers,
|
||||
feature: 'css-appearance'
|
||||
feature: 'css-appearance',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -918,8 +906,8 @@ f(prefixSnappoints, browsers =>
|
||||
'scroll-snap-points-y'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-snappoints'
|
||||
feature: 'css-snappoints',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -929,8 +917,8 @@ let prefixRegions = require('caniuse-lite/data/features/css-regions')
|
||||
|
||||
f(prefixRegions, browsers =>
|
||||
prefix(['flow-into', 'flow-from', 'region-fragment'], {
|
||||
browsers,
|
||||
feature: 'css-regions'
|
||||
feature: 'css-regions',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -939,8 +927,6 @@ let prefixImageSet = require('caniuse-lite/data/features/css-image-set')
|
||||
|
||||
f(prefixImageSet, browsers =>
|
||||
prefix(['image-set'], {
|
||||
browsers,
|
||||
feature: 'css-image-set',
|
||||
props: [
|
||||
'background',
|
||||
'background-image',
|
||||
@@ -951,7 +937,9 @@ f(prefixImageSet, browsers =>
|
||||
'list-style',
|
||||
'list-style-image',
|
||||
'content'
|
||||
]
|
||||
],
|
||||
feature: 'css-image-set',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -960,8 +948,8 @@ let prefixWritingMode = require('caniuse-lite/data/features/css-writing-mode')
|
||||
|
||||
f(prefixWritingMode, { match: /a|x/ }, browsers =>
|
||||
prefix(['writing-mode'], {
|
||||
browsers,
|
||||
feature: 'css-writing-mode'
|
||||
feature: 'css-writing-mode',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -970,8 +958,6 @@ let prefixCrossFade = require('caniuse-lite/data/features/css-cross-fade')
|
||||
|
||||
f(prefixCrossFade, browsers =>
|
||||
prefix(['cross-fade'], {
|
||||
browsers,
|
||||
feature: 'css-cross-fade',
|
||||
props: [
|
||||
'background',
|
||||
'background-image',
|
||||
@@ -981,7 +967,9 @@ f(prefixCrossFade, browsers =>
|
||||
'list-style-image',
|
||||
'content',
|
||||
'mask-image'
|
||||
]
|
||||
],
|
||||
feature: 'css-cross-fade',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -990,9 +978,9 @@ let prefixReadOnly = require('caniuse-lite/data/features/css-read-only-write')
|
||||
|
||||
f(prefixReadOnly, browsers =>
|
||||
prefix([':read-only', ':read-write'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'css-read-only-write',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1008,8 +996,8 @@ f(prefixTextEmphasis, browsers =>
|
||||
'text-emphasis-color'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'text-emphasis'
|
||||
feature: 'text-emphasis',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -1019,9 +1007,9 @@ let prefixGrid = require('caniuse-lite/data/features/css-grid')
|
||||
|
||||
f(prefixGrid, browsers => {
|
||||
prefix(['display-grid', 'inline-grid'], {
|
||||
browsers,
|
||||
props: ['display'],
|
||||
feature: 'css-grid',
|
||||
props: ['display']
|
||||
browsers
|
||||
})
|
||||
prefix(
|
||||
[
|
||||
@@ -1039,16 +1027,16 @@ f(prefixGrid, browsers => {
|
||||
'place-self'
|
||||
],
|
||||
{
|
||||
browsers,
|
||||
feature: 'css-grid'
|
||||
feature: 'css-grid',
|
||||
browsers
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
f(prefixGrid, { match: /a x/ }, browsers =>
|
||||
prefix(['grid-column-align', 'grid-row-align'], {
|
||||
browsers,
|
||||
feature: 'css-grid'
|
||||
feature: 'css-grid',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1057,8 +1045,8 @@ let prefixTextSpacing = require('caniuse-lite/data/features/css-text-spacing')
|
||||
|
||||
f(prefixTextSpacing, browsers =>
|
||||
prefix(['text-spacing'], {
|
||||
browsers,
|
||||
feature: 'css-text-spacing'
|
||||
feature: 'css-text-spacing',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1067,9 +1055,9 @@ let prefixAnyLink = require('caniuse-lite/data/features/css-any-link')
|
||||
|
||||
f(prefixAnyLink, browsers =>
|
||||
prefix([':any-link'], {
|
||||
browsers,
|
||||
selector: true,
|
||||
feature: 'css-any-link',
|
||||
selector: true
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1079,9 +1067,9 @@ let bidiIsolate = require('caniuse-lite/data/features/mdn-css-unicode-bidi-isola
|
||||
|
||||
f(bidiIsolate, browsers =>
|
||||
prefix(['isolate'], {
|
||||
browsers,
|
||||
props: ['unicode-bidi'],
|
||||
feature: 'css-unicode-bidi',
|
||||
props: ['unicode-bidi']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1089,9 +1077,9 @@ let bidiPlaintext = require('caniuse-lite/data/features/mdn-css-unicode-bidi-pla
|
||||
|
||||
f(bidiPlaintext, browsers =>
|
||||
prefix(['plaintext'], {
|
||||
browsers,
|
||||
props: ['unicode-bidi'],
|
||||
feature: 'css-unicode-bidi',
|
||||
props: ['unicode-bidi']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1099,9 +1087,9 @@ let bidiOverride = require('caniuse-lite/data/features/mdn-css-unicode-bidi-isol
|
||||
|
||||
f(bidiOverride, { match: /y x/ }, browsers =>
|
||||
prefix(['isolate-override'], {
|
||||
browsers,
|
||||
props: ['unicode-bidi'],
|
||||
feature: 'css-unicode-bidi',
|
||||
props: ['unicode-bidi']
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1110,8 +1098,8 @@ let prefixOverscroll = require('caniuse-lite/data/features/css-overscroll-behavi
|
||||
|
||||
f(prefixOverscroll, { match: /a #1/ }, browsers =>
|
||||
prefix(['overscroll-behavior'], {
|
||||
browsers,
|
||||
feature: 'css-overscroll-behavior'
|
||||
feature: 'css-overscroll-behavior',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1120,8 +1108,8 @@ let prefixTextOrientation = require('caniuse-lite/data/features/css-text-orienta
|
||||
|
||||
f(prefixTextOrientation, browsers =>
|
||||
prefix(['text-orientation'], {
|
||||
browsers,
|
||||
feature: 'css-text-orientation'
|
||||
feature: 'css-text-orientation',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1130,7 +1118,7 @@ let prefixPrintAdjust = require('caniuse-lite/data/features/css-print-color-adju
|
||||
|
||||
f(prefixPrintAdjust, browsers =>
|
||||
prefix(['print-color-adjust', 'color-adjust'], {
|
||||
browsers,
|
||||
feature: 'css-print-color-adjust'
|
||||
feature: 'css-print-color-adjust',
|
||||
browsers
|
||||
})
|
||||
)
|
||||
|
||||
34
node_modules/autoprefixer/lib/autoprefixer.js
generated
vendored
34
node_modules/autoprefixer/lib/autoprefixer.js
generated
vendored
@@ -2,10 +2,10 @@ let browserslist = require('browserslist')
|
||||
let { agents } = require('caniuse-lite/dist/unpacker/agents')
|
||||
let pico = require('picocolors')
|
||||
|
||||
let dataPrefixes = require('../data/prefixes')
|
||||
let Browsers = require('./browsers')
|
||||
let getInfo = require('./info')
|
||||
let Prefixes = require('./prefixes')
|
||||
let dataPrefixes = require('../data/prefixes')
|
||||
let getInfo = require('./info')
|
||||
|
||||
let autoprefixerData = { browsers: agents, prefixes: dataPrefixes }
|
||||
|
||||
@@ -96,9 +96,9 @@ function plugin(...reqs) {
|
||||
}
|
||||
|
||||
let brwlstOpts = {
|
||||
env: options.env,
|
||||
ignoreUnknownVersions: options.ignoreUnknownVersions,
|
||||
stats: options.stats
|
||||
stats: options.stats,
|
||||
env: options.env
|
||||
}
|
||||
|
||||
function loadPrefixes(opts) {
|
||||
@@ -114,21 +114,12 @@ function plugin(...reqs) {
|
||||
}
|
||||
|
||||
return {
|
||||
browsers: reqs,
|
||||
|
||||
info(opts) {
|
||||
opts = opts || {}
|
||||
opts.from = opts.from || process.cwd()
|
||||
return getInfo(loadPrefixes(opts))
|
||||
},
|
||||
|
||||
options,
|
||||
|
||||
postcssPlugin: 'autoprefixer',
|
||||
|
||||
prepare(result) {
|
||||
let prefixes = loadPrefixes({
|
||||
env: options.env,
|
||||
from: result.opts.from
|
||||
from: result.opts.from,
|
||||
env: options.env
|
||||
})
|
||||
|
||||
return {
|
||||
@@ -142,7 +133,16 @@ function plugin(...reqs) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
info(opts) {
|
||||
opts = opts || {}
|
||||
opts.from = opts.from || process.cwd()
|
||||
return getInfo(loadPrefixes(opts))
|
||||
},
|
||||
|
||||
options,
|
||||
browsers: reqs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
24
node_modules/autoprefixer/lib/browsers.js
generated
vendored
24
node_modules/autoprefixer/lib/browsers.js
generated
vendored
@@ -4,13 +4,6 @@ let { agents } = require('caniuse-lite/dist/unpacker/agents')
|
||||
let utils = require('./utils')
|
||||
|
||||
class Browsers {
|
||||
constructor(data, requirements, options, browserslistOpts) {
|
||||
this.data = data
|
||||
this.options = options || {}
|
||||
this.browserslistOpts = browserslistOpts || {}
|
||||
this.selected = this.parse(requirements)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all prefixes for default browser data
|
||||
*/
|
||||
@@ -42,11 +35,11 @@ class Browsers {
|
||||
return this.prefixesRegexp.test(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Is browser is selected by requirements
|
||||
*/
|
||||
isSelected(browser) {
|
||||
return this.selected.includes(browser)
|
||||
constructor(data, requirements, options, browserslistOpts) {
|
||||
this.data = data
|
||||
this.options = options || {}
|
||||
this.browserslistOpts = browserslistOpts || {}
|
||||
this.selected = this.parse(requirements)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,6 +67,13 @@ class Browsers {
|
||||
}
|
||||
return `-${prefix}-`
|
||||
}
|
||||
|
||||
/**
|
||||
* Is browser is selected by requirements
|
||||
*/
|
||||
isSelected(browser) {
|
||||
return this.selected.includes(browser)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Browsers
|
||||
|
||||
196
node_modules/autoprefixer/lib/declaration.js
generated
vendored
196
node_modules/autoprefixer/lib/declaration.js
generated
vendored
@@ -1,20 +1,81 @@
|
||||
let Browsers = require('./browsers')
|
||||
let Prefixer = require('./prefixer')
|
||||
let Browsers = require('./browsers')
|
||||
let utils = require('./utils')
|
||||
|
||||
class Declaration extends Prefixer {
|
||||
/**
|
||||
* Clone and add prefixes for declaration
|
||||
* Always true, because we already get prefixer by property name
|
||||
*/
|
||||
add(decl, prefix, prefixes, result) {
|
||||
let prefixed = this.prefixed(decl.prop, prefix)
|
||||
if (
|
||||
this.isAlready(decl, prefixed) ||
|
||||
this.otherPrefixes(decl.value, prefix)
|
||||
) {
|
||||
return undefined
|
||||
check(/* decl */) {
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Check `value`, that it contain other prefixes, rather than `prefix`
|
||||
*/
|
||||
otherPrefixes(value, prefix) {
|
||||
for (let other of Browsers.prefixes()) {
|
||||
if (other === prefix) {
|
||||
continue
|
||||
}
|
||||
if (value.includes(other)) {
|
||||
return value.replace(/var\([^)]+\)/, '').includes(other)
|
||||
}
|
||||
}
|
||||
return this.insert(decl, prefix, prefixes, result)
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to declaration
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl.prop = this.prefixed(decl.prop, prefix)
|
||||
return decl
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we use visual cascade for prefixes
|
||||
*/
|
||||
needCascade(decl) {
|
||||
if (!decl._autoprefixerCascade) {
|
||||
decl._autoprefixerCascade =
|
||||
this.all.options.cascade !== false && decl.raw('before').includes('\n')
|
||||
}
|
||||
return decl._autoprefixerCascade
|
||||
}
|
||||
|
||||
/**
|
||||
* Return maximum length of possible prefixed property
|
||||
*/
|
||||
maxPrefixed(prefixes, decl) {
|
||||
if (decl._autoprefixerMax) {
|
||||
return decl._autoprefixerMax
|
||||
}
|
||||
|
||||
let max = 0
|
||||
for (let prefix of prefixes) {
|
||||
prefix = utils.removeNote(prefix)
|
||||
if (prefix.length > max) {
|
||||
max = prefix.length
|
||||
}
|
||||
}
|
||||
decl._autoprefixerMax = max
|
||||
|
||||
return decl._autoprefixerMax
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,10 +94,22 @@ class Declaration extends Prefixer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Always true, because we already get prefixer by property name
|
||||
* Remove visual cascade
|
||||
*/
|
||||
check(/* decl */) {
|
||||
return true
|
||||
restoreBefore(decl) {
|
||||
let lines = decl.raw('before').split('\n')
|
||||
let min = lines[lines.length - 1]
|
||||
|
||||
this.all.group(decl).up(prefixed => {
|
||||
let array = prefixed.raw('before').split('\n')
|
||||
let last = array[array.length - 1]
|
||||
if (last.length < min.length) {
|
||||
min = last
|
||||
}
|
||||
})
|
||||
|
||||
lines[lines.length - 1] = min
|
||||
decl.raws.before = lines.join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,70 +144,17 @@ class Declaration extends Prefixer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return maximum length of possible prefixed property
|
||||
* Clone and add prefixes for declaration
|
||||
*/
|
||||
maxPrefixed(prefixes, decl) {
|
||||
if (decl._autoprefixerMax) {
|
||||
return decl._autoprefixerMax
|
||||
add(decl, prefix, prefixes, result) {
|
||||
let prefixed = this.prefixed(decl.prop, prefix)
|
||||
if (
|
||||
this.isAlready(decl, prefixed) ||
|
||||
this.otherPrefixes(decl.value, prefix)
|
||||
) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let max = 0
|
||||
for (let prefix of prefixes) {
|
||||
prefix = utils.removeNote(prefix)
|
||||
if (prefix.length > max) {
|
||||
max = prefix.length
|
||||
}
|
||||
}
|
||||
decl._autoprefixerMax = max
|
||||
|
||||
return decl._autoprefixerMax
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we use visual cascade for prefixes
|
||||
*/
|
||||
needCascade(decl) {
|
||||
if (!decl._autoprefixerCascade) {
|
||||
decl._autoprefixerCascade =
|
||||
this.all.options.cascade !== false && decl.raw('before').includes('\n')
|
||||
}
|
||||
return decl._autoprefixerCascade
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of prefixed properties to clean old prefixes
|
||||
*/
|
||||
old(prop, prefix) {
|
||||
return [this.prefixed(prop, prefix)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Check `value`, that it contain other prefixes, rather than `prefix`
|
||||
*/
|
||||
otherPrefixes(value, prefix) {
|
||||
for (let other of Browsers.prefixes()) {
|
||||
if (other === prefix) {
|
||||
continue
|
||||
}
|
||||
if (value.includes(other)) {
|
||||
return value.replace(/var\([^)]+\)/, '').includes(other)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + prop
|
||||
return this.insert(decl, prefix, prefixes, result)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,30 +177,10 @@ class Declaration extends Prefixer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove visual cascade
|
||||
* Return list of prefixed properties to clean old prefixes
|
||||
*/
|
||||
restoreBefore(decl) {
|
||||
let lines = decl.raw('before').split('\n')
|
||||
let min = lines[lines.length - 1]
|
||||
|
||||
this.all.group(decl).up(prefixed => {
|
||||
let array = prefixed.raw('before').split('\n')
|
||||
let last = array[array.length - 1]
|
||||
if (last.length < min.length) {
|
||||
min = last
|
||||
}
|
||||
})
|
||||
|
||||
lines[lines.length - 1] = min
|
||||
decl.raws.before = lines.join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to declaration
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl.prop = this.prefixed(decl.prop, prefix)
|
||||
return decl
|
||||
old(prop, prefix) {
|
||||
return [this.prefixed(prop, prefix)]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
node_modules/autoprefixer/lib/hacks/align-content.js
generated
vendored
20
node_modules/autoprefixer/lib/hacks/align-content.js
generated
vendored
@@ -1,14 +1,7 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class AlignContent extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2012 spec
|
||||
*/
|
||||
@@ -21,6 +14,13 @@ class AlignContent extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2012 spec and ignore prefix for 2009
|
||||
*/
|
||||
@@ -42,8 +42,8 @@ AlignContent.names = ['align-content', 'flex-line-pack']
|
||||
AlignContent.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start',
|
||||
'space-around': 'distribute',
|
||||
'space-between': 'justify'
|
||||
'space-between': 'justify',
|
||||
'space-around': 'distribute'
|
||||
}
|
||||
|
||||
module.exports = AlignContent
|
||||
|
||||
16
node_modules/autoprefixer/lib/hacks/align-items.js
generated
vendored
16
node_modules/autoprefixer/lib/hacks/align-items.js
generated
vendored
@@ -1,14 +1,7 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class AlignItems extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-items'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 and 2012 specs
|
||||
*/
|
||||
@@ -24,6 +17,13 @@ class AlignItems extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-items'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2009 and 2012 specs
|
||||
*/
|
||||
|
||||
16
node_modules/autoprefixer/lib/hacks/align-self.js
generated
vendored
16
node_modules/autoprefixer/lib/hacks/align-self.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class AlignSelf extends Declaration {
|
||||
check(decl) {
|
||||
@@ -11,13 +11,6 @@ class AlignSelf extends Declaration {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2012 specs
|
||||
*/
|
||||
@@ -30,6 +23,13 @@ class AlignSelf extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2012 spec and ignore prefix for 2009
|
||||
*/
|
||||
|
||||
20
node_modules/autoprefixer/lib/hacks/block-logical.js
generated
vendored
20
node_modules/autoprefixer/lib/hacks/block-logical.js
generated
vendored
@@ -1,16 +1,6 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BlockLogical extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
if (prop.includes('-before')) {
|
||||
return prop.replace('-before', '-block-start')
|
||||
}
|
||||
return prop.replace('-after', '-block-end')
|
||||
}
|
||||
|
||||
/**
|
||||
* Use old syntax for -moz- and -webkit-
|
||||
*/
|
||||
@@ -20,6 +10,16 @@ class BlockLogical extends Declaration {
|
||||
}
|
||||
return prefix + prop.replace('-block-end', '-after')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
if (prop.includes('-before')) {
|
||||
return prop.replace('-before', '-block-start')
|
||||
}
|
||||
return prop.replace('-after', '-block-end')
|
||||
}
|
||||
}
|
||||
|
||||
BlockLogical.names = [
|
||||
|
||||
14
node_modules/autoprefixer/lib/hacks/border-radius.js
generated
vendored
14
node_modules/autoprefixer/lib/hacks/border-radius.js
generated
vendored
@@ -1,13 +1,6 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BorderRadius extends Declaration {
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return BorderRadius.toNormal[prop] || prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Change syntax, when add Mozilla prefix
|
||||
*/
|
||||
@@ -17,6 +10,13 @@ class BorderRadius extends Declaration {
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
normalize(prop) {
|
||||
return BorderRadius.toNormal[prop] || prop
|
||||
}
|
||||
}
|
||||
|
||||
BorderRadius.names = ['border-radius']
|
||||
|
||||
32
node_modules/autoprefixer/lib/hacks/break-props.js
generated
vendored
32
node_modules/autoprefixer/lib/hacks/break-props.js
generated
vendored
@@ -2,16 +2,10 @@ let Declaration = require('../declaration')
|
||||
|
||||
class BreakProps extends Declaration {
|
||||
/**
|
||||
* Don’t prefix some values
|
||||
* Change name for -webkit- and -moz- prefix
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (decl.prop !== 'break-inside') {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
|
||||
return undefined
|
||||
}
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
prefixed(prop, prefix) {
|
||||
return `${prefix}column-${prop}`
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,13 +21,6 @@ class BreakProps extends Declaration {
|
||||
return 'break-after'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change name for -webkit- and -moz- prefix
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return `${prefix}column-${prop}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Change prefixed value for avoid-column and avoid-page
|
||||
*/
|
||||
@@ -46,6 +33,19 @@ class BreakProps extends Declaration {
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Don’t prefix some values
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (decl.prop !== 'break-inside') {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
|
||||
return undefined
|
||||
}
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
}
|
||||
|
||||
BreakProps.names = [
|
||||
|
||||
20
node_modules/autoprefixer/lib/hacks/display-flex.js
generated
vendored
20
node_modules/autoprefixer/lib/hacks/display-flex.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
let flexSpec = require('./flex-spec')
|
||||
let OldValue = require('../old-value')
|
||||
let Value = require('../value')
|
||||
let flexSpec = require('./flex-spec')
|
||||
|
||||
class DisplayFlex extends Value {
|
||||
constructor(name, prefixes) {
|
||||
@@ -17,15 +17,6 @@ class DisplayFlex extends Value {
|
||||
return decl.prop === 'display' && decl.value === this.name
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for old specs
|
||||
*/
|
||||
old(prefix) {
|
||||
let prefixed = this.prefixed(prefix)
|
||||
if (!prefixed) return undefined
|
||||
return new OldValue(this.name, prefixed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value by spec
|
||||
*/
|
||||
@@ -58,6 +49,15 @@ class DisplayFlex extends Value {
|
||||
replace(string, prefix) {
|
||||
return this.prefixed(prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for old specs
|
||||
*/
|
||||
old(prefix) {
|
||||
let prefixed = this.prefixed(prefix)
|
||||
if (!prefixed) return undefined
|
||||
return new OldValue(this.name, prefixed)
|
||||
}
|
||||
}
|
||||
|
||||
DisplayFlex.names = ['display-flex', 'inline-flex']
|
||||
|
||||
2
node_modules/autoprefixer/lib/hacks/flex-basis.js
generated
vendored
2
node_modules/autoprefixer/lib/hacks/flex-basis.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexBasis extends Declaration {
|
||||
/**
|
||||
|
||||
18
node_modules/autoprefixer/lib/hacks/flex-direction.js
generated
vendored
18
node_modules/autoprefixer/lib/hacks/flex-direction.js
generated
vendored
@@ -1,7 +1,14 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexDirection extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex-direction'
|
||||
}
|
||||
|
||||
/**
|
||||
* Use two properties for 2009 spec
|
||||
*/
|
||||
@@ -20,7 +27,7 @@ class FlexDirection extends Declaration {
|
||||
}
|
||||
|
||||
let v = decl.value
|
||||
let dir, orient
|
||||
let orient, dir
|
||||
if (v === 'inherit' || v === 'initial' || v === 'unset') {
|
||||
orient = v
|
||||
dir = v
|
||||
@@ -46,13 +53,6 @@ class FlexDirection extends Declaration {
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex-direction'
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean two properties for 2009 spec
|
||||
*/
|
||||
|
||||
2
node_modules/autoprefixer/lib/hacks/flex-flow.js
generated
vendored
2
node_modules/autoprefixer/lib/hacks/flex-flow.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexFlow extends Declaration {
|
||||
/**
|
||||
|
||||
2
node_modules/autoprefixer/lib/hacks/flex-grow.js
generated
vendored
2
node_modules/autoprefixer/lib/hacks/flex-grow.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Flex extends Declaration {
|
||||
/**
|
||||
|
||||
2
node_modules/autoprefixer/lib/hacks/flex-shrink.js
generated
vendored
2
node_modules/autoprefixer/lib/hacks/flex-shrink.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexShrink extends Declaration {
|
||||
/**
|
||||
|
||||
2
node_modules/autoprefixer/lib/hacks/flex-wrap.js
generated
vendored
2
node_modules/autoprefixer/lib/hacks/flex-wrap.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexWrap extends Declaration {
|
||||
/**
|
||||
|
||||
16
node_modules/autoprefixer/lib/hacks/flex.js
generated
vendored
16
node_modules/autoprefixer/lib/hacks/flex.js
generated
vendored
@@ -1,16 +1,9 @@
|
||||
let list = require('postcss').list
|
||||
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Flex extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 spec
|
||||
*/
|
||||
@@ -23,6 +16,13 @@ class Flex extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'flex'
|
||||
}
|
||||
|
||||
/**
|
||||
* Spec 2009 supports only first argument
|
||||
* Spec 2012 disallows unitless basis
|
||||
|
||||
570
node_modules/autoprefixer/lib/hacks/gradient.js
generated
vendored
570
node_modules/autoprefixer/lib/hacks/gradient.js
generated
vendored
@@ -1,219 +1,57 @@
|
||||
let range = require('normalize-range')
|
||||
let parser = require('postcss-value-parser')
|
||||
let range = require('normalize-range')
|
||||
|
||||
let OldValue = require('../old-value')
|
||||
let utils = require('../utils')
|
||||
let Value = require('../value')
|
||||
let utils = require('../utils')
|
||||
|
||||
let IS_DIRECTION = /top|left|right|bottom/gi
|
||||
|
||||
class Gradient extends Value {
|
||||
/**
|
||||
* Do not add non-webkit prefixes for list-style and object
|
||||
* Change degrees for webkit prefix
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
let p = decl.prop
|
||||
if (p.includes('mask')) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
replace(string, prefix) {
|
||||
let ast = parser(string)
|
||||
for (let node of ast.nodes) {
|
||||
let gradientName = this.name // gradient name
|
||||
if (node.type === 'function' && node.value === gradientName) {
|
||||
node.nodes = this.newDirection(node.nodes)
|
||||
node.nodes = this.normalize(node.nodes, gradientName)
|
||||
if (prefix === '-webkit- old') {
|
||||
let changes = this.oldWebkit(node)
|
||||
if (!changes) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
node.nodes = this.convertDirection(node.nodes)
|
||||
node.value = prefix + node.value
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
p === 'list-style' ||
|
||||
p === 'list-style-image' ||
|
||||
p === 'content'
|
||||
) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
return ast.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get div token from exists parameters
|
||||
* Replace first token
|
||||
*/
|
||||
cloneDiv(params) {
|
||||
for (let i of params) {
|
||||
if (i.type === 'div' && i.value === ',') {
|
||||
return i
|
||||
replaceFirst(params, ...words) {
|
||||
let prefix = words.map(i => {
|
||||
if (i === ' ') {
|
||||
return { type: 'space', value: i }
|
||||
}
|
||||
}
|
||||
return { after: ' ', type: 'div', value: ',' }
|
||||
return { type: 'word', value: i }
|
||||
})
|
||||
return prefix.concat(params.slice(1))
|
||||
}
|
||||
|
||||
/**
|
||||
* Change colors syntax to old webkit
|
||||
* Convert angle unit to deg
|
||||
*/
|
||||
colorStops(params) {
|
||||
let result = []
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
let pos
|
||||
let param = params[i]
|
||||
let item
|
||||
if (i === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
let color = parser.stringify(param[0])
|
||||
if (param[1] && param[1].type === 'word') {
|
||||
pos = param[1].value
|
||||
} else if (param[2] && param[2].type === 'word') {
|
||||
pos = param[2].value
|
||||
}
|
||||
|
||||
let stop
|
||||
if (i === 1 && (!pos || pos === '0%')) {
|
||||
stop = `from(${color})`
|
||||
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
|
||||
stop = `to(${color})`
|
||||
} else if (pos) {
|
||||
stop = `color-stop(${pos}, ${color})`
|
||||
} else {
|
||||
stop = `color-stop(${color})`
|
||||
}
|
||||
|
||||
let div = param[param.length - 1]
|
||||
params[i] = [{ type: 'word', value: stop }]
|
||||
if (div.type === 'div' && div.value === ',') {
|
||||
item = params[i].push(div)
|
||||
}
|
||||
result.push(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Change new direction to old
|
||||
*/
|
||||
convertDirection(params) {
|
||||
if (params.length > 0) {
|
||||
if (params[0].value === 'to') {
|
||||
this.fixDirection(params)
|
||||
} else if (params[0].value.includes('deg')) {
|
||||
this.fixAngle(params)
|
||||
} else if (this.isRadial(params)) {
|
||||
this.fixRadial(params)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Add 90 degrees
|
||||
*/
|
||||
fixAngle(params) {
|
||||
let first = params[0].value
|
||||
first = parseFloat(first)
|
||||
first = Math.abs(450 - first) % 360
|
||||
first = this.roundFloat(first, 3)
|
||||
params[0].value = `${first}deg`
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace `to top left` to `bottom right`
|
||||
*/
|
||||
fixDirection(params) {
|
||||
params.splice(0, 2)
|
||||
|
||||
for (let param of params) {
|
||||
if (param.type === 'div') {
|
||||
break
|
||||
}
|
||||
if (param.type === 'word') {
|
||||
param.value = this.revertDirection(param.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix radial direction syntax
|
||||
*/
|
||||
fixRadial(params) {
|
||||
let first = []
|
||||
let second = []
|
||||
let a, b, c, i, next
|
||||
|
||||
for (i = 0; i < params.length - 2; i++) {
|
||||
a = params[i]
|
||||
b = params[i + 1]
|
||||
c = params[i + 2]
|
||||
if (a.type === 'space' && b.value === 'at' && c.type === 'space') {
|
||||
next = i + 3
|
||||
break
|
||||
} else {
|
||||
first.push(a)
|
||||
}
|
||||
}
|
||||
|
||||
let div
|
||||
for (i = next; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
div = params[i]
|
||||
break
|
||||
} else {
|
||||
second.push(params[i])
|
||||
}
|
||||
}
|
||||
|
||||
params.splice(0, i, ...second, div, ...first)
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for at word
|
||||
*/
|
||||
isRadial(params) {
|
||||
let state = 'before'
|
||||
for (let param of params) {
|
||||
if (state === 'before' && param.type === 'space') {
|
||||
state = 'at'
|
||||
} else if (state === 'at' && param.value === 'at') {
|
||||
state = 'after'
|
||||
} else if (state === 'after' && param.type === 'space') {
|
||||
return true
|
||||
} else if (param.type === 'div') {
|
||||
break
|
||||
} else {
|
||||
state = 'before'
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace old direction to new
|
||||
*/
|
||||
newDirection(params) {
|
||||
if (params[0].value === 'to') {
|
||||
return params
|
||||
}
|
||||
IS_DIRECTION.lastIndex = 0 // reset search index of global regexp
|
||||
if (!IS_DIRECTION.test(params[0].value)) {
|
||||
return params
|
||||
}
|
||||
|
||||
params.unshift(
|
||||
{
|
||||
type: 'word',
|
||||
value: 'to'
|
||||
},
|
||||
{
|
||||
type: 'space',
|
||||
value: ' '
|
||||
}
|
||||
)
|
||||
|
||||
for (let i = 2; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
break
|
||||
}
|
||||
if (params[i].type === 'word') {
|
||||
params[i].value = this.revertDirection(params[i].value)
|
||||
}
|
||||
}
|
||||
|
||||
return params
|
||||
normalizeUnit(str, full) {
|
||||
let num = parseFloat(str)
|
||||
let deg = (num / full) * 360
|
||||
return `${deg}deg`
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,66 +95,146 @@ class Gradient extends Value {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert angle unit to deg
|
||||
* Replace old direction to new
|
||||
*/
|
||||
normalizeUnit(str, full) {
|
||||
let num = parseFloat(str)
|
||||
let deg = (num / full) * 360
|
||||
return `${deg}deg`
|
||||
newDirection(params) {
|
||||
if (params[0].value === 'to') {
|
||||
return params
|
||||
}
|
||||
IS_DIRECTION.lastIndex = 0 // reset search index of global regexp
|
||||
if (!IS_DIRECTION.test(params[0].value)) {
|
||||
return params
|
||||
}
|
||||
|
||||
params.unshift(
|
||||
{
|
||||
type: 'word',
|
||||
value: 'to'
|
||||
},
|
||||
{
|
||||
type: 'space',
|
||||
value: ' '
|
||||
}
|
||||
)
|
||||
|
||||
for (let i = 2; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
break
|
||||
}
|
||||
if (params[i].type === 'word') {
|
||||
params[i].value = this.revertDirection(params[i].value)
|
||||
}
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove old WebKit gradient too
|
||||
* Look for at word
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
let type
|
||||
if (this.name === 'linear-gradient') {
|
||||
type = 'linear'
|
||||
} else if (this.name === 'repeating-linear-gradient') {
|
||||
type = 'repeating-linear'
|
||||
} else if (this.name === 'repeating-radial-gradient') {
|
||||
type = 'repeating-radial'
|
||||
isRadial(params) {
|
||||
let state = 'before'
|
||||
for (let param of params) {
|
||||
if (state === 'before' && param.type === 'space') {
|
||||
state = 'at'
|
||||
} else if (state === 'at' && param.value === 'at') {
|
||||
state = 'after'
|
||||
} else if (state === 'after' && param.type === 'space') {
|
||||
return true
|
||||
} else if (param.type === 'div') {
|
||||
break
|
||||
} else {
|
||||
type = 'radial'
|
||||
state = 'before'
|
||||
}
|
||||
let string = '-gradient'
|
||||
let regexp = utils.regexp(
|
||||
`-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
|
||||
false
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return new OldValue(this.name, prefix + this.name, string, regexp)
|
||||
} else {
|
||||
return super.old(prefix)
|
||||
/**
|
||||
* Change new direction to old
|
||||
*/
|
||||
convertDirection(params) {
|
||||
if (params.length > 0) {
|
||||
if (params[0].value === 'to') {
|
||||
this.fixDirection(params)
|
||||
} else if (params[0].value.includes('deg')) {
|
||||
this.fixAngle(params)
|
||||
} else if (this.isRadial(params)) {
|
||||
this.fixRadial(params)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace `to top left` to `bottom right`
|
||||
*/
|
||||
fixDirection(params) {
|
||||
params.splice(0, 2)
|
||||
|
||||
for (let param of params) {
|
||||
if (param.type === 'div') {
|
||||
break
|
||||
}
|
||||
if (param.type === 'word') {
|
||||
param.value = this.revertDirection(param.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change direction syntax to old webkit
|
||||
* Add 90 degrees
|
||||
*/
|
||||
oldDirection(params) {
|
||||
let div = this.cloneDiv(params[0])
|
||||
fixAngle(params) {
|
||||
let first = params[0].value
|
||||
first = parseFloat(first)
|
||||
first = Math.abs(450 - first) % 360
|
||||
first = this.roundFloat(first, 3)
|
||||
params[0].value = `${first}deg`
|
||||
}
|
||||
|
||||
if (params[0][0].value !== 'to') {
|
||||
return params.unshift([
|
||||
{ type: 'word', value: Gradient.oldDirections.bottom },
|
||||
div
|
||||
])
|
||||
} else {
|
||||
let words = []
|
||||
for (let node of params[0].slice(2)) {
|
||||
if (node.type === 'word') {
|
||||
words.push(node.value.toLowerCase())
|
||||
}
|
||||
/**
|
||||
* Fix radial direction syntax
|
||||
*/
|
||||
fixRadial(params) {
|
||||
let first = []
|
||||
let second = []
|
||||
let a, b, c, i, next
|
||||
|
||||
for (i = 0; i < params.length - 2; i++) {
|
||||
a = params[i]
|
||||
b = params[i + 1]
|
||||
c = params[i + 2]
|
||||
if (a.type === 'space' && b.value === 'at' && c.type === 'space') {
|
||||
next = i + 3
|
||||
break
|
||||
} else {
|
||||
first.push(a)
|
||||
}
|
||||
|
||||
words = words.join(' ')
|
||||
let old = Gradient.oldDirections[words] || words
|
||||
|
||||
params[0] = [{ type: 'word', value: old }, div]
|
||||
return params[0]
|
||||
}
|
||||
|
||||
let div
|
||||
for (i = next; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
div = params[i]
|
||||
break
|
||||
} else {
|
||||
second.push(params[i])
|
||||
}
|
||||
}
|
||||
|
||||
params.splice(0, i, ...second, div, ...first)
|
||||
}
|
||||
|
||||
revertDirection(word) {
|
||||
return Gradient.directions[word.toLowerCase()] || word
|
||||
}
|
||||
|
||||
/**
|
||||
* Round float and save digits under dot
|
||||
*/
|
||||
roundFloat(float, digits) {
|
||||
return parseFloat(float.toFixed(digits))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,51 +284,133 @@ class Gradient extends Value {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change degrees for webkit prefix
|
||||
* Change direction syntax to old webkit
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
let ast = parser(string)
|
||||
for (let node of ast.nodes) {
|
||||
let gradientName = this.name // gradient name
|
||||
if (node.type === 'function' && node.value === gradientName) {
|
||||
node.nodes = this.newDirection(node.nodes)
|
||||
node.nodes = this.normalize(node.nodes, gradientName)
|
||||
if (prefix === '-webkit- old') {
|
||||
let changes = this.oldWebkit(node)
|
||||
if (!changes) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
node.nodes = this.convertDirection(node.nodes)
|
||||
node.value = prefix + node.value
|
||||
oldDirection(params) {
|
||||
let div = this.cloneDiv(params[0])
|
||||
|
||||
if (params[0][0].value !== 'to') {
|
||||
return params.unshift([
|
||||
{ type: 'word', value: Gradient.oldDirections.bottom },
|
||||
div
|
||||
])
|
||||
} else {
|
||||
let words = []
|
||||
for (let node of params[0].slice(2)) {
|
||||
if (node.type === 'word') {
|
||||
words.push(node.value.toLowerCase())
|
||||
}
|
||||
}
|
||||
|
||||
words = words.join(' ')
|
||||
let old = Gradient.oldDirections[words] || words
|
||||
|
||||
params[0] = [{ type: 'word', value: old }, div]
|
||||
return params[0]
|
||||
}
|
||||
return ast.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace first token
|
||||
* Get div token from exists parameters
|
||||
*/
|
||||
replaceFirst(params, ...words) {
|
||||
let prefix = words.map(i => {
|
||||
if (i === ' ') {
|
||||
return { type: 'space', value: i }
|
||||
cloneDiv(params) {
|
||||
for (let i of params) {
|
||||
if (i.type === 'div' && i.value === ',') {
|
||||
return i
|
||||
}
|
||||
return { type: 'word', value: i }
|
||||
})
|
||||
return prefix.concat(params.slice(1))
|
||||
}
|
||||
|
||||
revertDirection(word) {
|
||||
return Gradient.directions[word.toLowerCase()] || word
|
||||
}
|
||||
return { type: 'div', value: ',', after: ' ' }
|
||||
}
|
||||
|
||||
/**
|
||||
* Round float and save digits under dot
|
||||
* Change colors syntax to old webkit
|
||||
*/
|
||||
roundFloat(float, digits) {
|
||||
return parseFloat(float.toFixed(digits))
|
||||
colorStops(params) {
|
||||
let result = []
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
let pos
|
||||
let param = params[i]
|
||||
let item
|
||||
if (i === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
let color = parser.stringify(param[0])
|
||||
if (param[1] && param[1].type === 'word') {
|
||||
pos = param[1].value
|
||||
} else if (param[2] && param[2].type === 'word') {
|
||||
pos = param[2].value
|
||||
}
|
||||
|
||||
let stop
|
||||
if (i === 1 && (!pos || pos === '0%')) {
|
||||
stop = `from(${color})`
|
||||
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
|
||||
stop = `to(${color})`
|
||||
} else if (pos) {
|
||||
stop = `color-stop(${pos}, ${color})`
|
||||
} else {
|
||||
stop = `color-stop(${color})`
|
||||
}
|
||||
|
||||
let div = param[param.length - 1]
|
||||
params[i] = [{ type: 'word', value: stop }]
|
||||
if (div.type === 'div' && div.value === ',') {
|
||||
item = params[i].push(div)
|
||||
}
|
||||
result.push(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove old WebKit gradient too
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
let type
|
||||
if (this.name === 'linear-gradient') {
|
||||
type = 'linear'
|
||||
} else if (this.name === 'repeating-linear-gradient') {
|
||||
type = 'repeating-linear'
|
||||
} else if (this.name === 'repeating-radial-gradient') {
|
||||
type = 'repeating-radial'
|
||||
} else {
|
||||
type = 'radial'
|
||||
}
|
||||
let string = '-gradient'
|
||||
let regexp = utils.regexp(
|
||||
`-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
|
||||
false
|
||||
)
|
||||
|
||||
return new OldValue(this.name, prefix + this.name, string, regexp)
|
||||
} else {
|
||||
return super.old(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not add non-webkit prefixes for list-style and object
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
let p = decl.prop
|
||||
if (p.includes('mask')) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else if (
|
||||
p === 'list-style' ||
|
||||
p === 'list-style-image' ||
|
||||
p === 'content'
|
||||
) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,27 +422,27 @@ Gradient.names = [
|
||||
]
|
||||
|
||||
Gradient.directions = {
|
||||
bottom: 'top',
|
||||
top: 'bottom', // default value
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
top: 'bottom' // default value
|
||||
bottom: 'top',
|
||||
right: 'left'
|
||||
}
|
||||
|
||||
// Direction to replace
|
||||
Gradient.oldDirections = {
|
||||
'bottom': 'left top, left bottom',
|
||||
'bottom left': 'right top, left bottom',
|
||||
'bottom right': 'left top, right bottom',
|
||||
'left': 'right top, left top',
|
||||
|
||||
'left bottom': 'right top, left bottom',
|
||||
'left top': 'right bottom, left top',
|
||||
'right': 'left top, right top',
|
||||
'right bottom': 'left top, right bottom',
|
||||
'right top': 'left bottom, right top',
|
||||
'top': 'left bottom, left top',
|
||||
'left': 'right top, left top',
|
||||
'bottom': 'left top, left bottom',
|
||||
'right': 'left top, right top',
|
||||
|
||||
'top right': 'left bottom, right top',
|
||||
'top left': 'right bottom, left top',
|
||||
'top right': 'left bottom, right top'
|
||||
'right top': 'left bottom, right top',
|
||||
'right bottom': 'left top, right bottom',
|
||||
'bottom right': 'left top, right bottom',
|
||||
'bottom left': 'right top, left bottom',
|
||||
'left top': 'right bottom, left top',
|
||||
'left bottom': 'right top, left bottom'
|
||||
}
|
||||
|
||||
module.exports = Gradient
|
||||
|
||||
14
node_modules/autoprefixer/lib/hacks/grid-column-align.js
generated
vendored
14
node_modules/autoprefixer/lib/hacks/grid-column-align.js
generated
vendored
@@ -8,19 +8,19 @@ class GridColumnAlign extends Declaration {
|
||||
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize() {
|
||||
return 'justify-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + 'grid-column-align'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize() {
|
||||
return 'justify-self'
|
||||
}
|
||||
}
|
||||
|
||||
GridColumnAlign.names = ['grid-column-align']
|
||||
|
||||
14
node_modules/autoprefixer/lib/hacks/grid-row-align.js
generated
vendored
14
node_modules/autoprefixer/lib/hacks/grid-row-align.js
generated
vendored
@@ -8,19 +8,19 @@ class GridRowAlign extends Declaration {
|
||||
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-self'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + 'grid-row-align'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize() {
|
||||
return 'align-self'
|
||||
}
|
||||
}
|
||||
|
||||
GridRowAlign.names = ['grid-row-align']
|
||||
|
||||
48
node_modules/autoprefixer/lib/hacks/grid-rows-columns.js
generated
vendored
48
node_modules/autoprefixer/lib/hacks/grid-rows-columns.js
generated
vendored
@@ -1,14 +1,31 @@
|
||||
let Declaration = require('../declaration')
|
||||
let Processor = require('../processor')
|
||||
let {
|
||||
prefixTrackProp,
|
||||
prefixTrackValue,
|
||||
autoplaceGridItems,
|
||||
getGridGap,
|
||||
inheritGridGap,
|
||||
prefixTrackProp,
|
||||
prefixTrackValue
|
||||
inheritGridGap
|
||||
} = require('./grid-utils')
|
||||
let Processor = require('../processor')
|
||||
|
||||
class GridRowsColumns extends Declaration {
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-ms-') {
|
||||
return prefixTrackProp({ prop, prefix })
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1')
|
||||
}
|
||||
|
||||
insert(decl, prefix, prefixes, result) {
|
||||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
||||
|
||||
@@ -39,15 +56,15 @@ class GridRowsColumns extends Declaration {
|
||||
}
|
||||
|
||||
let prefixValue = prefixTrackValue({
|
||||
gap: gapValue,
|
||||
value
|
||||
value,
|
||||
gap: gapValue
|
||||
})
|
||||
|
||||
/**
|
||||
* Insert prefixes
|
||||
*/
|
||||
decl.cloneBefore({
|
||||
prop: prefixTrackProp({ prefix, prop }),
|
||||
prop: prefixTrackProp({ prop, prefix }),
|
||||
value: prefixValue
|
||||
})
|
||||
|
||||
@@ -96,23 +113,6 @@ class GridRowsColumns extends Declaration {
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Change IE property back
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1')
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
if (prefix === '-ms-') {
|
||||
return prefixTrackProp({ prefix, prop })
|
||||
}
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
GridRowsColumns.names = [
|
||||
|
||||
24
node_modules/autoprefixer/lib/hacks/grid-template-areas.js
generated
vendored
24
node_modules/autoprefixer/lib/hacks/grid-template-areas.js
generated
vendored
@@ -1,12 +1,12 @@
|
||||
let Declaration = require('../declaration')
|
||||
let {
|
||||
getGridGap,
|
||||
inheritGridGap,
|
||||
parseGridAreas,
|
||||
warnMissedAreas,
|
||||
prefixTrackProp,
|
||||
prefixTrackValue,
|
||||
getGridGap,
|
||||
warnGridGap,
|
||||
warnMissedAreas
|
||||
inheritGridGap
|
||||
} = require('./grid-utils')
|
||||
|
||||
function getGridRows(tpl) {
|
||||
@@ -39,8 +39,8 @@ class GridTemplateAreas extends Declaration {
|
||||
hasRows = true
|
||||
let { prop, value } = trackDecl
|
||||
trackDecl.cloneBefore({
|
||||
prop: prefixTrackProp({ prefix, prop }),
|
||||
value: prefixTrackValue({ gap: gap.row, value })
|
||||
prop: prefixTrackProp({ prop, prefix }),
|
||||
value: prefixTrackValue({ value, gap: gap.row })
|
||||
})
|
||||
} else {
|
||||
hasColumns = true
|
||||
@@ -52,25 +52,25 @@ class GridTemplateAreas extends Declaration {
|
||||
if (hasColumns && !hasRows && gap.row && gridRows.length > 1) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-rows',
|
||||
raws: {},
|
||||
value: prefixTrackValue({
|
||||
gap: gap.row,
|
||||
value: `repeat(${gridRows.length}, auto)`
|
||||
})
|
||||
value: `repeat(${gridRows.length}, auto)`,
|
||||
gap: gap.row
|
||||
}),
|
||||
raws: {}
|
||||
})
|
||||
}
|
||||
|
||||
// warnings
|
||||
warnGridGap({
|
||||
decl,
|
||||
gap,
|
||||
hasColumns,
|
||||
decl,
|
||||
result
|
||||
})
|
||||
|
||||
let areas = parseGridAreas({
|
||||
gap,
|
||||
rows: gridRows
|
||||
rows: gridRows,
|
||||
gap
|
||||
})
|
||||
|
||||
warnMissedAreas(areas, decl, result)
|
||||
|
||||
18
node_modules/autoprefixer/lib/hacks/grid-template.js
generated
vendored
18
node_modules/autoprefixer/lib/hacks/grid-template.js
generated
vendored
@@ -1,10 +1,10 @@
|
||||
let Declaration = require('../declaration')
|
||||
let {
|
||||
getGridGap,
|
||||
inheritGridGap,
|
||||
parseTemplate,
|
||||
warnMissedAreas,
|
||||
getGridGap,
|
||||
warnGridGap,
|
||||
warnMissedAreas
|
||||
inheritGridGap
|
||||
} = require('./grid-utils')
|
||||
|
||||
class GridTemplate extends Declaration {
|
||||
@@ -26,7 +26,7 @@ class GridTemplate extends Declaration {
|
||||
*/
|
||||
let inheritedGap = inheritGridGap(decl, gap)
|
||||
|
||||
let { areas, columns, rows } = parseTemplate({
|
||||
let { rows, columns, areas } = parseTemplate({
|
||||
decl,
|
||||
gap: inheritedGap || gap
|
||||
})
|
||||
@@ -36,9 +36,9 @@ class GridTemplate extends Declaration {
|
||||
let hasColumns = Boolean(columns)
|
||||
|
||||
warnGridGap({
|
||||
decl,
|
||||
gap,
|
||||
hasColumns,
|
||||
decl,
|
||||
result
|
||||
})
|
||||
|
||||
@@ -47,16 +47,16 @@ class GridTemplate extends Declaration {
|
||||
if ((hasRows && hasColumns) || hasAreas) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-rows',
|
||||
raws: {},
|
||||
value: rows
|
||||
value: rows,
|
||||
raws: {}
|
||||
})
|
||||
}
|
||||
|
||||
if (hasColumns) {
|
||||
decl.cloneBefore({
|
||||
prop: '-ms-grid-columns',
|
||||
raws: {},
|
||||
value: columns
|
||||
value: columns,
|
||||
raws: {}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
52
node_modules/autoprefixer/lib/hacks/grid-utils.js
generated
vendored
52
node_modules/autoprefixer/lib/hacks/grid-utils.js
generated
vendored
@@ -90,7 +90,7 @@ function insertDecl(decl, prop, value) {
|
||||
|
||||
exports.prefixTrackProp = prefixTrackProp
|
||||
|
||||
function prefixTrackProp({ prefix, prop }) {
|
||||
function prefixTrackProp({ prop, prefix }) {
|
||||
return prefix + prop.replace('template-', '')
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ function transformRepeat({ nodes }, { gap }) {
|
||||
return result
|
||||
},
|
||||
{
|
||||
count: [],
|
||||
key: 'count',
|
||||
size: []
|
||||
size: [],
|
||||
count: []
|
||||
}
|
||||
)
|
||||
|
||||
@@ -132,7 +132,7 @@ function transformRepeat({ nodes }, { gap }) {
|
||||
|
||||
exports.prefixTrackValue = prefixTrackValue
|
||||
|
||||
function prefixTrackValue({ gap, value }) {
|
||||
function prefixTrackValue({ value, gap }) {
|
||||
let result = parser(value).nodes.reduce((nodes, node) => {
|
||||
if (node.type === 'function' && node.value === 'repeat') {
|
||||
return nodes.concat({
|
||||
@@ -164,7 +164,7 @@ function prefixTrackValue({ gap, value }) {
|
||||
let DOTS = /^\.+$/
|
||||
|
||||
function track(start, end) {
|
||||
return { end, span: end - start, start }
|
||||
return { start, end, span: end - start }
|
||||
}
|
||||
|
||||
function getColumns(line) {
|
||||
@@ -173,7 +173,7 @@ function getColumns(line) {
|
||||
|
||||
exports.parseGridAreas = parseGridAreas
|
||||
|
||||
function parseGridAreas({ gap, rows }) {
|
||||
function parseGridAreas({ rows, gap }) {
|
||||
return rows.reduce((areas, line, rowIndex) => {
|
||||
if (gap.row) rowIndex *= 2
|
||||
|
||||
@@ -248,25 +248,25 @@ function parseTemplate({ decl, gap }) {
|
||||
return result
|
||||
},
|
||||
{
|
||||
areas: [],
|
||||
columns: [],
|
||||
key: 'rows',
|
||||
rows: []
|
||||
columns: [],
|
||||
rows: [],
|
||||
areas: []
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
areas: parseGridAreas({
|
||||
gap,
|
||||
rows: gridTemplate.areas
|
||||
rows: gridTemplate.areas,
|
||||
gap
|
||||
}),
|
||||
columns: prefixTrackValue({
|
||||
gap: gap.column,
|
||||
value: gridTemplate.columns.join(' ')
|
||||
value: gridTemplate.columns.join(' '),
|
||||
gap: gap.column
|
||||
}),
|
||||
rows: prefixTrackValue({
|
||||
gap: gap.row,
|
||||
value: gridTemplate.rows.join(' ')
|
||||
value: gridTemplate.rows.join(' '),
|
||||
gap: gap.row
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -429,12 +429,12 @@ function parseGridTemplatesData(css) {
|
||||
|
||||
parsed[index].allAreas = uniq([...allAreas, ...areaNames])
|
||||
parsed[index].rules.push({
|
||||
areas,
|
||||
duplicateAreaNames,
|
||||
hasDuplicates: !hasNoDuplicates,
|
||||
node: rule,
|
||||
params: media.params,
|
||||
selectors: rule.selectors
|
||||
selectors: rule.selectors,
|
||||
node: rule,
|
||||
duplicateAreaNames,
|
||||
areas
|
||||
})
|
||||
} else {
|
||||
// index is NOT found, push the new item to the parsed array
|
||||
@@ -443,13 +443,13 @@ function parseGridTemplatesData(css) {
|
||||
areasCount: 0,
|
||||
rules: [
|
||||
{
|
||||
areas,
|
||||
duplicateAreaNames: [],
|
||||
duplicateRules: [],
|
||||
hasDuplicates: false,
|
||||
node: rule,
|
||||
duplicateRules: [],
|
||||
params: media.params,
|
||||
selectors: rule.selectors
|
||||
selectors: rule.selectors,
|
||||
node: rule,
|
||||
duplicateAreaNames: [],
|
||||
areas
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -993,7 +993,7 @@ function inheritGridGap(decl, gap) {
|
||||
|
||||
exports.warnGridGap = warnGridGap
|
||||
|
||||
function warnGridGap({ decl, gap, hasColumns, result }) {
|
||||
function warnGridGap({ gap, hasColumns, decl, result }) {
|
||||
let hasBothGaps = gap.row && gap.column
|
||||
if (!hasColumns && (hasBothGaps || (gap.column && !gap.row))) {
|
||||
delete gap.column
|
||||
@@ -1079,7 +1079,7 @@ function autoplaceGridItems(decl, result, gap, autoflowValue = 'row') {
|
||||
).join(' ')
|
||||
})
|
||||
|
||||
let areas = parseGridAreas({ gap, rows: filledRows })
|
||||
let areas = parseGridAreas({ rows: filledRows, gap })
|
||||
let keys = Object.keys(areas)
|
||||
let items = keys.map(i => areas[i])
|
||||
|
||||
|
||||
28
node_modules/autoprefixer/lib/hacks/image-rendering.js
generated
vendored
28
node_modules/autoprefixer/lib/hacks/image-rendering.js
generated
vendored
@@ -8,13 +8,6 @@ class ImageRendering extends Declaration {
|
||||
return decl.value === 'pixelated'
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'image-rendering'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
@@ -25,13 +18,6 @@ class ImageRendering extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Warn on old value
|
||||
*/
|
||||
process(node, result) {
|
||||
return super.process(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property and value for IE
|
||||
*/
|
||||
@@ -41,6 +27,20 @@ class ImageRendering extends Declaration {
|
||||
decl.value = 'nearest-neighbor'
|
||||
return decl
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'image-rendering'
|
||||
}
|
||||
|
||||
/**
|
||||
* Warn on old value
|
||||
*/
|
||||
process(node, result) {
|
||||
return super.process(node, result)
|
||||
}
|
||||
}
|
||||
|
||||
ImageRendering.names = ['image-rendering', 'interpolation-mode']
|
||||
|
||||
14
node_modules/autoprefixer/lib/hacks/inline-logical.js
generated
vendored
14
node_modules/autoprefixer/lib/hacks/inline-logical.js
generated
vendored
@@ -1,19 +1,19 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class InlineLogical extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2')
|
||||
}
|
||||
|
||||
/**
|
||||
* Use old syntax for -moz- and -webkit-
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
return prefix + prop.replace('-inline', '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize(prop) {
|
||||
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2')
|
||||
}
|
||||
}
|
||||
|
||||
InlineLogical.names = [
|
||||
|
||||
34
node_modules/autoprefixer/lib/hacks/intrinsic.js
generated
vendored
34
node_modules/autoprefixer/lib/hacks/intrinsic.js
generated
vendored
@@ -6,11 +6,9 @@ function regexp(name) {
|
||||
}
|
||||
|
||||
class Intrinsic extends Value {
|
||||
add(decl, prefix) {
|
||||
if (decl.prop.includes('grid') && prefix !== '-webkit-') {
|
||||
return undefined
|
||||
}
|
||||
return super.add(decl, prefix)
|
||||
regexp() {
|
||||
if (!this.regexpCache) this.regexpCache = regexp(this.name)
|
||||
return this.regexpCache
|
||||
}
|
||||
|
||||
isStretch() {
|
||||
@@ -21,6 +19,16 @@ class Intrinsic extends Value {
|
||||
)
|
||||
}
|
||||
|
||||
replace(string, prefix) {
|
||||
if (prefix === '-moz-' && this.isStretch()) {
|
||||
return string.replace(this.regexp(), '$1-moz-available$3')
|
||||
}
|
||||
if (prefix === '-webkit-' && this.isStretch()) {
|
||||
return string.replace(this.regexp(), '$1-webkit-fill-available$3')
|
||||
}
|
||||
return super.replace(string, prefix)
|
||||
}
|
||||
|
||||
old(prefix) {
|
||||
let prefixed = prefix + this.name
|
||||
if (this.isStretch()) {
|
||||
@@ -33,19 +41,11 @@ class Intrinsic extends Value {
|
||||
return new OldValue(this.name, prefixed, prefixed, regexp(prefixed))
|
||||
}
|
||||
|
||||
regexp() {
|
||||
if (!this.regexpCache) this.regexpCache = regexp(this.name)
|
||||
return this.regexpCache
|
||||
}
|
||||
|
||||
replace(string, prefix) {
|
||||
if (prefix === '-moz-' && this.isStretch()) {
|
||||
return string.replace(this.regexp(), '$1-moz-available$3')
|
||||
add(decl, prefix) {
|
||||
if (decl.prop.includes('grid') && prefix !== '-webkit-') {
|
||||
return undefined
|
||||
}
|
||||
if (prefix === '-webkit-' && this.isStretch()) {
|
||||
return string.replace(this.regexp(), '$1-webkit-fill-available$3')
|
||||
}
|
||||
return super.replace(string, prefix)
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
node_modules/autoprefixer/lib/hacks/justify-content.js
generated
vendored
20
node_modules/autoprefixer/lib/hacks/justify-content.js
generated
vendored
@@ -1,14 +1,7 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class JustifyContent extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'justify-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 and 2012 specs
|
||||
*/
|
||||
@@ -24,6 +17,13 @@ class JustifyContent extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'justify-content'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for 2009 and 2012 specs
|
||||
*/
|
||||
@@ -47,8 +47,8 @@ JustifyContent.names = ['justify-content', 'flex-pack', 'box-pack']
|
||||
JustifyContent.oldValues = {
|
||||
'flex-end': 'end',
|
||||
'flex-start': 'start',
|
||||
'space-around': 'distribute',
|
||||
'space-between': 'justify'
|
||||
'space-between': 'justify',
|
||||
'space-around': 'distribute'
|
||||
}
|
||||
|
||||
module.exports = JustifyContent
|
||||
|
||||
4
node_modules/autoprefixer/lib/hacks/mask-composite.js
generated
vendored
4
node_modules/autoprefixer/lib/hacks/mask-composite.js
generated
vendored
@@ -73,9 +73,9 @@ MaskComposite.names = ['mask', 'mask-composite']
|
||||
|
||||
MaskComposite.oldValues = {
|
||||
add: 'source-over',
|
||||
exclude: 'xor',
|
||||
subtract: 'source-out',
|
||||
intersect: 'source-in',
|
||||
subtract: 'source-out'
|
||||
exclude: 'xor'
|
||||
}
|
||||
|
||||
MaskComposite.regexp = new RegExp(
|
||||
|
||||
16
node_modules/autoprefixer/lib/hacks/order.js
generated
vendored
16
node_modules/autoprefixer/lib/hacks/order.js
generated
vendored
@@ -1,14 +1,7 @@
|
||||
let Declaration = require('../declaration')
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Order extends Declaration {
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'order'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for 2009 and 2012 specs
|
||||
*/
|
||||
@@ -24,6 +17,13 @@ class Order extends Declaration {
|
||||
return super.prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by final spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'order'
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix value for 2009 spec
|
||||
*/
|
||||
|
||||
14
node_modules/autoprefixer/lib/hacks/overscroll-behavior.js
generated
vendored
14
node_modules/autoprefixer/lib/hacks/overscroll-behavior.js
generated
vendored
@@ -1,13 +1,6 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class OverscrollBehavior extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'overscroll-behavior'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for IE
|
||||
*/
|
||||
@@ -15,6 +8,13 @@ class OverscrollBehavior extends Declaration {
|
||||
return prefix + 'scroll-chaining'
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'overscroll-behavior'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value for IE
|
||||
*/
|
||||
|
||||
26
node_modules/autoprefixer/lib/hacks/pixelated.js
generated
vendored
26
node_modules/autoprefixer/lib/hacks/pixelated.js
generated
vendored
@@ -2,19 +2,6 @@ let OldValue = require('../old-value')
|
||||
let Value = require('../value')
|
||||
|
||||
class Pixelated extends Value {
|
||||
/**
|
||||
* Different name for WebKit and Firefox
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return new OldValue(this.name, '-webkit-optimize-contrast')
|
||||
}
|
||||
if (prefix === '-moz-') {
|
||||
return new OldValue(this.name, '-moz-crisp-edges')
|
||||
}
|
||||
return super.old(prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Use non-standard name for WebKit and Firefox
|
||||
*/
|
||||
@@ -27,6 +14,19 @@ class Pixelated extends Value {
|
||||
}
|
||||
return super.replace(string, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Different name for WebKit and Firefox
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return new OldValue(this.name, '-webkit-optimize-contrast')
|
||||
}
|
||||
if (prefix === '-moz-') {
|
||||
return new OldValue(this.name, '-moz-crisp-edges')
|
||||
}
|
||||
return super.old(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Pixelated.names = ['pixelated']
|
||||
|
||||
4
node_modules/autoprefixer/lib/hacks/placeholder-shown.js
generated
vendored
4
node_modules/autoprefixer/lib/hacks/placeholder-shown.js
generated
vendored
@@ -5,9 +5,7 @@ class PlaceholderShown extends Selector {
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
if (prefix === '-moz-') {
|
||||
return ':-moz-placeholder'
|
||||
} else if (prefix === '-ms-') {
|
||||
if (prefix === '-ms-') {
|
||||
return ':-ms-input-placeholder'
|
||||
}
|
||||
return `:${prefix}placeholder-shown`
|
||||
|
||||
14
node_modules/autoprefixer/lib/hacks/print-color-adjust.js
generated
vendored
14
node_modules/autoprefixer/lib/hacks/print-color-adjust.js
generated
vendored
@@ -1,13 +1,6 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class PrintColorAdjust extends Declaration {
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'print-color-adjust'
|
||||
}
|
||||
|
||||
/**
|
||||
* Change property name for WebKit-based browsers
|
||||
*/
|
||||
@@ -18,6 +11,13 @@ class PrintColorAdjust extends Declaration {
|
||||
return prefix + 'print-color-adjust'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return property name by spec
|
||||
*/
|
||||
normalize() {
|
||||
return 'print-color-adjust'
|
||||
}
|
||||
}
|
||||
|
||||
PrintColorAdjust.names = ['print-color-adjust', 'color-adjust']
|
||||
|
||||
50
node_modules/autoprefixer/lib/hacks/transform-decl.js
generated
vendored
50
node_modules/autoprefixer/lib/hacks/transform-decl.js
generated
vendored
@@ -1,6 +1,20 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class TransformDecl extends Declaration {
|
||||
/**
|
||||
* Recursively check all parents for @keyframes
|
||||
*/
|
||||
keyframeParents(decl) {
|
||||
let { parent } = decl
|
||||
while (parent) {
|
||||
if (parent.type === 'atrule' && parent.name === 'keyframes') {
|
||||
return true
|
||||
}
|
||||
;({ parent } = parent)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Is transform contain 3D commands
|
||||
*/
|
||||
@@ -18,6 +32,17 @@ class TransformDecl extends Declaration {
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace rotateZ to rotate for IE 9
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl = super.set(decl, prefix)
|
||||
if (prefix === '-ms-') {
|
||||
decl.value = decl.value.replace(/rotatez/gi, 'rotate')
|
||||
}
|
||||
return decl
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't add prefix for IE in keyframes
|
||||
*/
|
||||
@@ -35,31 +60,6 @@ class TransformDecl extends Declaration {
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively check all parents for @keyframes
|
||||
*/
|
||||
keyframeParents(decl) {
|
||||
let { parent } = decl
|
||||
while (parent) {
|
||||
if (parent.type === 'atrule' && parent.name === 'keyframes') {
|
||||
return true
|
||||
}
|
||||
;({ parent } = parent)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace rotateZ to rotate for IE 9
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
decl = super.set(decl, prefix)
|
||||
if (prefix === '-ms-') {
|
||||
decl.value = decl.value.replace(/rotatez/gi, 'rotate')
|
||||
}
|
||||
return decl
|
||||
}
|
||||
}
|
||||
|
||||
TransformDecl.names = ['transform', 'transform-origin']
|
||||
|
||||
27
node_modules/autoprefixer/lib/hacks/user-select.js
generated
vendored
27
node_modules/autoprefixer/lib/hacks/user-select.js
generated
vendored
@@ -1,22 +1,6 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class UserSelect extends Declaration {
|
||||
/**
|
||||
* Avoid prefixing all in IE
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (decl.value === 'all' && prefix === '-ms-') {
|
||||
return undefined
|
||||
} else if (
|
||||
decl.value === 'contain' &&
|
||||
(prefix === '-moz-' || prefix === '-webkit-')
|
||||
) {
|
||||
return undefined
|
||||
} else {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change prefixed value for IE
|
||||
*/
|
||||
@@ -26,6 +10,17 @@ class UserSelect extends Declaration {
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid prefixing all in IE
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
if (decl.value === 'all' && prefix === '-ms-') {
|
||||
return undefined
|
||||
} else {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UserSelect.names = ['user-select']
|
||||
|
||||
8
node_modules/autoprefixer/lib/hacks/writing-mode.js
generated
vendored
8
node_modules/autoprefixer/lib/hacks/writing-mode.js
generated
vendored
@@ -29,13 +29,13 @@ WritingMode.names = ['writing-mode']
|
||||
WritingMode.msValues = {
|
||||
ltr: {
|
||||
'horizontal-tb': 'lr-tb',
|
||||
'vertical-lr': 'tb-lr',
|
||||
'vertical-rl': 'tb-rl'
|
||||
'vertical-rl': 'tb-rl',
|
||||
'vertical-lr': 'tb-lr'
|
||||
},
|
||||
rtl: {
|
||||
'horizontal-tb': 'rl-tb',
|
||||
'vertical-lr': 'bt-lr',
|
||||
'vertical-rl': 'bt-rl'
|
||||
'vertical-rl': 'bt-rl',
|
||||
'vertical-lr': 'bt-lr'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
node_modules/autoprefixer/lib/info.js
generated
vendored
12
node_modules/autoprefixer/lib/info.js
generated
vendored
@@ -5,17 +5,17 @@ function capitalize(str) {
|
||||
}
|
||||
|
||||
const NAMES = {
|
||||
and_chr: 'Chrome for Android',
|
||||
and_ff: 'Firefox for Android',
|
||||
and_qq: 'QQ Browser',
|
||||
and_uc: 'UC for Android',
|
||||
baidu: 'Baidu Browser',
|
||||
ie: 'IE',
|
||||
ie_mob: 'IE Mobile',
|
||||
ios_saf: 'iOS Safari',
|
||||
kaios: 'KaiOS Browser',
|
||||
op_mini: 'Opera Mini',
|
||||
op_mob: 'Opera Mobile',
|
||||
and_chr: 'Chrome for Android',
|
||||
and_ff: 'Firefox for Android',
|
||||
and_uc: 'UC for Android',
|
||||
and_qq: 'QQ Browser',
|
||||
kaios: 'KaiOS Browser',
|
||||
baidu: 'Baidu Browser',
|
||||
samsung: 'Samsung Internet'
|
||||
}
|
||||
|
||||
|
||||
32
node_modules/autoprefixer/lib/old-selector.js
generated
vendored
32
node_modules/autoprefixer/lib/old-selector.js
generated
vendored
@@ -12,22 +12,6 @@ class OldSelector {
|
||||
this.nameRegexp = selector.regexp()
|
||||
}
|
||||
|
||||
/**
|
||||
* Does rule contain an unnecessary prefixed selector
|
||||
*/
|
||||
check(rule) {
|
||||
if (!rule.selector.includes(this.prefixed)) {
|
||||
return false
|
||||
}
|
||||
if (!rule.selector.match(this.regexp)) {
|
||||
return false
|
||||
}
|
||||
if (this.isHack(rule)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Is rule a hack without unprefixed version bottom
|
||||
*/
|
||||
@@ -62,6 +46,22 @@ class OldSelector {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Does rule contain an unnecessary prefixed selector
|
||||
*/
|
||||
check(rule) {
|
||||
if (!rule.selector.includes(this.prefixed)) {
|
||||
return false
|
||||
}
|
||||
if (!rule.selector.match(this.regexp)) {
|
||||
return false
|
||||
}
|
||||
if (this.isHack(rule)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OldSelector
|
||||
|
||||
42
node_modules/autoprefixer/lib/prefixer.js
generated
vendored
42
node_modules/autoprefixer/lib/prefixer.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
let Browsers = require('./browsers')
|
||||
let utils = require('./utils')
|
||||
let vendor = require('./vendor')
|
||||
let utils = require('./utils')
|
||||
|
||||
/**
|
||||
* Recursively clone objects
|
||||
@@ -34,23 +34,6 @@ function clone(obj, parent) {
|
||||
}
|
||||
|
||||
class Prefixer {
|
||||
constructor(name, prefixes, all) {
|
||||
this.prefixes = prefixes
|
||||
this.name = name
|
||||
this.all = all
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone node and clean autprefixer custom caches
|
||||
*/
|
||||
static clone(node, overrides) {
|
||||
let cloned = clone(node)
|
||||
for (let name in overrides) {
|
||||
cloned[name] = overrides[name]
|
||||
}
|
||||
return cloned
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hack to selected names
|
||||
*/
|
||||
@@ -77,10 +60,20 @@ class Prefixer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for Prefixer.clone
|
||||
* Clone node and clean autprefixer custom caches
|
||||
*/
|
||||
clone(node, overrides) {
|
||||
return Prefixer.clone(node, overrides)
|
||||
static clone(node, overrides) {
|
||||
let cloned = clone(node)
|
||||
for (let name in overrides) {
|
||||
cloned[name] = overrides[name]
|
||||
}
|
||||
return cloned
|
||||
}
|
||||
|
||||
constructor(name, prefixes, all) {
|
||||
this.prefixes = prefixes
|
||||
this.name = name
|
||||
this.all = all
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,6 +132,13 @@ class Prefixer {
|
||||
|
||||
return added
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for Prefixer.clone
|
||||
*/
|
||||
clone(node, overrides) {
|
||||
return Prefixer.clone(node, overrides)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Prefixer
|
||||
|
||||
370
node_modules/autoprefixer/lib/prefixes.js
generated
vendored
370
node_modules/autoprefixer/lib/prefixes.js
generated
vendored
@@ -1,71 +1,71 @@
|
||||
let AtRule = require('./at-rule')
|
||||
let Browsers = require('./browsers')
|
||||
let vendor = require('./vendor')
|
||||
let Declaration = require('./declaration')
|
||||
let hackAlignContent = require('./hacks/align-content')
|
||||
let hackAlignItems = require('./hacks/align-items')
|
||||
let hackAlignSelf = require('./hacks/align-self')
|
||||
let Resolution = require('./resolution')
|
||||
let Transition = require('./transition')
|
||||
let Processor = require('./processor')
|
||||
let Supports = require('./supports')
|
||||
let Browsers = require('./browsers')
|
||||
let Selector = require('./selector')
|
||||
let AtRule = require('./at-rule')
|
||||
let Value = require('./value')
|
||||
let utils = require('./utils')
|
||||
let hackFullscreen = require('./hacks/fullscreen')
|
||||
let hackPlaceholder = require('./hacks/placeholder')
|
||||
let hackPlaceholderShown = require('./hacks/placeholder-shown')
|
||||
let hackFileSelectorButton = require('./hacks/file-selector-button')
|
||||
let hackFlex = require('./hacks/flex')
|
||||
let hackOrder = require('./hacks/order')
|
||||
let hackFilter = require('./hacks/filter')
|
||||
let hackGridEnd = require('./hacks/grid-end')
|
||||
let hackAnimation = require('./hacks/animation')
|
||||
let hackFlexFlow = require('./hacks/flex-flow')
|
||||
let hackFlexGrow = require('./hacks/flex-grow')
|
||||
let hackFlexWrap = require('./hacks/flex-wrap')
|
||||
let hackGridArea = require('./hacks/grid-area')
|
||||
let hackPlaceSelf = require('./hacks/place-self')
|
||||
let hackGridStart = require('./hacks/grid-start')
|
||||
let hackAlignSelf = require('./hacks/align-self')
|
||||
let hackAppearance = require('./hacks/appearance')
|
||||
let hackAutofill = require('./hacks/autofill')
|
||||
let hackFlexBasis = require('./hacks/flex-basis')
|
||||
let hackMaskBorder = require('./hacks/mask-border')
|
||||
let hackMaskComposite = require('./hacks/mask-composite')
|
||||
let hackAlignItems = require('./hacks/align-items')
|
||||
let hackUserSelect = require('./hacks/user-select')
|
||||
let hackFlexShrink = require('./hacks/flex-shrink')
|
||||
let hackBreakProps = require('./hacks/break-props')
|
||||
let hackWritingMode = require('./hacks/writing-mode')
|
||||
let hackBorderImage = require('./hacks/border-image')
|
||||
let hackAlignContent = require('./hacks/align-content')
|
||||
let hackBorderRadius = require('./hacks/border-radius')
|
||||
let hackBlockLogical = require('./hacks/block-logical')
|
||||
let hackGridTemplate = require('./hacks/grid-template')
|
||||
let hackInlineLogical = require('./hacks/inline-logical')
|
||||
let hackGridRowAlign = require('./hacks/grid-row-align')
|
||||
let hackTransformDecl = require('./hacks/transform-decl')
|
||||
let hackFlexDirection = require('./hacks/flex-direction')
|
||||
let hackImageRendering = require('./hacks/image-rendering')
|
||||
let hackBackdropFilter = require('./hacks/backdrop-filter')
|
||||
let hackBackgroundClip = require('./hacks/background-clip')
|
||||
let hackTextDecoration = require('./hacks/text-decoration')
|
||||
let hackJustifyContent = require('./hacks/justify-content')
|
||||
let hackBackgroundSize = require('./hacks/background-size')
|
||||
let hackBlockLogical = require('./hacks/block-logical')
|
||||
let hackBorderImage = require('./hacks/border-image')
|
||||
let hackBorderRadius = require('./hacks/border-radius')
|
||||
let hackBreakProps = require('./hacks/break-props')
|
||||
let hackGridRowColumn = require('./hacks/grid-row-column')
|
||||
let hackGridRowsColumns = require('./hacks/grid-rows-columns')
|
||||
let hackGridColumnAlign = require('./hacks/grid-column-align')
|
||||
let hackPrintColorAdjust = require('./hacks/print-color-adjust')
|
||||
let hackOverscrollBehavior = require('./hacks/overscroll-behavior')
|
||||
let hackGridTemplateAreas = require('./hacks/grid-template-areas')
|
||||
let hackTextEmphasisPosition = require('./hacks/text-emphasis-position')
|
||||
let hackTextDecorationSkipInk = require('./hacks/text-decoration-skip-ink')
|
||||
let hackGradient = require('./hacks/gradient')
|
||||
let hackIntrinsic = require('./hacks/intrinsic')
|
||||
let hackPixelated = require('./hacks/pixelated')
|
||||
let hackImageSet = require('./hacks/image-set')
|
||||
let hackCrossFade = require('./hacks/cross-fade')
|
||||
let hackDisplayFlex = require('./hacks/display-flex')
|
||||
let hackDisplayGrid = require('./hacks/display-grid')
|
||||
let hackFileSelectorButton = require('./hacks/file-selector-button')
|
||||
let hackFilter = require('./hacks/filter')
|
||||
let hackFilterValue = require('./hacks/filter-value')
|
||||
let hackFlex = require('./hacks/flex')
|
||||
let hackFlexBasis = require('./hacks/flex-basis')
|
||||
let hackFlexDirection = require('./hacks/flex-direction')
|
||||
let hackFlexFlow = require('./hacks/flex-flow')
|
||||
let hackFlexGrow = require('./hacks/flex-grow')
|
||||
let hackFlexShrink = require('./hacks/flex-shrink')
|
||||
let hackFlexWrap = require('./hacks/flex-wrap')
|
||||
let hackFullscreen = require('./hacks/fullscreen')
|
||||
let hackGradient = require('./hacks/gradient')
|
||||
let hackGridArea = require('./hacks/grid-area')
|
||||
let hackGridColumnAlign = require('./hacks/grid-column-align')
|
||||
let hackGridEnd = require('./hacks/grid-end')
|
||||
let hackGridRowAlign = require('./hacks/grid-row-align')
|
||||
let hackGridRowColumn = require('./hacks/grid-row-column')
|
||||
let hackGridRowsColumns = require('./hacks/grid-rows-columns')
|
||||
let hackGridStart = require('./hacks/grid-start')
|
||||
let hackGridTemplate = require('./hacks/grid-template')
|
||||
let hackGridTemplateAreas = require('./hacks/grid-template-areas')
|
||||
let hackImageRendering = require('./hacks/image-rendering')
|
||||
let hackImageSet = require('./hacks/image-set')
|
||||
let hackInlineLogical = require('./hacks/inline-logical')
|
||||
let hackIntrinsic = require('./hacks/intrinsic')
|
||||
let hackJustifyContent = require('./hacks/justify-content')
|
||||
let hackMaskBorder = require('./hacks/mask-border')
|
||||
let hackMaskComposite = require('./hacks/mask-composite')
|
||||
let hackOrder = require('./hacks/order')
|
||||
let hackOverscrollBehavior = require('./hacks/overscroll-behavior')
|
||||
let hackPixelated = require('./hacks/pixelated')
|
||||
let hackPlaceSelf = require('./hacks/place-self')
|
||||
let hackPlaceholder = require('./hacks/placeholder')
|
||||
let hackPlaceholderShown = require('./hacks/placeholder-shown')
|
||||
let hackPrintColorAdjust = require('./hacks/print-color-adjust')
|
||||
let hackTextDecoration = require('./hacks/text-decoration')
|
||||
let hackTextDecorationSkipInk = require('./hacks/text-decoration-skip-ink')
|
||||
let hackTextEmphasisPosition = require('./hacks/text-emphasis-position')
|
||||
let hackTransformDecl = require('./hacks/transform-decl')
|
||||
let hackUserSelect = require('./hacks/user-select')
|
||||
let hackWritingMode = require('./hacks/writing-mode')
|
||||
let Processor = require('./processor')
|
||||
let Resolution = require('./resolution')
|
||||
let Selector = require('./selector')
|
||||
let Supports = require('./supports')
|
||||
let Transition = require('./transition')
|
||||
let utils = require('./utils')
|
||||
let Value = require('./value')
|
||||
let vendor = require('./vendor')
|
||||
let hackAutofill = require('./hacks/autofill')
|
||||
|
||||
Selector.hack(hackAutofill)
|
||||
Selector.hack(hackFullscreen)
|
||||
@@ -156,77 +156,76 @@ class Prefixes {
|
||||
}
|
||||
|
||||
/**
|
||||
* Declaration loader with caching
|
||||
* Select prefixes from data, which is necessary for selected browsers
|
||||
*/
|
||||
decl(prop) {
|
||||
if (!declsCache.has(prop)) {
|
||||
declsCache.set(prop, Declaration.load(prop))
|
||||
}
|
||||
select(list) {
|
||||
let selected = { add: {}, remove: {} }
|
||||
|
||||
return declsCache.get(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* Group declaration by unprefixed property to check them
|
||||
*/
|
||||
group(decl) {
|
||||
let rule = decl.parent
|
||||
let index = rule.index(decl)
|
||||
let { length } = rule.nodes
|
||||
let unprefixed = this.unprefixed(decl.prop)
|
||||
|
||||
let checker = (step, callback) => {
|
||||
index += step
|
||||
while (index >= 0 && index < length) {
|
||||
let other = rule.nodes[index]
|
||||
if (other.type === 'decl') {
|
||||
if (step === -1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (this.unprefixed(other.prop) !== unprefixed) {
|
||||
break
|
||||
} else if (callback(other) === true) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (step === +1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
for (let name in list) {
|
||||
let data = list[name]
|
||||
let add = data.browsers.map(i => {
|
||||
let params = i.split(' ')
|
||||
return {
|
||||
browser: `${params[0]} ${params[1]}`,
|
||||
note: params[2]
|
||||
}
|
||||
})
|
||||
|
||||
index += step
|
||||
let notes = add
|
||||
.filter(i => i.note)
|
||||
.map(i => `${this.browsers.prefix(i.browser)} ${i.note}`)
|
||||
notes = utils.uniq(notes)
|
||||
|
||||
add = add
|
||||
.filter(i => this.browsers.isSelected(i.browser))
|
||||
.map(i => {
|
||||
let 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(i => !i.includes('2009'))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return {
|
||||
down(callback) {
|
||||
return checker(+1, callback)
|
||||
},
|
||||
up(callback) {
|
||||
return checker(-1, callback)
|
||||
let all = data.browsers.map(i => 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(i => !add.includes(i))
|
||||
}
|
||||
} else {
|
||||
selected.remove[name] = all
|
||||
}
|
||||
}
|
||||
|
||||
return selected
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize prefix for remover
|
||||
* Sort vendor prefixes
|
||||
*/
|
||||
normalize(prop) {
|
||||
return this.decl(prop).normalize(prop)
|
||||
}
|
||||
sort(prefixes) {
|
||||
return prefixes.sort((a, b) => {
|
||||
let aLength = utils.removeNote(a).length
|
||||
let bLength = utils.removeNote(b).length
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
prop = vendor.unprefixed(prop)
|
||||
return this.decl(prop).prefixed(prop, prefix)
|
||||
if (aLength === bLength) {
|
||||
return b.length - a.length
|
||||
} else {
|
||||
return bLength - aLength
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,8 +233,8 @@ class Prefixes {
|
||||
*/
|
||||
preprocess(selected) {
|
||||
let add = {
|
||||
'@supports': new Supports(Prefixes, this),
|
||||
'selectors': []
|
||||
'selectors': [],
|
||||
'@supports': new Supports(Prefixes, this)
|
||||
}
|
||||
for (let name in selected.add) {
|
||||
let prefixes = selected.add[name]
|
||||
@@ -325,76 +324,14 @@ class Prefixes {
|
||||
}
|
||||
|
||||
/**
|
||||
* Select prefixes from data, which is necessary for selected browsers
|
||||
* Declaration loader with caching
|
||||
*/
|
||||
select(list) {
|
||||
let selected = { add: {}, remove: {} }
|
||||
|
||||
for (let name in list) {
|
||||
let data = list[name]
|
||||
let add = data.browsers.map(i => {
|
||||
let params = i.split(' ')
|
||||
return {
|
||||
browser: `${params[0]} ${params[1]}`,
|
||||
note: params[2]
|
||||
}
|
||||
})
|
||||
|
||||
let notes = add
|
||||
.filter(i => i.note)
|
||||
.map(i => `${this.browsers.prefix(i.browser)} ${i.note}`)
|
||||
notes = utils.uniq(notes)
|
||||
|
||||
add = add
|
||||
.filter(i => this.browsers.isSelected(i.browser))
|
||||
.map(i => {
|
||||
let 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(i => !i.includes('2009'))
|
||||
}
|
||||
|
||||
let all = data.browsers.map(i => 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(i => !add.includes(i))
|
||||
}
|
||||
} else {
|
||||
selected.remove[name] = all
|
||||
}
|
||||
decl(prop) {
|
||||
if (!declsCache.has(prop)) {
|
||||
declsCache.set(prop, Declaration.load(prop))
|
||||
}
|
||||
|
||||
return selected
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort vendor prefixes
|
||||
*/
|
||||
sort(prefixes) {
|
||||
return prefixes.sort((a, b) => {
|
||||
let aLength = utils.removeNote(a).length
|
||||
let bLength = utils.removeNote(b).length
|
||||
|
||||
if (aLength === bLength) {
|
||||
return b.length - a.length
|
||||
} else {
|
||||
return bLength - aLength
|
||||
}
|
||||
})
|
||||
return declsCache.get(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,6 +345,21 @@ class Prefixes {
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize prefix for remover
|
||||
*/
|
||||
normalize(prop) {
|
||||
return this.decl(prop).normalize(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed(prop, prefix) {
|
||||
prop = vendor.unprefixed(prop)
|
||||
return this.decl(prop).prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return values, which must be prefixed in selected property
|
||||
*/
|
||||
@@ -423,6 +375,54 @@ class Prefixes {
|
||||
return global || values || []
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Group declaration by unprefixed property to check them
|
||||
*/
|
||||
group(decl) {
|
||||
let rule = decl.parent
|
||||
let index = rule.index(decl)
|
||||
let { length } = rule.nodes
|
||||
let unprefixed = this.unprefixed(decl.prop)
|
||||
|
||||
let checker = (step, callback) => {
|
||||
index += step
|
||||
while (index >= 0 && index < length) {
|
||||
let other = rule.nodes[index]
|
||||
if (other.type === 'decl') {
|
||||
if (step === -1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (this.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 {
|
||||
up(callback) {
|
||||
return checker(-1, callback)
|
||||
},
|
||||
down(callback) {
|
||||
return checker(+1, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Prefixes
|
||||
|
||||
343
node_modules/autoprefixer/lib/processor.js
generated
vendored
343
node_modules/autoprefixer/lib/processor.js
generated
vendored
@@ -94,6 +94,11 @@ class Processor {
|
||||
return displayGrid || gridTemplate || gridGap
|
||||
})
|
||||
}
|
||||
function insideFlex(decl) {
|
||||
return decl.parent.some(node => {
|
||||
return node.prop === 'display' && /(inline-)?flex/.test(node.value)
|
||||
})
|
||||
}
|
||||
|
||||
let gridPrefixes =
|
||||
this.gridStatus(css, result) &&
|
||||
@@ -142,6 +147,17 @@ class Processor {
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
} else if (
|
||||
/^(align|justify|place)-(items|content)$/.test(prop) &&
|
||||
insideFlex(decl)
|
||||
) {
|
||||
if (value === 'start' || value === 'end') {
|
||||
result.warn(
|
||||
`${value} value has mixed support, consider using ` +
|
||||
`flex-${value} instead`,
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
} else if (prop === 'text-decoration-skip' && value === 'ink') {
|
||||
result.warn(
|
||||
'Replace text-decoration-skip: ink to ' +
|
||||
@@ -380,6 +396,141 @@ class Processor {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unnecessary pefixes
|
||||
*/
|
||||
remove(css, result) {
|
||||
// At-rules
|
||||
let resolution = this.prefixes.remove['@resolution']
|
||||
|
||||
css.walkAtRules((rule, i) => {
|
||||
if (this.prefixes.remove[`@${rule.name}`]) {
|
||||
if (!this.disabled(rule, result)) {
|
||||
rule.parent.removeChild(i)
|
||||
}
|
||||
} else if (
|
||||
rule.name === 'media' &&
|
||||
rule.params.includes('-resolution') &&
|
||||
resolution
|
||||
) {
|
||||
resolution.clean(rule)
|
||||
}
|
||||
})
|
||||
|
||||
// Selectors
|
||||
for (let checker of this.prefixes.remove.selectors) {
|
||||
css.walkRules((rule, i) => {
|
||||
if (checker.check(rule)) {
|
||||
if (!this.disabled(rule, result)) {
|
||||
rule.parent.removeChild(i)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return css.walkDecls((decl, i) => {
|
||||
if (this.disabled(decl, result)) return
|
||||
|
||||
let rule = decl.parent
|
||||
let unprefixed = this.prefixes.unprefixed(decl.prop)
|
||||
|
||||
// Transition
|
||||
if (decl.prop === 'transition' || decl.prop === 'transition-property') {
|
||||
this.prefixes.transition.remove(decl)
|
||||
}
|
||||
|
||||
// Properties
|
||||
if (
|
||||
this.prefixes.remove[decl.prop] &&
|
||||
this.prefixes.remove[decl.prop].remove
|
||||
) {
|
||||
let notHack = this.prefixes.group(decl).down(other => {
|
||||
return this.prefixes.normalize(other.prop) === unprefixed
|
||||
})
|
||||
|
||||
if (unprefixed === 'flex-flow') {
|
||||
notHack = true
|
||||
}
|
||||
|
||||
if (decl.prop === '-webkit-box-orient') {
|
||||
let hacks = { 'flex-direction': true, 'flex-flow': true }
|
||||
if (!decl.parent.some(j => hacks[j.prop])) return
|
||||
}
|
||||
|
||||
if (notHack && !this.withHackValue(decl)) {
|
||||
if (decl.raw('before').includes('\n')) {
|
||||
this.reduceSpaces(decl)
|
||||
}
|
||||
rule.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Values
|
||||
for (let checker of this.prefixes.values('remove', unprefixed)) {
|
||||
if (!checker.check) continue
|
||||
if (!checker.check(decl.value)) continue
|
||||
|
||||
unprefixed = checker.unprefixed
|
||||
let notHack = this.prefixes.group(decl).down(other => {
|
||||
return other.value.includes(unprefixed)
|
||||
})
|
||||
|
||||
if (notHack) {
|
||||
rule.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Some rare old values, which is not in standard
|
||||
*/
|
||||
withHackValue(decl) {
|
||||
return decl.prop === '-webkit-background-clip' && decl.value === 'text'
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for grid/flexbox options.
|
||||
*/
|
||||
disabledValue(node, result) {
|
||||
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (node.type === 'decl' && node.prop === 'content') {
|
||||
return true
|
||||
}
|
||||
|
||||
return this.disabled(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for grid/flexbox options.
|
||||
*/
|
||||
disabledDecl(node, result) {
|
||||
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return this.disabled(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for control comment and global options
|
||||
*/
|
||||
@@ -439,43 +590,35 @@ class Processor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for grid/flexbox options.
|
||||
* Normalize spaces in cascade declaration group
|
||||
*/
|
||||
disabledDecl(node, result) {
|
||||
if (node.type === 'decl' && this.gridStatus(node, result) === false) {
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (node.type === 'decl' && this.prefixes.options.flexbox === false) {
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return this.disabled(node, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for grid/flexbox options.
|
||||
*/
|
||||
disabledValue(node, result) {
|
||||
if (this.gridStatus(node, result) === false && node.type === 'decl') {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (node.type === 'decl' && node.prop === 'content') {
|
||||
reduceSpaces(decl) {
|
||||
let stop = false
|
||||
this.prefixes.group(decl).up(() => {
|
||||
stop = true
|
||||
return true
|
||||
})
|
||||
if (stop) {
|
||||
return
|
||||
}
|
||||
|
||||
return this.disabled(node, result)
|
||||
let parts = decl.raw('before').split('\n')
|
||||
let prevMin = parts[parts.length - 1].length
|
||||
let diff = false
|
||||
|
||||
this.prefixes.group(decl).down(other => {
|
||||
parts = other.raw('before').split('\n')
|
||||
let last = parts.length - 1
|
||||
|
||||
if (parts[last].length > prevMin) {
|
||||
if (diff === false) {
|
||||
diff = parts[last].length - prevMin
|
||||
}
|
||||
|
||||
parts[last] = parts[last].slice(0, -diff)
|
||||
other.raws.before = parts.join('\n')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,140 +713,6 @@ class Processor {
|
||||
node._autoprefixerGridStatus = value
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize spaces in cascade declaration group
|
||||
*/
|
||||
reduceSpaces(decl) {
|
||||
let stop = false
|
||||
this.prefixes.group(decl).up(() => {
|
||||
stop = true
|
||||
return true
|
||||
})
|
||||
if (stop) {
|
||||
return
|
||||
}
|
||||
|
||||
let parts = decl.raw('before').split('\n')
|
||||
let prevMin = parts[parts.length - 1].length
|
||||
let diff = false
|
||||
|
||||
this.prefixes.group(decl).down(other => {
|
||||
parts = other.raw('before').split('\n')
|
||||
let last = parts.length - 1
|
||||
|
||||
if (parts[last].length > prevMin) {
|
||||
if (diff === false) {
|
||||
diff = parts[last].length - prevMin
|
||||
}
|
||||
|
||||
parts[last] = parts[last].slice(0, -diff)
|
||||
other.raws.before = parts.join('\n')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unnecessary pefixes
|
||||
*/
|
||||
remove(css, result) {
|
||||
// At-rules
|
||||
let resolution = this.prefixes.remove['@resolution']
|
||||
|
||||
css.walkAtRules((rule, i) => {
|
||||
if (this.prefixes.remove[`@${rule.name}`]) {
|
||||
if (!this.disabled(rule, result)) {
|
||||
rule.parent.removeChild(i)
|
||||
}
|
||||
} else if (
|
||||
rule.name === 'media' &&
|
||||
rule.params.includes('-resolution') &&
|
||||
resolution
|
||||
) {
|
||||
resolution.clean(rule)
|
||||
}
|
||||
})
|
||||
|
||||
// Selectors
|
||||
css.walkRules((rule, i) => {
|
||||
if (this.disabled(rule, result)) return
|
||||
|
||||
for (let checker of this.prefixes.remove.selectors) {
|
||||
if (checker.check(rule)) {
|
||||
rule.parent.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return css.walkDecls((decl, i) => {
|
||||
if (this.disabled(decl, result)) return
|
||||
|
||||
let rule = decl.parent
|
||||
let unprefixed = this.prefixes.unprefixed(decl.prop)
|
||||
|
||||
// Transition
|
||||
if (decl.prop === 'transition' || decl.prop === 'transition-property') {
|
||||
this.prefixes.transition.remove(decl)
|
||||
}
|
||||
|
||||
// Properties
|
||||
if (
|
||||
this.prefixes.remove[decl.prop] &&
|
||||
this.prefixes.remove[decl.prop].remove
|
||||
) {
|
||||
let notHack = this.prefixes.group(decl).down(other => {
|
||||
return this.prefixes.normalize(other.prop) === unprefixed
|
||||
})
|
||||
|
||||
if (unprefixed === 'flex-flow') {
|
||||
notHack = true
|
||||
}
|
||||
|
||||
if (decl.prop === '-webkit-box-orient') {
|
||||
let hacks = { 'flex-direction': true, 'flex-flow': true }
|
||||
if (!decl.parent.some(j => hacks[j.prop])) return
|
||||
}
|
||||
|
||||
if (notHack && !this.withHackValue(decl)) {
|
||||
if (decl.raw('before').includes('\n')) {
|
||||
this.reduceSpaces(decl)
|
||||
}
|
||||
rule.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Values
|
||||
for (let checker of this.prefixes.values('remove', unprefixed)) {
|
||||
if (!checker.check) continue
|
||||
if (!checker.check(decl.value)) continue
|
||||
|
||||
unprefixed = checker.unprefixed
|
||||
let notHack = this.prefixes.group(decl).down(other => {
|
||||
return other.value.includes(unprefixed)
|
||||
})
|
||||
|
||||
if (notHack) {
|
||||
rule.removeChild(i)
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Some rare old values, which is not in standard
|
||||
*/
|
||||
withHackValue(decl) {
|
||||
return (
|
||||
(decl.prop === '-webkit-background-clip' && decl.value === 'text') ||
|
||||
// Do not remove -webkit-box-orient when -webkit-line-clamp is present.
|
||||
// https://github.com/postcss/autoprefixer/issues/1510
|
||||
(decl.prop === '-webkit-box-orient' &&
|
||||
decl.parent.some(d => d.prop === '-webkit-line-clamp'))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Processor
|
||||
|
||||
34
node_modules/autoprefixer/lib/resolution.js
generated
vendored
34
node_modules/autoprefixer/lib/resolution.js
generated
vendored
@@ -7,23 +7,6 @@ const REGEXP = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpcm|dpi|x)/gi
|
||||
const SPLIT = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpcm|dpi|x)/i
|
||||
|
||||
class Resolution extends Prefixer {
|
||||
/**
|
||||
* Remove prefixed queries
|
||||
*/
|
||||
clean(rule) {
|
||||
if (!this.bad) {
|
||||
this.bad = []
|
||||
for (let prefix of this.prefixes) {
|
||||
this.bad.push(this.prefixName(prefix, 'min'))
|
||||
this.bad.push(this.prefixName(prefix, 'max'))
|
||||
}
|
||||
}
|
||||
|
||||
rule.params = utils.editList(rule.params, queries => {
|
||||
return queries.filter(query => this.bad.every(i => !query.includes(i)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed query name
|
||||
*/
|
||||
@@ -56,6 +39,23 @@ class Resolution extends Prefixer {
|
||||
return this.prefixName(prefix, name) + colon + value
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove prefixed queries
|
||||
*/
|
||||
clean(rule) {
|
||||
if (!this.bad) {
|
||||
this.bad = []
|
||||
for (let prefix of this.prefixes) {
|
||||
this.bad.push(this.prefixName(prefix, 'min'))
|
||||
this.bad.push(this.prefixName(prefix, 'max'))
|
||||
}
|
||||
}
|
||||
|
||||
rule.params = utils.editList(rule.params, queries => {
|
||||
return queries.filter(query => this.bad.every(i => !query.includes(i)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixed queries
|
||||
*/
|
||||
|
||||
164
node_modules/autoprefixer/lib/selector.js
generated
vendored
164
node_modules/autoprefixer/lib/selector.js
generated
vendored
@@ -1,8 +1,8 @@
|
||||
let { list } = require('postcss')
|
||||
|
||||
let Browsers = require('./browsers')
|
||||
let OldSelector = require('./old-selector')
|
||||
let Prefixer = require('./prefixer')
|
||||
let Browsers = require('./browsers')
|
||||
let utils = require('./utils')
|
||||
|
||||
class Selector extends Prefixer {
|
||||
@@ -12,17 +12,75 @@ class Selector extends Prefixer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone and add prefixes for at-rule
|
||||
* Is rule selectors need to be prefixed
|
||||
*/
|
||||
add(rule, prefix) {
|
||||
let prefixeds = this.prefixeds(rule)
|
||||
|
||||
if (this.already(rule, prefixeds, prefix)) {
|
||||
return
|
||||
check(rule) {
|
||||
if (rule.selector.includes(this.name)) {
|
||||
return !!rule.selector.match(this.regexp())
|
||||
}
|
||||
|
||||
let cloned = this.clone(rule, { selector: prefixeds[this.name][prefix] })
|
||||
rule.parent.insertBefore(rule, cloned)
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of selector
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
return this.name.replace(/^(\W*)/, `$1${prefix}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy loadRegExp for name
|
||||
*/
|
||||
regexp(prefix) {
|
||||
if (!this.regexpCache.has(prefix)) {
|
||||
let name = prefix ? this.prefixed(prefix) : this.name
|
||||
this.regexpCache.set(
|
||||
prefix,
|
||||
new RegExp(`(^|[^:"'=])${utils.escapeRegexp(name)}`, 'gi')
|
||||
)
|
||||
}
|
||||
|
||||
return this.regexpCache.get(prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* All possible prefixes
|
||||
*/
|
||||
possible() {
|
||||
return Browsers.prefixes()
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all possible selector prefixes
|
||||
*/
|
||||
prefixeds(rule) {
|
||||
if (rule._autoprefixerPrefixeds) {
|
||||
if (rule._autoprefixerPrefixeds[this.name]) {
|
||||
return rule._autoprefixerPrefixeds
|
||||
}
|
||||
} else {
|
||||
rule._autoprefixerPrefixeds = {}
|
||||
}
|
||||
|
||||
let prefixeds = {}
|
||||
if (rule.selector.includes(',')) {
|
||||
let ruleParts = list.comma(rule.selector)
|
||||
let toProcess = ruleParts.filter(el => el.includes(this.name))
|
||||
|
||||
for (let prefix of this.possible()) {
|
||||
prefixeds[prefix] = toProcess
|
||||
.map(el => this.replace(el, prefix))
|
||||
.join(', ')
|
||||
}
|
||||
} else {
|
||||
for (let prefix of this.possible()) {
|
||||
prefixeds[prefix] = this.replace(rule.selector, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
rule._autoprefixerPrefixeds[this.name] = prefixeds
|
||||
return rule._autoprefixerPrefixeds
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,14 +119,24 @@ class Selector extends Prefixer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Is rule selectors need to be prefixed
|
||||
* Replace selectors by prefixed one
|
||||
*/
|
||||
check(rule) {
|
||||
if (rule.selector.includes(this.name)) {
|
||||
return !!rule.selector.match(this.regexp())
|
||||
replace(selector, prefix) {
|
||||
return selector.replace(this.regexp(), `$1${this.prefixed(prefix)}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone and add prefixes for at-rule
|
||||
*/
|
||||
add(rule, prefix) {
|
||||
let prefixeds = this.prefixeds(rule)
|
||||
|
||||
if (this.already(rule, prefixeds, prefix)) {
|
||||
return
|
||||
}
|
||||
|
||||
return false
|
||||
let cloned = this.clone(rule, { selector: prefixeds[this.name][prefix] })
|
||||
rule.parent.insertBefore(rule, cloned)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,74 +145,6 @@ class Selector extends Prefixer {
|
||||
old(prefix) {
|
||||
return new OldSelector(this, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* All possible prefixes
|
||||
*/
|
||||
possible() {
|
||||
return Browsers.prefixes()
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of selector
|
||||
*/
|
||||
prefixed(prefix) {
|
||||
return this.name.replace(/^(\W*)/, `$1${prefix}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all possible selector prefixes
|
||||
*/
|
||||
prefixeds(rule) {
|
||||
if (rule._autoprefixerPrefixeds) {
|
||||
if (rule._autoprefixerPrefixeds[this.name]) {
|
||||
return rule._autoprefixerPrefixeds
|
||||
}
|
||||
} else {
|
||||
rule._autoprefixerPrefixeds = {}
|
||||
}
|
||||
|
||||
let prefixeds = {}
|
||||
if (rule.selector.includes(',')) {
|
||||
let ruleParts = list.comma(rule.selector)
|
||||
let toProcess = ruleParts.filter(el => el.includes(this.name))
|
||||
|
||||
for (let prefix of this.possible()) {
|
||||
prefixeds[prefix] = toProcess
|
||||
.map(el => this.replace(el, prefix))
|
||||
.join(', ')
|
||||
}
|
||||
} else {
|
||||
for (let prefix of this.possible()) {
|
||||
prefixeds[prefix] = this.replace(rule.selector, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
rule._autoprefixerPrefixeds[this.name] = prefixeds
|
||||
return rule._autoprefixerPrefixeds
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy loadRegExp for name
|
||||
*/
|
||||
regexp(prefix) {
|
||||
if (!this.regexpCache.has(prefix)) {
|
||||
let name = prefix ? this.prefixed(prefix) : this.name
|
||||
this.regexpCache.set(
|
||||
prefix,
|
||||
new RegExp(`(^|[^:"'=])${utils.escapeRegexp(name)}`, 'gi')
|
||||
)
|
||||
}
|
||||
|
||||
return this.regexpCache.get(prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace selectors by prefixed one
|
||||
*/
|
||||
replace(selector, prefix) {
|
||||
return selector.replace(this.regexp(), `$1${this.prefixed(prefix)}`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Selector
|
||||
|
||||
352
node_modules/autoprefixer/lib/supports.js
generated
vendored
352
node_modules/autoprefixer/lib/supports.js
generated
vendored
@@ -2,10 +2,10 @@ let featureQueries = require('caniuse-lite/data/features/css-featurequeries.js')
|
||||
let feature = require('caniuse-lite/dist/unpacker/feature')
|
||||
let { parse } = require('postcss')
|
||||
|
||||
let brackets = require('./brackets')
|
||||
let Browsers = require('./browsers')
|
||||
let utils = require('./utils')
|
||||
let brackets = require('./brackets')
|
||||
let Value = require('./value')
|
||||
let utils = require('./utils')
|
||||
|
||||
let data = feature(featureQueries)
|
||||
|
||||
@@ -27,25 +27,161 @@ class Supports {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixes
|
||||
* Return prefixer only with @supports supported browsers
|
||||
*/
|
||||
add(nodes, all) {
|
||||
return nodes.map(i => {
|
||||
if (this.isProp(i)) {
|
||||
let prefixed = this.prefixed(i[0])
|
||||
if (prefixed.length > 1) {
|
||||
return this.convert(prefixed)
|
||||
prefixer() {
|
||||
if (this.prefixerCache) {
|
||||
return this.prefixerCache
|
||||
}
|
||||
|
||||
let filtered = this.all.browsers.selected.filter(i => {
|
||||
return supported.includes(i)
|
||||
})
|
||||
|
||||
let 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
|
||||
*/
|
||||
parse(str) {
|
||||
let parts = str.split(':')
|
||||
let prop = parts[0]
|
||||
let value = parts[1]
|
||||
if (!value) value = ''
|
||||
return [prop.trim(), value.trim()]
|
||||
}
|
||||
|
||||
/**
|
||||
* Create virtual rule to process it by prefixer
|
||||
*/
|
||||
virtual(str) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let rule = parse('a{}').first
|
||||
rule.append({ prop, value, raws: { before: '' } })
|
||||
return rule
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of Declaration with all necessary prefixes
|
||||
*/
|
||||
prefixed(str) {
|
||||
let rule = this.virtual(str)
|
||||
if (this.disabled(rule.first)) {
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
let result = { warn: () => null }
|
||||
|
||||
let prefixer = this.prefixer().add[rule.first.prop]
|
||||
prefixer && prefixer.process && prefixer.process(rule.first, result)
|
||||
|
||||
for (let decl of rule.nodes) {
|
||||
for (let value of this.prefixer().values('add', rule.first.prop)) {
|
||||
value.process(decl)
|
||||
}
|
||||
Value.save(this.all, decl)
|
||||
}
|
||||
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "not" word
|
||||
*/
|
||||
isNot(node) {
|
||||
return typeof node === 'string' && /not\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "or" word
|
||||
*/
|
||||
isOr(node) {
|
||||
return typeof node === 'string' && /\s*or\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is (prop: value)
|
||||
*/
|
||||
isProp(node) {
|
||||
return (
|
||||
typeof node === 'object' &&
|
||||
node.length === 1 &&
|
||||
typeof node[0] === 'string'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if prefixed property has no unprefixed
|
||||
*/
|
||||
isHack(all, unprefixed) {
|
||||
let check = new RegExp(`(\\(|\\s)${utils.escapeRegexp(unprefixed)}:`)
|
||||
return !check.test(all)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we need to remove node
|
||||
*/
|
||||
toRemove(str, all) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let unprefixed = this.all.unprefixed(prop)
|
||||
|
||||
let cleaner = this.all.cleaner()
|
||||
|
||||
if (
|
||||
cleaner.remove[prop] &&
|
||||
cleaner.remove[prop].remove &&
|
||||
!this.isHack(all, unprefixed)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
for (let checker of cleaner.values('remove', unprefixed)) {
|
||||
if (checker.check(value)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all unnecessary prefixes
|
||||
*/
|
||||
remove(nodes, all) {
|
||||
let 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
|
||||
}
|
||||
|
||||
return i
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
|
||||
if (typeof i === 'object') {
|
||||
return this.add(i, all)
|
||||
if (typeof nodes[i] === 'object') {
|
||||
nodes[i] = this.remove(nodes[i], all)
|
||||
}
|
||||
|
||||
return i
|
||||
})
|
||||
i += 1
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,65 +214,6 @@ class Supports {
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Check global options
|
||||
*/
|
||||
disabled(node) {
|
||||
if (!this.all.options.grid) {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (this.all.options.flexbox === false) {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if prefixed property has no unprefixed
|
||||
*/
|
||||
isHack(all, unprefixed) {
|
||||
let check = new RegExp(`(\\(|\\s)${utils.escapeRegexp(unprefixed)}:`)
|
||||
return !check.test(all)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "not" word
|
||||
*/
|
||||
isNot(node) {
|
||||
return typeof node === 'string' && /not\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "or" word
|
||||
*/
|
||||
isOr(node) {
|
||||
return typeof node === 'string' && /\s*or\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is (prop: value)
|
||||
*/
|
||||
isProp(node) {
|
||||
return (
|
||||
typeof node === 'object' &&
|
||||
node.length === 1 &&
|
||||
typeof node[0] === 'string'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress value functions into a string nodes
|
||||
*/
|
||||
@@ -162,63 +239,25 @@ class Supports {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse string into declaration property and value
|
||||
* Add prefixes
|
||||
*/
|
||||
parse(str) {
|
||||
let parts = str.split(':')
|
||||
let prop = parts[0]
|
||||
let value = parts[1]
|
||||
if (!value) value = ''
|
||||
return [prop.trim(), value.trim()]
|
||||
}
|
||||
add(nodes, all) {
|
||||
return nodes.map(i => {
|
||||
if (this.isProp(i)) {
|
||||
let prefixed = this.prefixed(i[0])
|
||||
if (prefixed.length > 1) {
|
||||
return this.convert(prefixed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of Declaration with all necessary prefixes
|
||||
*/
|
||||
prefixed(str) {
|
||||
let rule = this.virtual(str)
|
||||
if (this.disabled(rule.first)) {
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
let result = { warn: () => null }
|
||||
|
||||
let prefixer = this.prefixer().add[rule.first.prop]
|
||||
prefixer && prefixer.process && prefixer.process(rule.first, result)
|
||||
|
||||
for (let decl of rule.nodes) {
|
||||
for (let value of this.prefixer().values('add', rule.first.prop)) {
|
||||
value.process(decl)
|
||||
return i
|
||||
}
|
||||
Value.save(this.all, decl)
|
||||
}
|
||||
|
||||
return rule.nodes
|
||||
}
|
||||
if (typeof i === 'object') {
|
||||
return this.add(i, all)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixer only with @supports supported browsers
|
||||
*/
|
||||
prefixer() {
|
||||
if (this.prefixerCache) {
|
||||
return this.prefixerCache
|
||||
}
|
||||
|
||||
let filtered = this.all.browsers.selected.filter(i => {
|
||||
return supported.includes(i)
|
||||
return i
|
||||
})
|
||||
|
||||
let 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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,69 +273,30 @@ class Supports {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all unnecessary prefixes
|
||||
* Check global options
|
||||
*/
|
||||
remove(nodes, all) {
|
||||
let 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
|
||||
disabled(node) {
|
||||
if (!this.all.options.grid) {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof nodes[i] === 'object') {
|
||||
nodes[i] = this.remove(nodes[i], all)
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
|
||||
i += 1
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we need to remove node
|
||||
*/
|
||||
toRemove(str, all) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let unprefixed = this.all.unprefixed(prop)
|
||||
|
||||
let cleaner = this.all.cleaner()
|
||||
|
||||
if (
|
||||
cleaner.remove[prop] &&
|
||||
cleaner.remove[prop].remove &&
|
||||
!this.isHack(all, unprefixed)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
for (let checker of cleaner.values('remove', unprefixed)) {
|
||||
if (checker.check(value)) {
|
||||
if (this.all.options.flexbox === false) {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Create virtual rule to process it by prefixer
|
||||
*/
|
||||
virtual(str) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let rule = parse('a{}').first
|
||||
rule.append({ prop, raws: { before: '' }, value })
|
||||
return rule
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Supports
|
||||
|
||||
262
node_modules/autoprefixer/lib/transition.js
generated
vendored
262
node_modules/autoprefixer/lib/transition.js
generated
vendored
@@ -79,6 +79,21 @@ class Transition {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find property name
|
||||
*/
|
||||
findProp(param) {
|
||||
let prop = param[0].value
|
||||
if (/^\d/.test(prop)) {
|
||||
for (let [i, token] of param.entries()) {
|
||||
if (i !== 0 && token.type === 'word') {
|
||||
return token.value
|
||||
}
|
||||
}
|
||||
}
|
||||
return prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Does we already have this declaration
|
||||
*/
|
||||
@@ -86,6 +101,15 @@ class Transition {
|
||||
return decl.parent.some(i => i.prop === prop && i.value === value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add declaration if it is not exist
|
||||
*/
|
||||
cloneBefore(decl, prop, value) {
|
||||
if (!this.already(decl, prop, value)) {
|
||||
decl.cloneBefore({ prop, value })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show transition-property warning
|
||||
*/
|
||||
@@ -131,123 +155,6 @@ class Transition {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all non-webkit prefixes and unprefixed params if we have prefixed
|
||||
*/
|
||||
cleanFromUnprefixed(params, prefix) {
|
||||
let remove = params
|
||||
.map(i => this.findProp(i))
|
||||
.filter(i => i.slice(0, prefix.length) === prefix)
|
||||
.map(i => this.prefixes.unprefixed(i))
|
||||
|
||||
let result = []
|
||||
for (let param of params) {
|
||||
let prop = this.findProp(param)
|
||||
let p = vendor.prefix(prop)
|
||||
if (!remove.includes(prop) && (p === prefix || p === '')) {
|
||||
result.push(param)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
cleanOtherPrefixes(params, prefix) {
|
||||
return params.filter(param => {
|
||||
let current = vendor.prefix(this.findProp(param))
|
||||
return current === '' || current === prefix
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Return new param array with different name
|
||||
*/
|
||||
clone(origin, name, param) {
|
||||
let result = []
|
||||
let changed = false
|
||||
for (let i of param) {
|
||||
if (!changed && i.type === 'word' && i.value === origin) {
|
||||
result.push({ type: 'word', value: name })
|
||||
changed = true
|
||||
} else {
|
||||
result.push(i)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Add declaration if it is not exist
|
||||
*/
|
||||
cloneBefore(decl, prop, value) {
|
||||
if (!this.already(decl, prop, value)) {
|
||||
decl.cloneBefore({ prop, value })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check property for disabled by option
|
||||
*/
|
||||
disabled(prop, prefix) {
|
||||
let other = ['order', 'justify-content', 'align-self', 'align-content']
|
||||
if (prop.includes('flex') || other.includes(prop)) {
|
||||
if (this.prefixes.options.flexbox === false) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (this.prefixes.options.flexbox === 'no-2009') {
|
||||
return prefix.includes('2009')
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Find or create separator
|
||||
*/
|
||||
div(params) {
|
||||
for (let param of params) {
|
||||
for (let node of param) {
|
||||
if (node.type === 'div' && node.value === ',') {
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
return { after: ' ', type: 'div', value: ',' }
|
||||
}
|
||||
|
||||
/**
|
||||
* Find property name
|
||||
*/
|
||||
findProp(param) {
|
||||
let prop = param[0].value
|
||||
if (/^\d/.test(prop)) {
|
||||
for (let [i, token] of param.entries()) {
|
||||
if (i !== 0 && token.type === 'word') {
|
||||
return token.value
|
||||
}
|
||||
}
|
||||
}
|
||||
return prop
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse properties list to array
|
||||
*/
|
||||
parse(value) {
|
||||
let ast = parser(value)
|
||||
let result = []
|
||||
let param = []
|
||||
for (let node of ast.nodes) {
|
||||
param.push(node)
|
||||
if (node.type === 'div' && node.value === ',') {
|
||||
result.push(param)
|
||||
param = []
|
||||
}
|
||||
}
|
||||
result.push(param)
|
||||
return result.filter(i => i.length > 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Process transition and remove all unnecessary properties
|
||||
*/
|
||||
@@ -284,22 +191,21 @@ class Transition {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if transition prop is inside vendor specific rule
|
||||
* Parse properties list to array
|
||||
*/
|
||||
ruleVendorPrefixes(decl) {
|
||||
let { parent } = decl
|
||||
|
||||
if (parent.type !== 'rule') {
|
||||
return false
|
||||
} else if (!parent.selector.includes(':-')) {
|
||||
return false
|
||||
parse(value) {
|
||||
let ast = parser(value)
|
||||
let result = []
|
||||
let param = []
|
||||
for (let node of ast.nodes) {
|
||||
param.push(node)
|
||||
if (node.type === 'div' && node.value === ',') {
|
||||
result.push(param)
|
||||
param = []
|
||||
}
|
||||
}
|
||||
|
||||
let selectors = Browsers.prefixes().filter(s =>
|
||||
parent.selector.includes(':' + s)
|
||||
)
|
||||
|
||||
return selectors.length > 0 ? selectors : false
|
||||
result.push(param)
|
||||
return result.filter(i => i.length > 0)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,6 +230,100 @@ class Transition {
|
||||
}
|
||||
return parser.stringify({ nodes })
|
||||
}
|
||||
|
||||
/**
|
||||
* Return new param array with different name
|
||||
*/
|
||||
clone(origin, name, param) {
|
||||
let result = []
|
||||
let changed = false
|
||||
for (let i of param) {
|
||||
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
|
||||
*/
|
||||
div(params) {
|
||||
for (let param of params) {
|
||||
for (let node of param) {
|
||||
if (node.type === 'div' && node.value === ',') {
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
return { type: 'div', value: ',', after: ' ' }
|
||||
}
|
||||
|
||||
cleanOtherPrefixes(params, prefix) {
|
||||
return params.filter(param => {
|
||||
let current = vendor.prefix(this.findProp(param))
|
||||
return current === '' || current === prefix
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all non-webkit prefixes and unprefixed params if we have prefixed
|
||||
*/
|
||||
cleanFromUnprefixed(params, prefix) {
|
||||
let remove = params
|
||||
.map(i => this.findProp(i))
|
||||
.filter(i => i.slice(0, prefix.length) === prefix)
|
||||
.map(i => this.prefixes.unprefixed(i))
|
||||
|
||||
let result = []
|
||||
for (let param of params) {
|
||||
let prop = this.findProp(param)
|
||||
let p = vendor.prefix(prop)
|
||||
if (!remove.includes(prop) && (p === prefix || p === '')) {
|
||||
result.push(param)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Check property for disabled by option
|
||||
*/
|
||||
disabled(prop, prefix) {
|
||||
let other = ['order', 'justify-content', 'align-self', 'align-content']
|
||||
if (prop.includes('flex') || other.includes(prop)) {
|
||||
if (this.prefixes.options.flexbox === false) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (this.prefixes.options.flexbox === 'no-2009') {
|
||||
return prefix.includes('2009')
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if transition prop is inside vendor specific rule
|
||||
*/
|
||||
ruleVendorPrefixes(decl) {
|
||||
let { parent } = decl
|
||||
|
||||
if (parent.type !== 'rule') {
|
||||
return false
|
||||
} else if (!parent.selector.includes(':-')) {
|
||||
return false
|
||||
}
|
||||
|
||||
let selectors = Browsers.prefixes().filter(s =>
|
||||
parent.selector.includes(':' + s)
|
||||
)
|
||||
|
||||
return selectors.length > 0 ? selectors : false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Transition
|
||||
|
||||
56
node_modules/autoprefixer/lib/value.js
generated
vendored
56
node_modules/autoprefixer/lib/value.js
generated
vendored
@@ -1,7 +1,7 @@
|
||||
let OldValue = require('./old-value')
|
||||
let Prefixer = require('./prefixer')
|
||||
let utils = require('./utils')
|
||||
let OldValue = require('./old-value')
|
||||
let vendor = require('./vendor')
|
||||
let utils = require('./utils')
|
||||
|
||||
class Value extends Prefixer {
|
||||
/**
|
||||
@@ -58,25 +58,6 @@ class Value extends Prefixer {
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Save values with next prefixed token
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
if (!decl._autoprefixerValues) {
|
||||
decl._autoprefixerValues = {}
|
||||
}
|
||||
let value = decl._autoprefixerValues[prefix] || this.value(decl)
|
||||
|
||||
let before
|
||||
do {
|
||||
before = value
|
||||
value = this.replace(value, prefix)
|
||||
if (value === false) return
|
||||
} while (value !== before)
|
||||
|
||||
decl._autoprefixerValues[prefix] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* Is declaration need to be prefixed
|
||||
*/
|
||||
@@ -89,13 +70,6 @@ class Value extends Prefixer {
|
||||
return !!value.match(this.regexp())
|
||||
}
|
||||
|
||||
/**
|
||||
* Return function to fast find prefixed value
|
||||
*/
|
||||
old(prefix) {
|
||||
return new OldValue(this.name, prefix + this.name)
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy regexp loading
|
||||
*/
|
||||
@@ -120,6 +94,32 @@ class Value extends Prefixer {
|
||||
return decl.value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save values with next prefixed token
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
if (!decl._autoprefixerValues) {
|
||||
decl._autoprefixerValues = {}
|
||||
}
|
||||
let value = decl._autoprefixerValues[prefix] || this.value(decl)
|
||||
|
||||
let before
|
||||
do {
|
||||
before = value
|
||||
value = this.replace(value, prefix)
|
||||
if (value === false) return
|
||||
} while (value !== before)
|
||||
|
||||
decl._autoprefixerValues[prefix] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* Return function to fast find prefixed value
|
||||
*/
|
||||
old(prefix) {
|
||||
return new OldValue(this.name, prefix + this.name)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Value
|
||||
|
||||
14
node_modules/autoprefixer/package.json
generated
vendored
14
node_modules/autoprefixer/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "autoprefixer",
|
||||
"version": "10.4.21",
|
||||
"version": "10.4.14",
|
||||
"description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
@@ -23,10 +23,6 @@
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/autoprefixer"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
@@ -39,11 +35,11 @@
|
||||
"postcss": "^8.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"browserslist": "^4.24.4",
|
||||
"caniuse-lite": "^1.0.30001702",
|
||||
"fraction.js": "^4.3.7",
|
||||
"browserslist": "^4.21.5",
|
||||
"caniuse-lite": "^1.0.30001464",
|
||||
"fraction.js": "^4.2.0",
|
||||
"normalize-range": "^0.1.2",
|
||||
"picocolors": "^1.1.1",
|
||||
"picocolors": "^1.0.0",
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user