first commit

This commit is contained in:
monjack
2025-06-20 18:01:48 +08:00
commit 6daa6d65c1
24611 changed files with 2512443 additions and 0 deletions

View File

@ -0,0 +1,49 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class AlignContent extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'align-content'
}
/**
* Change property name for 2012 spec
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012) {
return prefix + 'flex-line-pack'
}
return super.prefixed(prop, prefix)
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2012) {
decl.value = AlignContent.oldValues[decl.value] || decl.value
return super.set(decl, prefix)
}
if (spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
AlignContent.names = ['align-content', 'flex-line-pack']
AlignContent.oldValues = {
'flex-end': 'end',
'flex-start': 'start',
'space-around': 'distribute',
'space-between': 'justify'
}
module.exports = AlignContent

View File

@ -0,0 +1,46 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class AlignItems extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'align-items'
}
/**
* Change property name for 2009 and 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-align'
}
if (spec === 2012) {
return prefix + 'flex-align'
}
return super.prefixed(prop, prefix)
}
/**
* Change value for 2009 and 2012 specs
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2009 || spec === 2012) {
decl.value = AlignItems.oldValues[decl.value] || decl.value
}
return super.set(decl, prefix)
}
}
AlignItems.names = ['align-items', 'flex-align', 'box-align']
AlignItems.oldValues = {
'flex-end': 'end',
'flex-start': 'start'
}
module.exports = AlignItems

View File

@ -0,0 +1,56 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class AlignSelf extends Declaration {
check(decl) {
return (
decl.parent &&
!decl.parent.some(i => {
return i.prop && i.prop.startsWith('grid-')
})
)
}
/**
* Return property name by final spec
*/
normalize() {
return 'align-self'
}
/**
* Change property name for 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012) {
return prefix + 'flex-item-align'
}
return super.prefixed(prop, prefix)
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2012) {
decl.value = AlignSelf.oldValues[decl.value] || decl.value
return super.set(decl, prefix)
}
if (spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
AlignSelf.names = ['align-self', 'flex-item-align']
AlignSelf.oldValues = {
'flex-end': 'end',
'flex-start': 'start'
}
module.exports = AlignSelf

View File

@ -0,0 +1,17 @@
let Declaration = require('../declaration')
class Animation extends Declaration {
/**
* Dont add prefixes for modern values.
*/
check(decl) {
return !decl.value.split(/\s+/).some(i => {
let lower = i.toLowerCase()
return lower === 'reverse' || lower === 'alternate-reverse'
})
}
}
Animation.names = ['animation', 'animation-direction']
module.exports = Animation

View File

@ -0,0 +1,23 @@
let Declaration = require('../declaration')
let utils = require('../utils')
class Appearance extends Declaration {
constructor(name, prefixes, all) {
super(name, prefixes, all)
if (this.prefixes) {
this.prefixes = utils.uniq(
this.prefixes.map(i => {
if (i === '-ms-') {
return '-webkit-'
}
return i
})
)
}
}
}
Appearance.names = ['appearance']
module.exports = Appearance

View File

@ -0,0 +1,26 @@
let Selector = require('../selector')
let utils = require('../utils')
class Autofill extends Selector {
constructor(name, prefixes, all) {
super(name, prefixes, all)
if (this.prefixes) {
this.prefixes = utils.uniq(this.prefixes.map(() => '-webkit-'))
}
}
/**
* Return different selectors depend on prefix
*/
prefixed(prefix) {
if (prefix === '-webkit-') {
return ':-webkit-autofill'
}
return `:${prefix}autofill`
}
}
Autofill.names = [':autofill']
module.exports = Autofill

View File

@ -0,0 +1,20 @@
let Declaration = require('../declaration')
let utils = require('../utils')
class BackdropFilter extends Declaration {
constructor(name, prefixes, all) {
super(name, prefixes, all)
if (this.prefixes) {
this.prefixes = utils.uniq(
this.prefixes.map(i => {
return i === '-ms-' ? '-webkit-' : i
})
)
}
}
}
BackdropFilter.names = ['backdrop-filter']
module.exports = BackdropFilter

View File

@ -0,0 +1,24 @@
let Declaration = require('../declaration')
let utils = require('../utils')
class BackgroundClip extends Declaration {
constructor(name, prefixes, all) {
super(name, prefixes, all)
if (this.prefixes) {
this.prefixes = utils.uniq(
this.prefixes.map(i => {
return i === '-ms-' ? '-webkit-' : i
})
)
}
}
check(decl) {
return decl.value.toLowerCase() === 'text'
}
}
BackgroundClip.names = ['background-clip']
module.exports = BackgroundClip

View File

@ -0,0 +1,23 @@
let Declaration = require('../declaration')
class BackgroundSize extends Declaration {
/**
* Duplication parameter for -webkit- browsers
*/
set(decl, prefix) {
let value = decl.value.toLowerCase()
if (
prefix === '-webkit-' &&
!value.includes(' ') &&
value !== 'contain' &&
value !== 'cover'
) {
decl.value = decl.value + ' ' + decl.value
}
return super.set(decl, prefix)
}
}
BackgroundSize.names = ['background-size']
module.exports = BackgroundSize

View File

@ -0,0 +1,40 @@
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-
*/
prefixed(prop, prefix) {
if (prop.includes('-start')) {
return prefix + prop.replace('-block-start', '-before')
}
return prefix + prop.replace('-block-end', '-after')
}
}
BlockLogical.names = [
'border-block-start',
'border-block-end',
'margin-block-start',
'margin-block-end',
'padding-block-start',
'padding-block-end',
'border-before',
'border-after',
'margin-before',
'margin-after',
'padding-before',
'padding-after'
]
module.exports = BlockLogical

View File

@ -0,0 +1,15 @@
let Declaration = require('../declaration')
class BorderImage extends Declaration {
/**
* Remove fill parameter for prefixed declarations
*/
set(decl, prefix) {
decl.value = decl.value.replace(/\s+fill(\s)/, '$1')
return super.set(decl, prefix)
}
}
BorderImage.names = ['border-image']
module.exports = BorderImage

View File

@ -0,0 +1,40 @@
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
*/
prefixed(prop, prefix) {
if (prefix === '-moz-') {
return prefix + (BorderRadius.toMozilla[prop] || prop)
}
return super.prefixed(prop, prefix)
}
}
BorderRadius.names = ['border-radius']
BorderRadius.toMozilla = {}
BorderRadius.toNormal = {}
for (let ver of ['top', 'bottom']) {
for (let hor of ['left', 'right']) {
let normal = `border-${ver}-${hor}-radius`
let mozilla = `border-radius-${ver}${hor}`
BorderRadius.names.push(normal)
BorderRadius.names.push(mozilla)
BorderRadius.toMozilla[normal] = mozilla
BorderRadius.toNormal[mozilla] = normal
}
}
module.exports = BorderRadius

View File

@ -0,0 +1,63 @@
let Declaration = require('../declaration')
class BreakProps extends Declaration {
/**
* Dont 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)
}
/**
* Return property name by final spec
*/
normalize(prop) {
if (prop.includes('inside')) {
return 'break-inside'
}
if (prop.includes('before')) {
return 'break-before'
}
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
*/
set(decl, prefix) {
if (
(decl.prop === 'break-inside' && decl.value === 'avoid-column') ||
decl.value === 'avoid-page'
) {
decl.value = 'avoid'
}
return super.set(decl, prefix)
}
}
BreakProps.names = [
'break-inside',
'page-break-inside',
'column-break-inside',
'break-before',
'page-break-before',
'column-break-before',
'break-after',
'page-break-after',
'column-break-after'
]
module.exports = BreakProps

View File

@ -0,0 +1,35 @@
let list = require('postcss').list
let Value = require('../value')
class CrossFade extends Value {
replace(string, prefix) {
return list
.space(string)
.map(value => {
if (value.slice(0, +this.name.length + 1) !== this.name + '(') {
return value
}
let close = value.lastIndexOf(')')
let after = value.slice(close + 1)
let args = value.slice(this.name.length + 1, close)
if (prefix === '-webkit-') {
let match = args.match(/\d*.?\d+%?/)
if (match) {
args = args.slice(match[0].length).trim()
args += `, ${match[0]}`
} else {
args += ', 0.5'
}
}
return prefix + this.name + '(' + args + ')' + after
})
.join(' ')
}
}
CrossFade.names = ['cross-fade']
module.exports = CrossFade

View File

@ -0,0 +1,65 @@
let OldValue = require('../old-value')
let Value = require('../value')
let flexSpec = require('./flex-spec')
class DisplayFlex extends Value {
constructor(name, prefixes) {
super(name, prefixes)
if (name === 'display-flex') {
this.name = 'flex'
}
}
/**
* Faster check for flex value
*/
check(decl) {
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
*/
prefixed(prefix) {
let spec, value
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
if (this.name === 'flex') {
value = 'box'
} else {
value = 'inline-box'
}
} else if (spec === 2012) {
if (this.name === 'flex') {
value = 'flexbox'
} else {
value = 'inline-flexbox'
}
} else if (spec === 'final') {
value = this.name
}
return prefix + value
}
/**
* Add prefix to value depend on flebox spec version
*/
replace(string, prefix) {
return this.prefixed(prefix)
}
}
DisplayFlex.names = ['display-flex', 'inline-flex']
module.exports = DisplayFlex

View File

@ -0,0 +1,21 @@
let Value = require('../value')
class DisplayGrid extends Value {
constructor(name, prefixes) {
super(name, prefixes)
if (name === 'display-grid') {
this.name = 'grid'
}
}
/**
* Faster check for flex value
*/
check(decl) {
return decl.prop === 'display' && decl.value === this.name
}
}
DisplayGrid.names = ['display-grid', 'inline-grid']
module.exports = DisplayGrid

View File

@ -0,0 +1,26 @@
let Selector = require('../selector')
let utils = require('../utils')
class FileSelectorButton extends Selector {
constructor(name, prefixes, all) {
super(name, prefixes, all)
if (this.prefixes) {
this.prefixes = utils.uniq(this.prefixes.map(() => '-webkit-'))
}
}
/**
* Return different selectors depend on prefix
*/
prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-file-upload-button'
}
return `::${prefix}file-selector-button`
}
}
FileSelectorButton.names = ['::file-selector-button']
module.exports = FileSelectorButton

View File

@ -0,0 +1,14 @@
let Value = require('../value')
class FilterValue extends Value {
constructor(name, prefixes) {
super(name, prefixes)
if (name === 'filter-function') {
this.name = 'filter'
}
}
}
FilterValue.names = ['filter', 'filter-function']
module.exports = FilterValue

19
app_vue/node_modules/autoprefixer/lib/hacks/filter.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
let Declaration = require('../declaration')
class Filter extends Declaration {
/**
* Check is it Internet Explorer filter
*/
check(decl) {
let v = decl.value
return (
!v.toLowerCase().includes('alpha(') &&
!v.includes('DXImageTransform.Microsoft') &&
!v.includes('data:image/svg+xml')
)
}
}
Filter.names = ['filter']
module.exports = Filter

View File

@ -0,0 +1,39 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class FlexBasis extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'flex-basis'
}
/**
* Return flex property for 2012 spec
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012) {
return prefix + 'flex-preferred-size'
}
return super.prefixed(prop, prefix)
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
set(decl, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012 || spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
FlexBasis.names = ['flex-basis', 'flex-preferred-size']
module.exports = FlexBasis

View File

@ -0,0 +1,72 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class FlexDirection extends Declaration {
/**
* Use two properties for 2009 spec
*/
insert(decl, prefix, prefixes) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec !== 2009) {
return super.insert(decl, prefix, prefixes)
}
let already = decl.parent.some(
i =>
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
)
if (already) {
return undefined
}
let v = decl.value
let dir, orient
if (v === 'inherit' || v === 'initial' || v === 'unset') {
orient = v
dir = v
} else {
orient = v.includes('row') ? 'horizontal' : 'vertical'
dir = v.includes('reverse') ? 'reverse' : 'normal'
}
let cloned = this.clone(decl)
cloned.prop = prefix + 'box-orient'
cloned.value = orient
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
}
decl.parent.insertBefore(decl, cloned)
cloned = this.clone(decl)
cloned.prop = prefix + 'box-direction'
cloned.value = dir
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
}
return decl.parent.insertBefore(decl, cloned)
}
/**
* Return property name by final spec
*/
normalize() {
return 'flex-direction'
}
/**
* Clean two properties for 2009 spec
*/
old(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return [prefix + 'box-orient', prefix + 'box-direction']
} else {
return super.old(prop, prefix)
}
}
}
FlexDirection.names = ['flex-direction', 'box-direction', 'box-orient']
module.exports = FlexDirection

View File

@ -0,0 +1,53 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class FlexFlow extends Declaration {
/**
* Use two properties for 2009 spec
*/
insert(decl, prefix, prefixes) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec !== 2009) {
return super.insert(decl, prefix, prefixes)
}
let values = decl.value
.split(/\s+/)
.filter(i => i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse')
if (values.length === 0) {
return undefined
}
let already = decl.parent.some(
i =>
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
)
if (already) {
return undefined
}
let value = values[0]
let orient = value.includes('row') ? 'horizontal' : 'vertical'
let dir = value.includes('reverse') ? 'reverse' : 'normal'
let cloned = this.clone(decl)
cloned.prop = prefix + 'box-orient'
cloned.value = orient
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
}
decl.parent.insertBefore(decl, cloned)
cloned = this.clone(decl)
cloned.prop = prefix + 'box-direction'
cloned.value = dir
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
}
return decl.parent.insertBefore(decl, cloned)
}
}
FlexFlow.names = ['flex-flow', 'box-direction', 'box-orient']
module.exports = FlexFlow

View File

@ -0,0 +1,30 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class Flex extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'flex'
}
/**
* Return flex property for 2009 and 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-flex'
}
if (spec === 2012) {
return prefix + 'flex-positive'
}
return super.prefixed(prop, prefix)
}
}
Flex.names = ['flex-grow', 'flex-positive']
module.exports = Flex

View File

@ -0,0 +1,39 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class FlexShrink extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'flex-shrink'
}
/**
* Return flex property for 2012 spec
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012) {
return prefix + 'flex-negative'
}
return super.prefixed(prop, prefix)
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
set(decl, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012 || spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
FlexShrink.names = ['flex-shrink', 'flex-negative']
module.exports = FlexShrink

View File

@ -0,0 +1,19 @@
/**
* Return flexbox spec versions by prefix
*/
module.exports = function (prefix) {
let spec
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
spec = 2009
} else if (prefix === '-ms-') {
spec = 2012
} else if (prefix === '-webkit-') {
spec = 'final'
}
if (prefix === '-webkit- 2009') {
prefix = '-webkit-'
}
return [spec, prefix]
}

View File

@ -0,0 +1,19 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class FlexWrap extends Declaration {
/**
* Don't add prefix for 2009 spec
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec !== 2009) {
return super.set(decl, prefix)
}
return undefined
}
}
FlexWrap.names = ['flex-wrap']
module.exports = FlexWrap

54
app_vue/node_modules/autoprefixer/lib/hacks/flex.js generated vendored Normal file
View File

@ -0,0 +1,54 @@
let list = require('postcss').list
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class Flex extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'flex'
}
/**
* Change property name for 2009 spec
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-flex'
}
return super.prefixed(prop, prefix)
}
/**
* Spec 2009 supports only first argument
* Spec 2012 disallows unitless basis
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2009) {
decl.value = list.space(decl.value)[0]
decl.value = Flex.oldValues[decl.value] || decl.value
return super.set(decl, prefix)
}
if (spec === 2012) {
let components = list.space(decl.value)
if (components.length === 3 && components[2] === '0') {
decl.value = components.slice(0, 2).concat('0px').join(' ')
}
}
return super.set(decl, prefix)
}
}
Flex.names = ['flex', 'box-flex']
Flex.oldValues = {
auto: '1',
none: '0'
}
module.exports = Flex

View File

@ -0,0 +1,20 @@
let Selector = require('../selector')
class Fullscreen extends Selector {
/**
* Return different selectors depend on prefix
*/
prefixed(prefix) {
if (prefix === '-webkit-') {
return ':-webkit-full-screen'
}
if (prefix === '-moz-') {
return ':-moz-full-screen'
}
return `:${prefix}fullscreen`
}
}
Fullscreen.names = [':fullscreen']
module.exports = Fullscreen

448
app_vue/node_modules/autoprefixer/lib/hacks/gradient.js generated vendored Normal file
View File

@ -0,0 +1,448 @@
let range = require('normalize-range')
let parser = require('postcss-value-parser')
let OldValue = require('../old-value')
let utils = require('../utils')
let Value = require('../value')
let IS_DIRECTION = /top|left|right|bottom/gi
class Gradient extends Value {
/**
* 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
}
/**
* Get div token from exists parameters
*/
cloneDiv(params) {
for (let i of params) {
if (i.type === 'div' && i.value === ',') {
return i
}
}
return { after: ' ', type: 'div', value: ',' }
}
/**
* Change colors syntax to old webkit
*/
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
}
/**
* Normalize angle
*/
normalize(nodes, gradientName) {
if (!nodes[0]) return nodes
if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
nodes[0].value = this.normalizeUnit(nodes[0].value, 400)
} else if (/-?\d+(.\d+)?rad/.test(nodes[0].value)) {
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI)
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
} else if (nodes[0].value.includes('deg')) {
let num = parseFloat(nodes[0].value)
num = range.wrap(0, 360, num)
nodes[0].value = `${num}deg`
}
if (
gradientName === 'linear-gradient' ||
gradientName === 'repeating-linear-gradient'
) {
let direction = nodes[0].value
// Unitless zero for `<angle>` values are allowed in CSS gradients and transforms.
// Spec: https://github.com/w3c/csswg-drafts/commit/602789171429b2231223ab1e5acf8f7f11652eb3
if (direction === '0deg' || direction === '0') {
nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
} else if (direction === '90deg') {
nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
} else if (direction === '180deg') {
nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom') // default value
} else if (direction === '270deg') {
nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
}
}
return nodes
}
/**
* Convert angle unit to deg
*/
normalizeUnit(str, full) {
let num = parseFloat(str)
let deg = (num / full) * 360
return `${deg}deg`
}
/**
* 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)
}
}
/**
* Change direction syntax to old webkit
*/
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]
}
}
/**
* Convert to old webkit syntax
*/
oldWebkit(node) {
let { nodes } = node
let string = parser.stringify(node.nodes)
if (this.name !== 'linear-gradient') {
return false
}
if (nodes[0] && nodes[0].value.includes('deg')) {
return false
}
if (
string.includes('px') ||
string.includes('-corner') ||
string.includes('-side')
) {
return false
}
let params = [[]]
for (let i of nodes) {
params[params.length - 1].push(i)
if (i.type === 'div' && i.value === ',') {
params.push([])
}
}
this.oldDirection(params)
this.colorStops(params)
node.nodes = []
for (let param of params) {
node.nodes = node.nodes.concat(param)
}
node.nodes.unshift(
{ type: 'word', value: 'linear' },
this.cloneDiv(node.nodes)
)
node.value = '-webkit-gradient'
return true
}
/**
* Change degrees for webkit 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
}
}
}
return ast.toString()
}
/**
* Replace first token
*/
replaceFirst(params, ...words) {
let prefix = words.map(i => {
if (i === ' ') {
return { type: 'space', value: i }
}
return { type: 'word', value: i }
})
return prefix.concat(params.slice(1))
}
revertDirection(word) {
return Gradient.directions[word.toLowerCase()] || word
}
/**
* Round float and save digits under dot
*/
roundFloat(float, digits) {
return parseFloat(float.toFixed(digits))
}
}
Gradient.names = [
'linear-gradient',
'repeating-linear-gradient',
'radial-gradient',
'repeating-radial-gradient'
]
Gradient.directions = {
bottom: 'top',
left: 'right',
right: 'left',
top: 'bottom' // default value
}
// 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',
'top left': 'right bottom, left top',
'top right': 'left bottom, right top'
}
module.exports = Gradient

View File

@ -0,0 +1,34 @@
let Declaration = require('../declaration')
let utils = require('./grid-utils')
class GridArea extends Declaration {
/**
* Translate grid-area to separate -ms- prefixed properties
*/
insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
let values = utils.parse(decl)
let [rowStart, rowSpan] = utils.translate(values, 0, 2)
let [columnStart, columnSpan] = utils.translate(values, 1, 3)
;[
['grid-row', rowStart],
['grid-row-span', rowSpan],
['grid-column', columnStart],
['grid-column-span', columnSpan]
].forEach(([prop, value]) => {
utils.insertDecl(decl, prop, value)
})
utils.warnTemplateSelectorNotFound(decl, result)
utils.warnIfGridRowColumnExists(decl, result)
return undefined
}
}
GridArea.names = ['grid-area']
module.exports = GridArea

View File

@ -0,0 +1,28 @@
let Declaration = require('../declaration')
class GridColumnAlign extends Declaration {
/**
* Do not prefix flexbox values
*/
check(decl) {
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'
}
}
GridColumnAlign.names = ['grid-column-align']
module.exports = GridColumnAlign

View File

@ -0,0 +1,52 @@
let Declaration = require('../declaration')
let { isPureNumber } = require('../utils')
class GridEnd extends Declaration {
/**
* Change repeating syntax for IE
*/
insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
let clonedDecl = this.clone(decl)
let startProp = decl.prop.replace(/end$/, 'start')
let spanProp = prefix + decl.prop.replace(/end$/, 'span')
if (decl.parent.some(i => i.prop === spanProp)) {
return undefined
}
clonedDecl.prop = spanProp
if (decl.value.includes('span')) {
clonedDecl.value = decl.value.replace(/span\s/i, '')
} else {
let startDecl
decl.parent.walkDecls(startProp, d => {
startDecl = d
})
if (startDecl) {
if (isPureNumber(startDecl.value)) {
let value = Number(decl.value) - Number(startDecl.value) + ''
clonedDecl.value = value
} else {
return undefined
}
} else {
decl.warn(
result,
`Can not prefix ${decl.prop} (${startProp} is not found)`
)
}
}
decl.cloneBefore(clonedDecl)
return undefined
}
}
GridEnd.names = ['grid-row-end', 'grid-column-end']
module.exports = GridEnd

View File

@ -0,0 +1,28 @@
let Declaration = require('../declaration')
class GridRowAlign extends Declaration {
/**
* Do not prefix flexbox values
*/
check(decl) {
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'
}
}
GridRowAlign.names = ['grid-row-align']
module.exports = GridRowAlign

View File

@ -0,0 +1,33 @@
let Declaration = require('../declaration')
let utils = require('./grid-utils')
class GridRowColumn extends Declaration {
/**
* Translate grid-row / grid-column to separate -ms- prefixed properties
*/
insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
let values = utils.parse(decl)
let [start, span] = utils.translate(values, 0, 1)
let hasStartValueSpan = values[0] && values[0].includes('span')
if (hasStartValueSpan) {
span = values[0].join('').replace(/\D/g, '')
}
;[
[decl.prop, start],
[`${decl.prop}-span`, span]
].forEach(([prop, value]) => {
utils.insertDecl(decl, prop, value)
})
return undefined
}
}
GridRowColumn.names = ['grid-row', 'grid-column']
module.exports = GridRowColumn

View File

@ -0,0 +1,125 @@
let Declaration = require('../declaration')
let Processor = require('../processor')
let {
autoplaceGridItems,
getGridGap,
inheritGridGap,
prefixTrackProp,
prefixTrackValue
} = require('./grid-utils')
class GridRowsColumns extends Declaration {
insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
let { parent, prop, value } = decl
let isRowProp = prop.includes('rows')
let isColumnProp = prop.includes('columns')
let hasGridTemplate = parent.some(
i => i.prop === 'grid-template' || i.prop === 'grid-template-areas'
)
/**
* Not to prefix rows declaration if grid-template(-areas) is present
*/
if (hasGridTemplate && isRowProp) {
return false
}
let processor = new Processor({ options: {} })
let status = processor.gridStatus(parent, result)
let gap = getGridGap(decl)
gap = inheritGridGap(decl, gap) || gap
let gapValue = isRowProp ? gap.row : gap.column
if ((status === 'no-autoplace' || status === true) && !hasGridTemplate) {
gapValue = null
}
let prefixValue = prefixTrackValue({
gap: gapValue,
value
})
/**
* Insert prefixes
*/
decl.cloneBefore({
prop: prefixTrackProp({ prefix, prop }),
value: prefixValue
})
let autoflow = parent.nodes.find(i => i.prop === 'grid-auto-flow')
let autoflowValue = 'row'
if (autoflow && !processor.disabled(autoflow, result)) {
autoflowValue = autoflow.value.trim()
}
if (status === 'autoplace') {
/**
* Show warning if grid-template-rows decl is not found
*/
let rowDecl = parent.nodes.find(i => i.prop === 'grid-template-rows')
if (!rowDecl && hasGridTemplate) {
return undefined
} else if (!rowDecl && !hasGridTemplate) {
decl.warn(
result,
'Autoplacement does not work without grid-template-rows property'
)
return undefined
}
/**
* Show warning if grid-template-columns decl is not found
*/
let columnDecl = parent.nodes.find(i => {
return i.prop === 'grid-template-columns'
})
if (!columnDecl && !hasGridTemplate) {
decl.warn(
result,
'Autoplacement does not work without grid-template-columns property'
)
}
/**
* Autoplace grid items
*/
if (isColumnProp && !hasGridTemplate) {
autoplaceGridItems(decl, result, gap, autoflowValue)
}
}
return undefined
}
/**
* 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 = [
'grid-template-rows',
'grid-template-columns',
'grid-rows',
'grid-columns'
]
module.exports = GridRowsColumns

View File

@ -0,0 +1,33 @@
let Declaration = require('../declaration')
class GridStart extends Declaration {
/**
* Do not add prefix for unsupported value in IE
*/
check(decl) {
let value = decl.value
return !value.includes('/') && !value.includes('span')
}
/**
* Return a final spec property
*/
normalize(prop) {
return prop.replace('-start', '')
}
/**
* Change property name for IE
*/
prefixed(prop, prefix) {
let result = super.prefixed(prop, prefix)
if (prefix === '-ms-') {
result = result.replace('-start', '')
}
return result
}
}
GridStart.names = ['grid-row-start', 'grid-column-start']
module.exports = GridStart

View File

@ -0,0 +1,84 @@
let Declaration = require('../declaration')
let {
getGridGap,
inheritGridGap,
parseGridAreas,
prefixTrackProp,
prefixTrackValue,
warnGridGap,
warnMissedAreas
} = require('./grid-utils')
function getGridRows(tpl) {
return tpl
.trim()
.slice(1, -1)
.split(/["']\s*["']?/g)
}
class GridTemplateAreas extends Declaration {
/**
* Translate grid-template-areas to separate -ms- prefixed properties
*/
insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
let hasColumns = false
let hasRows = false
let parent = decl.parent
let gap = getGridGap(decl)
gap = inheritGridGap(decl, gap) || gap
// remove already prefixed rows
// to prevent doubling prefixes
parent.walkDecls(/-ms-grid-rows/, i => i.remove())
// add empty tracks to rows
parent.walkDecls(/grid-template-(rows|columns)/, trackDecl => {
if (trackDecl.prop === 'grid-template-rows') {
hasRows = true
let { prop, value } = trackDecl
trackDecl.cloneBefore({
prop: prefixTrackProp({ prefix, prop }),
value: prefixTrackValue({ gap: gap.row, value })
})
} else {
hasColumns = true
}
})
let gridRows = getGridRows(decl.value)
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)`
})
})
}
// warnings
warnGridGap({
decl,
gap,
hasColumns,
result
})
let areas = parseGridAreas({
gap,
rows: gridRows
})
warnMissedAreas(areas, decl, result)
return decl
}
}
GridTemplateAreas.names = ['grid-template-areas']
module.exports = GridTemplateAreas

View File

@ -0,0 +1,69 @@
let Declaration = require('../declaration')
let {
getGridGap,
inheritGridGap,
parseTemplate,
warnGridGap,
warnMissedAreas
} = require('./grid-utils')
class GridTemplate extends Declaration {
/**
* Translate grid-template to separate -ms- prefixed properties
*/
insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
if (decl.parent.some(i => i.prop === '-ms-grid-rows')) {
return undefined
}
let gap = getGridGap(decl)
/**
* we must insert inherited gap values in some cases:
* if we are inside media query && if we have no grid-gap value
*/
let inheritedGap = inheritGridGap(decl, gap)
let { areas, columns, rows } = parseTemplate({
decl,
gap: inheritedGap || gap
})
let hasAreas = Object.keys(areas).length > 0
let hasRows = Boolean(rows)
let hasColumns = Boolean(columns)
warnGridGap({
decl,
gap,
hasColumns,
result
})
warnMissedAreas(areas, decl, result)
if ((hasRows && hasColumns) || hasAreas) {
decl.cloneBefore({
prop: '-ms-grid-rows',
raws: {},
value: rows
})
}
if (hasColumns) {
decl.cloneBefore({
prop: '-ms-grid-columns',
raws: {},
value: columns
})
}
return decl
}
}
GridTemplate.names = ['grid-template']
module.exports = GridTemplate

1113
app_vue/node_modules/autoprefixer/lib/hacks/grid-utils.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
let Declaration = require('../declaration')
class ImageRendering extends Declaration {
/**
* Add hack only for crisp-edges
*/
check(decl) {
return decl.value === 'pixelated'
}
/**
* Return property name by spec
*/
normalize() {
return 'image-rendering'
}
/**
* Change property name for IE
*/
prefixed(prop, prefix) {
if (prefix === '-ms-') {
return '-ms-interpolation-mode'
}
return super.prefixed(prop, prefix)
}
/**
* Warn on old value
*/
process(node, result) {
return super.process(node, result)
}
/**
* Change property and value for IE
*/
set(decl, prefix) {
if (prefix !== '-ms-') return super.set(decl, prefix)
decl.prop = '-ms-interpolation-mode'
decl.value = 'nearest-neighbor'
return decl
}
}
ImageRendering.names = ['image-rendering', 'interpolation-mode']
module.exports = ImageRendering

View File

@ -0,0 +1,18 @@
let Value = require('../value')
class ImageSet extends Value {
/**
* Use non-standard name for WebKit and Firefox
*/
replace(string, prefix) {
let fixed = super.replace(string, prefix)
if (prefix === '-webkit-') {
fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2')
}
return fixed
}
}
ImageSet.names = ['image-set']
module.exports = ImageSet

View File

@ -0,0 +1,34 @@
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', '')
}
}
InlineLogical.names = [
'border-inline-start',
'border-inline-end',
'margin-inline-start',
'margin-inline-end',
'padding-inline-start',
'padding-inline-end',
'border-start',
'border-end',
'margin-start',
'margin-end',
'padding-start',
'padding-end'
]
module.exports = InlineLogical

View File

@ -0,0 +1,61 @@
let OldValue = require('../old-value')
let Value = require('../value')
function regexp(name) {
return new RegExp(`(^|[\\s,(])(${name}($|[\\s),]))`, 'gi')
}
class Intrinsic extends Value {
add(decl, prefix) {
if (decl.prop.includes('grid') && prefix !== '-webkit-') {
return undefined
}
return super.add(decl, prefix)
}
isStretch() {
return (
this.name === 'stretch' ||
this.name === 'fill' ||
this.name === 'fill-available'
)
}
old(prefix) {
let prefixed = prefix + this.name
if (this.isStretch()) {
if (prefix === '-moz-') {
prefixed = '-moz-available'
} else if (prefix === '-webkit-') {
prefixed = '-webkit-fill-available'
}
}
return new OldValue(this.name, prefixed, prefixed, regexp(prefixed))
}
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')
}
if (prefix === '-webkit-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-webkit-fill-available$3')
}
return super.replace(string, prefix)
}
}
Intrinsic.names = [
'max-content',
'min-content',
'fit-content',
'fill',
'fill-available',
'stretch'
]
module.exports = Intrinsic

View File

@ -0,0 +1,54 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class JustifyContent extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'justify-content'
}
/**
* Change property name for 2009 and 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-pack'
}
if (spec === 2012) {
return prefix + 'flex-pack'
}
return super.prefixed(prop, prefix)
}
/**
* Change value for 2009 and 2012 specs
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2009 || spec === 2012) {
let value = JustifyContent.oldValues[decl.value] || decl.value
decl.value = value
if (spec !== 2009 || value !== 'distribute') {
return super.set(decl, prefix)
}
} else if (spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
JustifyContent.names = ['justify-content', 'flex-pack', 'box-pack']
JustifyContent.oldValues = {
'flex-end': 'end',
'flex-start': 'start',
'space-around': 'distribute',
'space-between': 'justify'
}
module.exports = JustifyContent

View File

@ -0,0 +1,38 @@
let Declaration = require('../declaration')
class MaskBorder extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return this.name.replace('box-image', 'border')
}
/**
* Return flex property for 2012 spec
*/
prefixed(prop, prefix) {
let result = super.prefixed(prop, prefix)
if (prefix === '-webkit-') {
result = result.replace('border', 'box-image')
}
return result
}
}
MaskBorder.names = [
'mask-border',
'mask-border-source',
'mask-border-slice',
'mask-border-width',
'mask-border-outset',
'mask-border-repeat',
'mask-box-image',
'mask-box-image-source',
'mask-box-image-slice',
'mask-box-image-width',
'mask-box-image-outset',
'mask-box-image-repeat'
]
module.exports = MaskBorder

View File

@ -0,0 +1,88 @@
let Declaration = require('../declaration')
class MaskComposite extends Declaration {
/**
* Prefix mask-composite for webkit
*/
insert(decl, prefix, prefixes) {
let isCompositeProp = decl.prop === 'mask-composite'
let compositeValues
if (isCompositeProp) {
compositeValues = decl.value.split(',')
} else {
compositeValues = decl.value.match(MaskComposite.regexp) || []
}
compositeValues = compositeValues.map(el => el.trim()).filter(el => el)
let hasCompositeValues = compositeValues.length
let compositeDecl
if (hasCompositeValues) {
compositeDecl = this.clone(decl)
compositeDecl.value = compositeValues
.map(value => MaskComposite.oldValues[value] || value)
.join(', ')
if (compositeValues.includes('intersect')) {
compositeDecl.value += ', xor'
}
compositeDecl.prop = prefix + 'mask-composite'
}
if (isCompositeProp) {
if (!hasCompositeValues) {
return undefined
}
if (this.needCascade(decl)) {
compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix)
}
return decl.parent.insertBefore(decl, compositeDecl)
}
let cloned = this.clone(decl)
cloned.prop = prefix + cloned.prop
if (hasCompositeValues) {
cloned.value = cloned.value.replace(MaskComposite.regexp, '')
}
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
}
decl.parent.insertBefore(decl, cloned)
if (!hasCompositeValues) {
return decl
}
if (this.needCascade(decl)) {
compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix)
}
return decl.parent.insertBefore(decl, compositeDecl)
}
}
MaskComposite.names = ['mask', 'mask-composite']
MaskComposite.oldValues = {
add: 'source-over',
exclude: 'xor',
intersect: 'source-in',
subtract: 'source-out'
}
MaskComposite.regexp = new RegExp(
`\\s+(${Object.keys(MaskComposite.oldValues).join(
'|'
)})\\b(?!\\))\\s*(?=[,])`,
'ig'
)
module.exports = MaskComposite

42
app_vue/node_modules/autoprefixer/lib/hacks/order.js generated vendored Normal file
View File

@ -0,0 +1,42 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class Order extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'order'
}
/**
* Change property name for 2009 and 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-ordinal-group'
}
if (spec === 2012) {
return prefix + 'flex-order'
}
return super.prefixed(prop, prefix)
}
/**
* Fix value for 2009 spec
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2009 && /\d/.test(decl.value)) {
decl.value = (parseInt(decl.value) + 1).toString()
return super.set(decl, prefix)
}
return super.set(decl, prefix)
}
}
Order.names = ['order', 'flex-order', 'box-ordinal-group']
module.exports = Order

View File

@ -0,0 +1,33 @@
let Declaration = require('../declaration')
class OverscrollBehavior extends Declaration {
/**
* Return property name by spec
*/
normalize() {
return 'overscroll-behavior'
}
/**
* Change property name for IE
*/
prefixed(prop, prefix) {
return prefix + 'scroll-chaining'
}
/**
* Change value for IE
*/
set(decl, prefix) {
if (decl.value === 'auto') {
decl.value = 'chained'
} else if (decl.value === 'none' || decl.value === 'contain') {
decl.value = 'none'
}
return super.set(decl, prefix)
}
}
OverscrollBehavior.names = ['overscroll-behavior', 'scroll-chaining']
module.exports = OverscrollBehavior

View File

@ -0,0 +1,34 @@
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
*/
replace(string, prefix) {
if (prefix === '-webkit-') {
return string.replace(this.regexp(), '$1-webkit-optimize-contrast')
}
if (prefix === '-moz-') {
return string.replace(this.regexp(), '$1-moz-crisp-edges')
}
return super.replace(string, prefix)
}
}
Pixelated.names = ['pixelated']
module.exports = Pixelated

View File

@ -0,0 +1,32 @@
let Declaration = require('../declaration')
let utils = require('./grid-utils')
class PlaceSelf extends Declaration {
/**
* Translate place-self to separate -ms- prefixed properties
*/
insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
// prevent doubling of prefixes
if (decl.parent.some(i => i.prop === '-ms-grid-row-align')) {
return undefined
}
let [[first, second]] = utils.parse(decl)
if (second) {
utils.insertDecl(decl, 'grid-row-align', first)
utils.insertDecl(decl, 'grid-column-align', second)
} else {
utils.insertDecl(decl, 'grid-row-align', first)
utils.insertDecl(decl, 'grid-column-align', first)
}
return undefined
}
}
PlaceSelf.names = ['place-self']
module.exports = PlaceSelf

View File

@ -0,0 +1,19 @@
let Selector = require('../selector')
class PlaceholderShown extends Selector {
/**
* Return different selectors depend on prefix
*/
prefixed(prefix) {
if (prefix === '-moz-') {
return ':-moz-placeholder'
} else if (prefix === '-ms-') {
return ':-ms-input-placeholder'
}
return `:${prefix}placeholder-shown`
}
}
PlaceholderShown.names = [':placeholder-shown']
module.exports = PlaceholderShown

View File

@ -0,0 +1,33 @@
let Selector = require('../selector')
class Placeholder extends Selector {
/**
* Add old mozilla to possible prefixes
*/
possible() {
return super.possible().concat(['-moz- old', '-ms- old'])
}
/**
* Return different selectors depend on prefix
*/
prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-input-placeholder'
}
if (prefix === '-ms-') {
return '::-ms-input-placeholder'
}
if (prefix === '-ms- old') {
return ':-ms-input-placeholder'
}
if (prefix === '-moz- old') {
return ':-moz-placeholder'
}
return `::${prefix}placeholder`
}
}
Placeholder.names = ['::placeholder']
module.exports = Placeholder

View File

@ -0,0 +1,25 @@
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
*/
prefixed(prop, prefix) {
if (prefix === '-moz-') {
return 'color-adjust'
} else {
return prefix + 'print-color-adjust'
}
}
}
PrintColorAdjust.names = ['print-color-adjust', 'color-adjust']
module.exports = PrintColorAdjust

View File

@ -0,0 +1,23 @@
let Declaration = require('../declaration')
class TextDecorationSkipInk extends Declaration {
/**
* Change prefix for ink value
*/
set(decl, prefix) {
if (decl.prop === 'text-decoration-skip-ink' && decl.value === 'auto') {
decl.prop = prefix + 'text-decoration-skip'
decl.value = 'ink'
return decl
} else {
return super.set(decl, prefix)
}
}
}
TextDecorationSkipInk.names = [
'text-decoration-skip-ink',
'text-decoration-skip'
]
module.exports = TextDecorationSkipInk

View File

@ -0,0 +1,25 @@
let Declaration = require('../declaration')
const BASIC = [
'none',
'underline',
'overline',
'line-through',
'blink',
'inherit',
'initial',
'unset'
]
class TextDecoration extends Declaration {
/**
* Do not add prefixes for basic values.
*/
check(decl) {
return decl.value.split(/\s+/).some(i => !BASIC.includes(i))
}
}
TextDecoration.names = ['text-decoration']
module.exports = TextDecoration

View File

@ -0,0 +1,14 @@
let Declaration = require('../declaration')
class TextEmphasisPosition extends Declaration {
set(decl, prefix) {
if (prefix === '-webkit-') {
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '')
}
return super.set(decl, prefix)
}
}
TextEmphasisPosition.names = ['text-emphasis-position']
module.exports = TextEmphasisPosition

View File

@ -0,0 +1,79 @@
let Declaration = require('../declaration')
class TransformDecl extends Declaration {
/**
* Is transform contain 3D commands
*/
contain3d(decl) {
if (decl.prop === 'transform-origin') {
return false
}
for (let func of TransformDecl.functions3d) {
if (decl.value.includes(`${func}(`)) {
return true
}
}
return false
}
/**
* Don't add prefix for IE in keyframes
*/
insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
if (!this.contain3d(decl) && !this.keyframeParents(decl)) {
return super.insert(decl, prefix, prefixes)
}
} else if (prefix === '-o-') {
if (!this.contain3d(decl)) {
return super.insert(decl, prefix, prefixes)
}
} else {
return super.insert(decl, prefix, prefixes)
}
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']
TransformDecl.functions3d = [
'matrix3d',
'translate3d',
'translateZ',
'scale3d',
'scaleZ',
'rotate3d',
'rotateX',
'rotateY',
'perspective'
]
module.exports = TransformDecl

View File

@ -0,0 +1,33 @@
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
*/
set(decl, prefix) {
if (prefix === '-ms-' && decl.value === 'contain') {
decl.value = 'element'
}
return super.set(decl, prefix)
}
}
UserSelect.names = ['user-select']
module.exports = UserSelect

View File

@ -0,0 +1,42 @@
let Declaration = require('../declaration')
class WritingMode extends Declaration {
insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
let cloned = this.set(this.clone(decl), prefix)
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
}
let direction = 'ltr'
decl.parent.nodes.forEach(i => {
if (i.prop === 'direction') {
if (i.value === 'rtl' || i.value === 'ltr') direction = i.value
}
})
cloned.value = WritingMode.msValues[direction][decl.value] || decl.value
return decl.parent.insertBefore(decl, cloned)
}
return super.insert(decl, prefix, prefixes)
}
}
WritingMode.names = ['writing-mode']
WritingMode.msValues = {
ltr: {
'horizontal-tb': 'lr-tb',
'vertical-lr': 'tb-lr',
'vertical-rl': 'tb-rl'
},
rtl: {
'horizontal-tb': 'rl-tb',
'vertical-lr': 'bt-lr',
'vertical-rl': 'bt-rl'
}
}
module.exports = WritingMode