create-jant 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/template/node_modules/@jant/core/CHANGELOG.md +6 -0
- package/template/node_modules/@jant/core/package.json +1 -5
- package/template/node_modules/@jant/core/src/preset.css +3 -1
- package/template/node_modules/@tailwindcss/{postcss → vite}/README.md +11 -61
- package/template/node_modules/@tailwindcss/vite/dist/index.d.mts +13 -0
- package/template/node_modules/@tailwindcss/vite/dist/index.mjs +1 -0
- package/template/node_modules/@tailwindcss/vite/node_modules/.bin/vite +21 -0
- package/template/node_modules/@tailwindcss/vite/package.json +42 -0
- package/template/package.json +1 -3
- package/template/src/style.css +0 -3
- package/template/vite.config.ts +2 -8
- package/template/node_modules/.bin/autoprefixer +0 -21
- package/template/node_modules/@jant/core/src/tailwind.ts +0 -20
- package/template/node_modules/@tailwindcss/postcss/dist/index.d.mts +0 -25
- package/template/node_modules/@tailwindcss/postcss/dist/index.d.ts +0 -25
- package/template/node_modules/@tailwindcss/postcss/dist/index.js +0 -10
- package/template/node_modules/@tailwindcss/postcss/dist/index.mjs +0 -10
- package/template/node_modules/@tailwindcss/postcss/package.json +0 -46
- package/template/node_modules/autoprefixer/LICENSE +0 -20
- package/template/node_modules/autoprefixer/README.md +0 -57
- package/template/node_modules/autoprefixer/bin/autoprefixer +0 -22
- package/template/node_modules/autoprefixer/data/prefixes.js +0 -1139
- package/template/node_modules/autoprefixer/lib/at-rule.js +0 -35
- package/template/node_modules/autoprefixer/lib/autoprefixer.d.ts +0 -95
- package/template/node_modules/autoprefixer/lib/autoprefixer.js +0 -164
- package/template/node_modules/autoprefixer/lib/brackets.js +0 -51
- package/template/node_modules/autoprefixer/lib/browsers.js +0 -79
- package/template/node_modules/autoprefixer/lib/declaration.js +0 -187
- package/template/node_modules/autoprefixer/lib/hacks/align-content.js +0 -49
- package/template/node_modules/autoprefixer/lib/hacks/align-items.js +0 -46
- package/template/node_modules/autoprefixer/lib/hacks/align-self.js +0 -56
- package/template/node_modules/autoprefixer/lib/hacks/animation.js +0 -17
- package/template/node_modules/autoprefixer/lib/hacks/appearance.js +0 -23
- package/template/node_modules/autoprefixer/lib/hacks/autofill.js +0 -26
- package/template/node_modules/autoprefixer/lib/hacks/backdrop-filter.js +0 -20
- package/template/node_modules/autoprefixer/lib/hacks/background-clip.js +0 -24
- package/template/node_modules/autoprefixer/lib/hacks/background-size.js +0 -23
- package/template/node_modules/autoprefixer/lib/hacks/block-logical.js +0 -40
- package/template/node_modules/autoprefixer/lib/hacks/border-image.js +0 -15
- package/template/node_modules/autoprefixer/lib/hacks/border-radius.js +0 -40
- package/template/node_modules/autoprefixer/lib/hacks/break-props.js +0 -63
- package/template/node_modules/autoprefixer/lib/hacks/cross-fade.js +0 -35
- package/template/node_modules/autoprefixer/lib/hacks/display-flex.js +0 -65
- package/template/node_modules/autoprefixer/lib/hacks/display-grid.js +0 -21
- package/template/node_modules/autoprefixer/lib/hacks/file-selector-button.js +0 -26
- package/template/node_modules/autoprefixer/lib/hacks/filter-value.js +0 -14
- package/template/node_modules/autoprefixer/lib/hacks/filter.js +0 -19
- package/template/node_modules/autoprefixer/lib/hacks/flex-basis.js +0 -39
- package/template/node_modules/autoprefixer/lib/hacks/flex-direction.js +0 -72
- package/template/node_modules/autoprefixer/lib/hacks/flex-flow.js +0 -53
- package/template/node_modules/autoprefixer/lib/hacks/flex-grow.js +0 -30
- package/template/node_modules/autoprefixer/lib/hacks/flex-shrink.js +0 -39
- package/template/node_modules/autoprefixer/lib/hacks/flex-spec.js +0 -19
- package/template/node_modules/autoprefixer/lib/hacks/flex-wrap.js +0 -19
- package/template/node_modules/autoprefixer/lib/hacks/flex.js +0 -54
- package/template/node_modules/autoprefixer/lib/hacks/fullscreen.js +0 -20
- package/template/node_modules/autoprefixer/lib/hacks/gradient.js +0 -447
- package/template/node_modules/autoprefixer/lib/hacks/grid-area.js +0 -34
- package/template/node_modules/autoprefixer/lib/hacks/grid-column-align.js +0 -28
- package/template/node_modules/autoprefixer/lib/hacks/grid-end.js +0 -52
- package/template/node_modules/autoprefixer/lib/hacks/grid-row-align.js +0 -28
- package/template/node_modules/autoprefixer/lib/hacks/grid-row-column.js +0 -33
- package/template/node_modules/autoprefixer/lib/hacks/grid-rows-columns.js +0 -125
- package/template/node_modules/autoprefixer/lib/hacks/grid-start.js +0 -33
- package/template/node_modules/autoprefixer/lib/hacks/grid-template-areas.js +0 -84
- package/template/node_modules/autoprefixer/lib/hacks/grid-template.js +0 -69
- package/template/node_modules/autoprefixer/lib/hacks/grid-utils.js +0 -1117
- package/template/node_modules/autoprefixer/lib/hacks/image-rendering.js +0 -48
- package/template/node_modules/autoprefixer/lib/hacks/image-set.js +0 -18
- package/template/node_modules/autoprefixer/lib/hacks/inline-logical.js +0 -34
- package/template/node_modules/autoprefixer/lib/hacks/intrinsic.js +0 -61
- package/template/node_modules/autoprefixer/lib/hacks/justify-content.js +0 -54
- package/template/node_modules/autoprefixer/lib/hacks/mask-border.js +0 -38
- package/template/node_modules/autoprefixer/lib/hacks/mask-composite.js +0 -88
- package/template/node_modules/autoprefixer/lib/hacks/order.js +0 -42
- package/template/node_modules/autoprefixer/lib/hacks/overscroll-behavior.js +0 -33
- package/template/node_modules/autoprefixer/lib/hacks/pixelated.js +0 -34
- package/template/node_modules/autoprefixer/lib/hacks/place-self.js +0 -32
- package/template/node_modules/autoprefixer/lib/hacks/placeholder-shown.js +0 -19
- package/template/node_modules/autoprefixer/lib/hacks/placeholder.js +0 -33
- package/template/node_modules/autoprefixer/lib/hacks/print-color-adjust.js +0 -25
- package/template/node_modules/autoprefixer/lib/hacks/text-decoration-skip-ink.js +0 -23
- package/template/node_modules/autoprefixer/lib/hacks/text-decoration.js +0 -25
- package/template/node_modules/autoprefixer/lib/hacks/text-emphasis-position.js +0 -14
- package/template/node_modules/autoprefixer/lib/hacks/transform-decl.js +0 -79
- package/template/node_modules/autoprefixer/lib/hacks/user-select.js +0 -33
- package/template/node_modules/autoprefixer/lib/hacks/writing-mode.js +0 -42
- package/template/node_modules/autoprefixer/lib/info.js +0 -123
- package/template/node_modules/autoprefixer/lib/old-selector.js +0 -67
- package/template/node_modules/autoprefixer/lib/old-value.js +0 -22
- package/template/node_modules/autoprefixer/lib/prefixer.js +0 -144
- package/template/node_modules/autoprefixer/lib/prefixes.js +0 -428
- package/template/node_modules/autoprefixer/lib/processor.js +0 -709
- package/template/node_modules/autoprefixer/lib/resolution.js +0 -97
- package/template/node_modules/autoprefixer/lib/selector.js +0 -150
- package/template/node_modules/autoprefixer/lib/supports.js +0 -302
- package/template/node_modules/autoprefixer/lib/transition.js +0 -329
- package/template/node_modules/autoprefixer/lib/utils.js +0 -93
- package/template/node_modules/autoprefixer/lib/value.js +0 -125
- package/template/node_modules/autoprefixer/lib/vendor.js +0 -14
- package/template/node_modules/autoprefixer/node_modules/.bin/autoprefixer +0 -21
- package/template/node_modules/autoprefixer/node_modules/.bin/browserslist +0 -21
- package/template/node_modules/autoprefixer/package.json +0 -48
- package/template/node_modules/postcss/LICENSE +0 -20
- package/template/node_modules/postcss/README.md +0 -29
- package/template/node_modules/postcss/lib/at-rule.d.ts +0 -140
- package/template/node_modules/postcss/lib/at-rule.js +0 -25
- package/template/node_modules/postcss/lib/comment.d.ts +0 -68
- package/template/node_modules/postcss/lib/comment.js +0 -13
- package/template/node_modules/postcss/lib/container.d.ts +0 -483
- package/template/node_modules/postcss/lib/container.js +0 -447
- package/template/node_modules/postcss/lib/css-syntax-error.d.ts +0 -248
- package/template/node_modules/postcss/lib/css-syntax-error.js +0 -133
- package/template/node_modules/postcss/lib/declaration.d.ts +0 -151
- package/template/node_modules/postcss/lib/declaration.js +0 -24
- package/template/node_modules/postcss/lib/document.d.ts +0 -69
- package/template/node_modules/postcss/lib/document.js +0 -33
- package/template/node_modules/postcss/lib/fromJSON.d.ts +0 -9
- package/template/node_modules/postcss/lib/fromJSON.js +0 -54
- package/template/node_modules/postcss/lib/input.d.ts +0 -227
- package/template/node_modules/postcss/lib/input.js +0 -265
- package/template/node_modules/postcss/lib/lazy-result.d.ts +0 -190
- package/template/node_modules/postcss/lib/lazy-result.js +0 -550
- package/template/node_modules/postcss/lib/list.d.ts +0 -60
- package/template/node_modules/postcss/lib/list.js +0 -58
- package/template/node_modules/postcss/lib/map-generator.js +0 -368
- package/template/node_modules/postcss/lib/no-work-result.d.ts +0 -46
- package/template/node_modules/postcss/lib/no-work-result.js +0 -138
- package/template/node_modules/postcss/lib/node.d.ts +0 -556
- package/template/node_modules/postcss/lib/node.js +0 -449
- package/template/node_modules/postcss/lib/parse.d.ts +0 -9
- package/template/node_modules/postcss/lib/parse.js +0 -42
- package/template/node_modules/postcss/lib/parser.js +0 -611
- package/template/node_modules/postcss/lib/postcss.d.mts +0 -69
- package/template/node_modules/postcss/lib/postcss.d.ts +0 -458
- package/template/node_modules/postcss/lib/postcss.js +0 -101
- package/template/node_modules/postcss/lib/postcss.mjs +0 -30
- package/template/node_modules/postcss/lib/previous-map.d.ts +0 -81
- package/template/node_modules/postcss/lib/previous-map.js +0 -144
- package/template/node_modules/postcss/lib/processor.d.ts +0 -115
- package/template/node_modules/postcss/lib/processor.js +0 -67
- package/template/node_modules/postcss/lib/result.d.ts +0 -205
- package/template/node_modules/postcss/lib/result.js +0 -42
- package/template/node_modules/postcss/lib/root.d.ts +0 -87
- package/template/node_modules/postcss/lib/root.js +0 -61
- package/template/node_modules/postcss/lib/rule.d.ts +0 -126
- package/template/node_modules/postcss/lib/rule.js +0 -27
- package/template/node_modules/postcss/lib/stringifier.d.ts +0 -46
- package/template/node_modules/postcss/lib/stringifier.js +0 -353
- package/template/node_modules/postcss/lib/stringify.d.ts +0 -9
- package/template/node_modules/postcss/lib/stringify.js +0 -11
- package/template/node_modules/postcss/lib/symbols.js +0 -5
- package/template/node_modules/postcss/lib/terminal-highlight.js +0 -70
- package/template/node_modules/postcss/lib/tokenize.js +0 -266
- package/template/node_modules/postcss/lib/warn-once.js +0 -13
- package/template/node_modules/postcss/lib/warning.d.ts +0 -147
- package/template/node_modules/postcss/lib/warning.js +0 -37
- package/template/node_modules/postcss/node_modules/.bin/nanoid +0 -21
- package/template/node_modules/postcss/package.json +0 -88
- package/template/tailwind.config.ts +0 -13
- /package/template/node_modules/@tailwindcss/{postcss → vite}/LICENSE +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
let Declaration = require('../declaration')
|
|
2
|
-
let flexSpec = require('./flex-spec')
|
|
3
|
-
|
|
4
|
-
class FlexFlow extends Declaration {
|
|
5
|
-
/**
|
|
6
|
-
* Use two properties for 2009 spec
|
|
7
|
-
*/
|
|
8
|
-
insert(decl, prefix, prefixes) {
|
|
9
|
-
let spec
|
|
10
|
-
;[spec, prefix] = flexSpec(prefix)
|
|
11
|
-
if (spec !== 2009) {
|
|
12
|
-
return super.insert(decl, prefix, prefixes)
|
|
13
|
-
}
|
|
14
|
-
let values = decl.value
|
|
15
|
-
.split(/\s+/)
|
|
16
|
-
.filter(i => i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse')
|
|
17
|
-
if (values.length === 0) {
|
|
18
|
-
return undefined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let already = decl.parent.some(
|
|
22
|
-
i =>
|
|
23
|
-
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
|
|
24
|
-
)
|
|
25
|
-
if (already) {
|
|
26
|
-
return undefined
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let value = values[0]
|
|
30
|
-
let orient = value.includes('row') ? 'horizontal' : 'vertical'
|
|
31
|
-
let dir = value.includes('reverse') ? 'reverse' : 'normal'
|
|
32
|
-
|
|
33
|
-
let cloned = this.clone(decl)
|
|
34
|
-
cloned.prop = prefix + 'box-orient'
|
|
35
|
-
cloned.value = orient
|
|
36
|
-
if (this.needCascade(decl)) {
|
|
37
|
-
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
|
38
|
-
}
|
|
39
|
-
decl.parent.insertBefore(decl, cloned)
|
|
40
|
-
|
|
41
|
-
cloned = this.clone(decl)
|
|
42
|
-
cloned.prop = prefix + 'box-direction'
|
|
43
|
-
cloned.value = dir
|
|
44
|
-
if (this.needCascade(decl)) {
|
|
45
|
-
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
|
46
|
-
}
|
|
47
|
-
return decl.parent.insertBefore(decl, cloned)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
FlexFlow.names = ['flex-flow', 'box-direction', 'box-orient']
|
|
52
|
-
|
|
53
|
-
module.exports = FlexFlow
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
let Declaration = require('../declaration')
|
|
2
|
-
let flexSpec = require('./flex-spec')
|
|
3
|
-
|
|
4
|
-
class Flex extends Declaration {
|
|
5
|
-
/**
|
|
6
|
-
* Return property name by final spec
|
|
7
|
-
*/
|
|
8
|
-
normalize() {
|
|
9
|
-
return 'flex'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Return flex property for 2009 and 2012 specs
|
|
14
|
-
*/
|
|
15
|
-
prefixed(prop, prefix) {
|
|
16
|
-
let spec
|
|
17
|
-
;[spec, prefix] = flexSpec(prefix)
|
|
18
|
-
if (spec === 2009) {
|
|
19
|
-
return prefix + 'box-flex'
|
|
20
|
-
}
|
|
21
|
-
if (spec === 2012) {
|
|
22
|
-
return prefix + 'flex-positive'
|
|
23
|
-
}
|
|
24
|
-
return super.prefixed(prop, prefix)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
Flex.names = ['flex-grow', 'flex-positive']
|
|
29
|
-
|
|
30
|
-
module.exports = Flex
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
let Declaration = require('../declaration')
|
|
2
|
-
let flexSpec = require('./flex-spec')
|
|
3
|
-
|
|
4
|
-
class FlexShrink extends Declaration {
|
|
5
|
-
/**
|
|
6
|
-
* Return property name by final spec
|
|
7
|
-
*/
|
|
8
|
-
normalize() {
|
|
9
|
-
return 'flex-shrink'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Return flex property for 2012 spec
|
|
14
|
-
*/
|
|
15
|
-
prefixed(prop, prefix) {
|
|
16
|
-
let spec
|
|
17
|
-
;[spec, prefix] = flexSpec(prefix)
|
|
18
|
-
if (spec === 2012) {
|
|
19
|
-
return prefix + 'flex-negative'
|
|
20
|
-
}
|
|
21
|
-
return super.prefixed(prop, prefix)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Ignore 2009 spec and use flex property for 2012
|
|
26
|
-
*/
|
|
27
|
-
set(decl, prefix) {
|
|
28
|
-
let spec
|
|
29
|
-
;[spec, prefix] = flexSpec(prefix)
|
|
30
|
-
if (spec === 2012 || spec === 'final') {
|
|
31
|
-
return super.set(decl, prefix)
|
|
32
|
-
}
|
|
33
|
-
return undefined
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
FlexShrink.names = ['flex-shrink', 'flex-negative']
|
|
38
|
-
|
|
39
|
-
module.exports = FlexShrink
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return flexbox spec versions by prefix
|
|
3
|
-
*/
|
|
4
|
-
module.exports = function (prefix) {
|
|
5
|
-
let spec
|
|
6
|
-
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
|
|
7
|
-
spec = 2009
|
|
8
|
-
} else if (prefix === '-ms-') {
|
|
9
|
-
spec = 2012
|
|
10
|
-
} else if (prefix === '-webkit-') {
|
|
11
|
-
spec = 'final'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (prefix === '-webkit- 2009') {
|
|
15
|
-
prefix = '-webkit-'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return [spec, prefix]
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
let Declaration = require('../declaration')
|
|
2
|
-
let flexSpec = require('./flex-spec')
|
|
3
|
-
|
|
4
|
-
class FlexWrap extends Declaration {
|
|
5
|
-
/**
|
|
6
|
-
* Don't add prefix for 2009 spec
|
|
7
|
-
*/
|
|
8
|
-
set(decl, prefix) {
|
|
9
|
-
let spec = flexSpec(prefix)[0]
|
|
10
|
-
if (spec !== 2009) {
|
|
11
|
-
return super.set(decl, prefix)
|
|
12
|
-
}
|
|
13
|
-
return undefined
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
FlexWrap.names = ['flex-wrap']
|
|
18
|
-
|
|
19
|
-
module.exports = FlexWrap
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
let list = require('postcss').list
|
|
2
|
-
|
|
3
|
-
let Declaration = require('../declaration')
|
|
4
|
-
let flexSpec = require('./flex-spec')
|
|
5
|
-
|
|
6
|
-
class Flex extends Declaration {
|
|
7
|
-
/**
|
|
8
|
-
* Return property name by final spec
|
|
9
|
-
*/
|
|
10
|
-
normalize() {
|
|
11
|
-
return 'flex'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Change property name for 2009 spec
|
|
16
|
-
*/
|
|
17
|
-
prefixed(prop, prefix) {
|
|
18
|
-
let spec
|
|
19
|
-
;[spec, prefix] = flexSpec(prefix)
|
|
20
|
-
if (spec === 2009) {
|
|
21
|
-
return prefix + 'box-flex'
|
|
22
|
-
}
|
|
23
|
-
return super.prefixed(prop, prefix)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Spec 2009 supports only first argument
|
|
28
|
-
* Spec 2012 disallows unitless basis
|
|
29
|
-
*/
|
|
30
|
-
set(decl, prefix) {
|
|
31
|
-
let spec = flexSpec(prefix)[0]
|
|
32
|
-
if (spec === 2009) {
|
|
33
|
-
decl.value = list.space(decl.value)[0]
|
|
34
|
-
decl.value = Flex.oldValues[decl.value] || decl.value
|
|
35
|
-
return super.set(decl, prefix)
|
|
36
|
-
}
|
|
37
|
-
if (spec === 2012) {
|
|
38
|
-
let components = list.space(decl.value)
|
|
39
|
-
if (components.length === 3 && components[2] === '0') {
|
|
40
|
-
decl.value = components.slice(0, 2).concat('0px').join(' ')
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return super.set(decl, prefix)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Flex.names = ['flex', 'box-flex']
|
|
48
|
-
|
|
49
|
-
Flex.oldValues = {
|
|
50
|
-
auto: '1',
|
|
51
|
-
none: '0'
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
module.exports = Flex
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
let Selector = require('../selector')
|
|
2
|
-
|
|
3
|
-
class Fullscreen extends Selector {
|
|
4
|
-
/**
|
|
5
|
-
* Return different selectors depend on prefix
|
|
6
|
-
*/
|
|
7
|
-
prefixed(prefix) {
|
|
8
|
-
if (prefix === '-webkit-') {
|
|
9
|
-
return ':-webkit-full-screen'
|
|
10
|
-
}
|
|
11
|
-
if (prefix === '-moz-') {
|
|
12
|
-
return ':-moz-full-screen'
|
|
13
|
-
}
|
|
14
|
-
return `:${prefix}fullscreen`
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Fullscreen.names = [':fullscreen']
|
|
19
|
-
|
|
20
|
-
module.exports = Fullscreen
|
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
let parser = require('postcss-value-parser')
|
|
2
|
-
|
|
3
|
-
let OldValue = require('../old-value')
|
|
4
|
-
let utils = require('../utils')
|
|
5
|
-
let Value = require('../value')
|
|
6
|
-
|
|
7
|
-
let IS_DIRECTION = /top|left|right|bottom/gi
|
|
8
|
-
|
|
9
|
-
class Gradient extends Value {
|
|
10
|
-
/**
|
|
11
|
-
* Do not add non-webkit prefixes for list-style and object
|
|
12
|
-
*/
|
|
13
|
-
add(decl, prefix) {
|
|
14
|
-
let p = decl.prop
|
|
15
|
-
if (p.includes('mask')) {
|
|
16
|
-
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
17
|
-
return super.add(decl, prefix)
|
|
18
|
-
}
|
|
19
|
-
} else if (
|
|
20
|
-
p === 'list-style' ||
|
|
21
|
-
p === 'list-style-image' ||
|
|
22
|
-
p === 'content'
|
|
23
|
-
) {
|
|
24
|
-
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
|
25
|
-
return super.add(decl, prefix)
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
return super.add(decl, prefix)
|
|
29
|
-
}
|
|
30
|
-
return undefined
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Get div token from exists parameters
|
|
35
|
-
*/
|
|
36
|
-
cloneDiv(params) {
|
|
37
|
-
for (let i of params) {
|
|
38
|
-
if (i.type === 'div' && i.value === ',') {
|
|
39
|
-
return i
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return { after: ' ', type: 'div', value: ',' }
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Change colors syntax to old webkit
|
|
47
|
-
*/
|
|
48
|
-
colorStops(params) {
|
|
49
|
-
let result = []
|
|
50
|
-
for (let i = 0; i < params.length; i++) {
|
|
51
|
-
let pos
|
|
52
|
-
let param = params[i]
|
|
53
|
-
let item
|
|
54
|
-
if (i === 0) {
|
|
55
|
-
continue
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let color = parser.stringify(param[0])
|
|
59
|
-
if (param[1] && param[1].type === 'word') {
|
|
60
|
-
pos = param[1].value
|
|
61
|
-
} else if (param[2] && param[2].type === 'word') {
|
|
62
|
-
pos = param[2].value
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let stop
|
|
66
|
-
if (i === 1 && (!pos || pos === '0%')) {
|
|
67
|
-
stop = `from(${color})`
|
|
68
|
-
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
|
|
69
|
-
stop = `to(${color})`
|
|
70
|
-
} else if (pos) {
|
|
71
|
-
stop = `color-stop(${pos}, ${color})`
|
|
72
|
-
} else {
|
|
73
|
-
stop = `color-stop(${color})`
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
let div = param[param.length - 1]
|
|
77
|
-
params[i] = [{ type: 'word', value: stop }]
|
|
78
|
-
if (div.type === 'div' && div.value === ',') {
|
|
79
|
-
item = params[i].push(div)
|
|
80
|
-
}
|
|
81
|
-
result.push(item)
|
|
82
|
-
}
|
|
83
|
-
return result
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Change new direction to old
|
|
88
|
-
*/
|
|
89
|
-
convertDirection(params) {
|
|
90
|
-
if (params.length > 0) {
|
|
91
|
-
if (params[0].value === 'to') {
|
|
92
|
-
this.fixDirection(params)
|
|
93
|
-
} else if (params[0].value.includes('deg')) {
|
|
94
|
-
this.fixAngle(params)
|
|
95
|
-
} else if (this.isRadial(params)) {
|
|
96
|
-
this.fixRadial(params)
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return params
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Add 90 degrees
|
|
104
|
-
*/
|
|
105
|
-
fixAngle(params) {
|
|
106
|
-
let first = params[0].value
|
|
107
|
-
first = parseFloat(first)
|
|
108
|
-
first = Math.abs(450 - first) % 360
|
|
109
|
-
first = this.roundFloat(first, 3)
|
|
110
|
-
params[0].value = `${first}deg`
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Replace `to top left` to `bottom right`
|
|
115
|
-
*/
|
|
116
|
-
fixDirection(params) {
|
|
117
|
-
params.splice(0, 2)
|
|
118
|
-
|
|
119
|
-
for (let param of params) {
|
|
120
|
-
if (param.type === 'div') {
|
|
121
|
-
break
|
|
122
|
-
}
|
|
123
|
-
if (param.type === 'word') {
|
|
124
|
-
param.value = this.revertDirection(param.value)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Fix radial direction syntax
|
|
131
|
-
*/
|
|
132
|
-
fixRadial(params) {
|
|
133
|
-
let first = []
|
|
134
|
-
let second = []
|
|
135
|
-
let a, b, c, i, next
|
|
136
|
-
|
|
137
|
-
for (i = 0; i < params.length - 2; i++) {
|
|
138
|
-
a = params[i]
|
|
139
|
-
b = params[i + 1]
|
|
140
|
-
c = params[i + 2]
|
|
141
|
-
if (a.type === 'space' && b.value === 'at' && c.type === 'space') {
|
|
142
|
-
next = i + 3
|
|
143
|
-
break
|
|
144
|
-
} else {
|
|
145
|
-
first.push(a)
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let div
|
|
150
|
-
for (i = next; i < params.length; i++) {
|
|
151
|
-
if (params[i].type === 'div') {
|
|
152
|
-
div = params[i]
|
|
153
|
-
break
|
|
154
|
-
} else {
|
|
155
|
-
second.push(params[i])
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
params.splice(0, i, ...second, div, ...first)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Look for at word
|
|
164
|
-
*/
|
|
165
|
-
isRadial(params) {
|
|
166
|
-
let state = 'before'
|
|
167
|
-
for (let param of params) {
|
|
168
|
-
if (state === 'before' && param.type === 'space') {
|
|
169
|
-
state = 'at'
|
|
170
|
-
} else if (state === 'at' && param.value === 'at') {
|
|
171
|
-
state = 'after'
|
|
172
|
-
} else if (state === 'after' && param.type === 'space') {
|
|
173
|
-
return true
|
|
174
|
-
} else if (param.type === 'div') {
|
|
175
|
-
break
|
|
176
|
-
} else {
|
|
177
|
-
state = 'before'
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return false
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Replace old direction to new
|
|
185
|
-
*/
|
|
186
|
-
newDirection(params) {
|
|
187
|
-
if (params[0].value === 'to') {
|
|
188
|
-
return params
|
|
189
|
-
}
|
|
190
|
-
IS_DIRECTION.lastIndex = 0 // reset search index of global regexp
|
|
191
|
-
if (!IS_DIRECTION.test(params[0].value)) {
|
|
192
|
-
return params
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
params.unshift(
|
|
196
|
-
{
|
|
197
|
-
type: 'word',
|
|
198
|
-
value: 'to'
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
type: 'space',
|
|
202
|
-
value: ' '
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
for (let i = 2; i < params.length; i++) {
|
|
207
|
-
if (params[i].type === 'div') {
|
|
208
|
-
break
|
|
209
|
-
}
|
|
210
|
-
if (params[i].type === 'word') {
|
|
211
|
-
params[i].value = this.revertDirection(params[i].value)
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return params
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Normalize angle
|
|
220
|
-
*/
|
|
221
|
-
normalize(nodes, gradientName) {
|
|
222
|
-
if (!nodes[0]) return nodes
|
|
223
|
-
|
|
224
|
-
if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
|
|
225
|
-
nodes[0].value = this.normalizeUnit(nodes[0].value, 400)
|
|
226
|
-
} else if (/-?\d+(.\d+)?rad/.test(nodes[0].value)) {
|
|
227
|
-
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI)
|
|
228
|
-
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
|
|
229
|
-
nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
|
|
230
|
-
} else if (nodes[0].value.includes('deg')) {
|
|
231
|
-
let num = parseFloat(nodes[0].value)
|
|
232
|
-
num = (num % 360 + 360) % 360
|
|
233
|
-
nodes[0].value = `${num}deg`
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
gradientName === 'linear-gradient' ||
|
|
238
|
-
gradientName === 'repeating-linear-gradient'
|
|
239
|
-
) {
|
|
240
|
-
let direction = nodes[0].value
|
|
241
|
-
|
|
242
|
-
// Unitless zero for `<angle>` values are allowed in CSS gradients and transforms.
|
|
243
|
-
// Spec: https://github.com/w3c/csswg-drafts/commit/602789171429b2231223ab1e5acf8f7f11652eb3
|
|
244
|
-
if (direction === '0deg' || direction === '0') {
|
|
245
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
|
|
246
|
-
} else if (direction === '90deg') {
|
|
247
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
|
|
248
|
-
} else if (direction === '180deg') {
|
|
249
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom') // default value
|
|
250
|
-
} else if (direction === '270deg') {
|
|
251
|
-
nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return nodes
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Convert angle unit to deg
|
|
260
|
-
*/
|
|
261
|
-
normalizeUnit(str, full) {
|
|
262
|
-
let num = parseFloat(str)
|
|
263
|
-
let deg = (num / full) * 360
|
|
264
|
-
return `${deg}deg`
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Remove old WebKit gradient too
|
|
269
|
-
*/
|
|
270
|
-
old(prefix) {
|
|
271
|
-
if (prefix === '-webkit-') {
|
|
272
|
-
let type
|
|
273
|
-
if (this.name === 'linear-gradient') {
|
|
274
|
-
type = 'linear'
|
|
275
|
-
} else if (this.name === 'repeating-linear-gradient') {
|
|
276
|
-
type = 'repeating-linear'
|
|
277
|
-
} else if (this.name === 'repeating-radial-gradient') {
|
|
278
|
-
type = 'repeating-radial'
|
|
279
|
-
} else {
|
|
280
|
-
type = 'radial'
|
|
281
|
-
}
|
|
282
|
-
let string = '-gradient'
|
|
283
|
-
let regexp = utils.regexp(
|
|
284
|
-
`-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
|
|
285
|
-
false
|
|
286
|
-
)
|
|
287
|
-
|
|
288
|
-
return new OldValue(this.name, prefix + this.name, string, regexp)
|
|
289
|
-
} else {
|
|
290
|
-
return super.old(prefix)
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Change direction syntax to old webkit
|
|
296
|
-
*/
|
|
297
|
-
oldDirection(params) {
|
|
298
|
-
let div = this.cloneDiv(params[0])
|
|
299
|
-
|
|
300
|
-
if (params[0][0].value !== 'to') {
|
|
301
|
-
return params.unshift([
|
|
302
|
-
{ type: 'word', value: Gradient.oldDirections.bottom },
|
|
303
|
-
div
|
|
304
|
-
])
|
|
305
|
-
} else {
|
|
306
|
-
let words = []
|
|
307
|
-
for (let node of params[0].slice(2)) {
|
|
308
|
-
if (node.type === 'word') {
|
|
309
|
-
words.push(node.value.toLowerCase())
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
words = words.join(' ')
|
|
314
|
-
let old = Gradient.oldDirections[words] || words
|
|
315
|
-
|
|
316
|
-
params[0] = [{ type: 'word', value: old }, div]
|
|
317
|
-
return params[0]
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Convert to old webkit syntax
|
|
323
|
-
*/
|
|
324
|
-
oldWebkit(node) {
|
|
325
|
-
let { nodes } = node
|
|
326
|
-
let string = parser.stringify(node.nodes)
|
|
327
|
-
|
|
328
|
-
if (this.name !== 'linear-gradient') {
|
|
329
|
-
return false
|
|
330
|
-
}
|
|
331
|
-
if (nodes[0] && nodes[0].value.includes('deg')) {
|
|
332
|
-
return false
|
|
333
|
-
}
|
|
334
|
-
if (
|
|
335
|
-
string.includes('px') ||
|
|
336
|
-
string.includes('-corner') ||
|
|
337
|
-
string.includes('-side')
|
|
338
|
-
) {
|
|
339
|
-
return false
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
let params = [[]]
|
|
343
|
-
for (let i of nodes) {
|
|
344
|
-
params[params.length - 1].push(i)
|
|
345
|
-
if (i.type === 'div' && i.value === ',') {
|
|
346
|
-
params.push([])
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
this.oldDirection(params)
|
|
351
|
-
this.colorStops(params)
|
|
352
|
-
|
|
353
|
-
node.nodes = []
|
|
354
|
-
for (let param of params) {
|
|
355
|
-
node.nodes.push(...param)
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
node.nodes.unshift(
|
|
359
|
-
{ type: 'word', value: 'linear' },
|
|
360
|
-
this.cloneDiv(node.nodes)
|
|
361
|
-
)
|
|
362
|
-
node.value = '-webkit-gradient'
|
|
363
|
-
|
|
364
|
-
return true
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Change degrees for webkit prefix
|
|
369
|
-
*/
|
|
370
|
-
replace(string, prefix) {
|
|
371
|
-
let ast = parser(string)
|
|
372
|
-
for (let node of ast.nodes) {
|
|
373
|
-
let gradientName = this.name // gradient name
|
|
374
|
-
if (node.type === 'function' && node.value === gradientName) {
|
|
375
|
-
node.nodes = this.newDirection(node.nodes)
|
|
376
|
-
node.nodes = this.normalize(node.nodes, gradientName)
|
|
377
|
-
if (prefix === '-webkit- old') {
|
|
378
|
-
let changes = this.oldWebkit(node)
|
|
379
|
-
if (!changes) {
|
|
380
|
-
return false
|
|
381
|
-
}
|
|
382
|
-
} else {
|
|
383
|
-
node.nodes = this.convertDirection(node.nodes)
|
|
384
|
-
node.value = prefix + node.value
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return ast.toString()
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Replace first token
|
|
393
|
-
*/
|
|
394
|
-
replaceFirst(params, ...words) {
|
|
395
|
-
let prefix = words.map(i => {
|
|
396
|
-
if (i === ' ') {
|
|
397
|
-
return { type: 'space', value: i }
|
|
398
|
-
}
|
|
399
|
-
return { type: 'word', value: i }
|
|
400
|
-
})
|
|
401
|
-
return prefix.concat(params.slice(1))
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
revertDirection(word) {
|
|
405
|
-
return Gradient.directions[word.toLowerCase()] || word
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Round float and save digits under dot
|
|
410
|
-
*/
|
|
411
|
-
roundFloat(float, digits) {
|
|
412
|
-
return parseFloat(float.toFixed(digits))
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
Gradient.names = [
|
|
417
|
-
'linear-gradient',
|
|
418
|
-
'repeating-linear-gradient',
|
|
419
|
-
'radial-gradient',
|
|
420
|
-
'repeating-radial-gradient'
|
|
421
|
-
]
|
|
422
|
-
|
|
423
|
-
Gradient.directions = {
|
|
424
|
-
bottom: 'top',
|
|
425
|
-
left: 'right',
|
|
426
|
-
right: 'left',
|
|
427
|
-
top: 'bottom' // default value
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// Direction to replace
|
|
431
|
-
Gradient.oldDirections = {
|
|
432
|
-
'bottom': 'left top, left bottom',
|
|
433
|
-
'bottom left': 'right top, left bottom',
|
|
434
|
-
'bottom right': 'left top, right bottom',
|
|
435
|
-
'left': 'right top, left top',
|
|
436
|
-
|
|
437
|
-
'left bottom': 'right top, left bottom',
|
|
438
|
-
'left top': 'right bottom, left top',
|
|
439
|
-
'right': 'left top, right top',
|
|
440
|
-
'right bottom': 'left top, right bottom',
|
|
441
|
-
'right top': 'left bottom, right top',
|
|
442
|
-
'top': 'left bottom, left top',
|
|
443
|
-
'top left': 'right bottom, left top',
|
|
444
|
-
'top right': 'left bottom, right top'
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
module.exports = Gradient
|