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.
Files changed (163) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/template/node_modules/@jant/core/CHANGELOG.md +6 -0
  4. package/template/node_modules/@jant/core/package.json +1 -5
  5. package/template/node_modules/@jant/core/src/preset.css +3 -1
  6. package/template/node_modules/@tailwindcss/{postcss → vite}/README.md +11 -61
  7. package/template/node_modules/@tailwindcss/vite/dist/index.d.mts +13 -0
  8. package/template/node_modules/@tailwindcss/vite/dist/index.mjs +1 -0
  9. package/template/node_modules/@tailwindcss/vite/node_modules/.bin/vite +21 -0
  10. package/template/node_modules/@tailwindcss/vite/package.json +42 -0
  11. package/template/package.json +1 -3
  12. package/template/src/style.css +0 -3
  13. package/template/vite.config.ts +2 -8
  14. package/template/node_modules/.bin/autoprefixer +0 -21
  15. package/template/node_modules/@jant/core/src/tailwind.ts +0 -20
  16. package/template/node_modules/@tailwindcss/postcss/dist/index.d.mts +0 -25
  17. package/template/node_modules/@tailwindcss/postcss/dist/index.d.ts +0 -25
  18. package/template/node_modules/@tailwindcss/postcss/dist/index.js +0 -10
  19. package/template/node_modules/@tailwindcss/postcss/dist/index.mjs +0 -10
  20. package/template/node_modules/@tailwindcss/postcss/package.json +0 -46
  21. package/template/node_modules/autoprefixer/LICENSE +0 -20
  22. package/template/node_modules/autoprefixer/README.md +0 -57
  23. package/template/node_modules/autoprefixer/bin/autoprefixer +0 -22
  24. package/template/node_modules/autoprefixer/data/prefixes.js +0 -1139
  25. package/template/node_modules/autoprefixer/lib/at-rule.js +0 -35
  26. package/template/node_modules/autoprefixer/lib/autoprefixer.d.ts +0 -95
  27. package/template/node_modules/autoprefixer/lib/autoprefixer.js +0 -164
  28. package/template/node_modules/autoprefixer/lib/brackets.js +0 -51
  29. package/template/node_modules/autoprefixer/lib/browsers.js +0 -79
  30. package/template/node_modules/autoprefixer/lib/declaration.js +0 -187
  31. package/template/node_modules/autoprefixer/lib/hacks/align-content.js +0 -49
  32. package/template/node_modules/autoprefixer/lib/hacks/align-items.js +0 -46
  33. package/template/node_modules/autoprefixer/lib/hacks/align-self.js +0 -56
  34. package/template/node_modules/autoprefixer/lib/hacks/animation.js +0 -17
  35. package/template/node_modules/autoprefixer/lib/hacks/appearance.js +0 -23
  36. package/template/node_modules/autoprefixer/lib/hacks/autofill.js +0 -26
  37. package/template/node_modules/autoprefixer/lib/hacks/backdrop-filter.js +0 -20
  38. package/template/node_modules/autoprefixer/lib/hacks/background-clip.js +0 -24
  39. package/template/node_modules/autoprefixer/lib/hacks/background-size.js +0 -23
  40. package/template/node_modules/autoprefixer/lib/hacks/block-logical.js +0 -40
  41. package/template/node_modules/autoprefixer/lib/hacks/border-image.js +0 -15
  42. package/template/node_modules/autoprefixer/lib/hacks/border-radius.js +0 -40
  43. package/template/node_modules/autoprefixer/lib/hacks/break-props.js +0 -63
  44. package/template/node_modules/autoprefixer/lib/hacks/cross-fade.js +0 -35
  45. package/template/node_modules/autoprefixer/lib/hacks/display-flex.js +0 -65
  46. package/template/node_modules/autoprefixer/lib/hacks/display-grid.js +0 -21
  47. package/template/node_modules/autoprefixer/lib/hacks/file-selector-button.js +0 -26
  48. package/template/node_modules/autoprefixer/lib/hacks/filter-value.js +0 -14
  49. package/template/node_modules/autoprefixer/lib/hacks/filter.js +0 -19
  50. package/template/node_modules/autoprefixer/lib/hacks/flex-basis.js +0 -39
  51. package/template/node_modules/autoprefixer/lib/hacks/flex-direction.js +0 -72
  52. package/template/node_modules/autoprefixer/lib/hacks/flex-flow.js +0 -53
  53. package/template/node_modules/autoprefixer/lib/hacks/flex-grow.js +0 -30
  54. package/template/node_modules/autoprefixer/lib/hacks/flex-shrink.js +0 -39
  55. package/template/node_modules/autoprefixer/lib/hacks/flex-spec.js +0 -19
  56. package/template/node_modules/autoprefixer/lib/hacks/flex-wrap.js +0 -19
  57. package/template/node_modules/autoprefixer/lib/hacks/flex.js +0 -54
  58. package/template/node_modules/autoprefixer/lib/hacks/fullscreen.js +0 -20
  59. package/template/node_modules/autoprefixer/lib/hacks/gradient.js +0 -447
  60. package/template/node_modules/autoprefixer/lib/hacks/grid-area.js +0 -34
  61. package/template/node_modules/autoprefixer/lib/hacks/grid-column-align.js +0 -28
  62. package/template/node_modules/autoprefixer/lib/hacks/grid-end.js +0 -52
  63. package/template/node_modules/autoprefixer/lib/hacks/grid-row-align.js +0 -28
  64. package/template/node_modules/autoprefixer/lib/hacks/grid-row-column.js +0 -33
  65. package/template/node_modules/autoprefixer/lib/hacks/grid-rows-columns.js +0 -125
  66. package/template/node_modules/autoprefixer/lib/hacks/grid-start.js +0 -33
  67. package/template/node_modules/autoprefixer/lib/hacks/grid-template-areas.js +0 -84
  68. package/template/node_modules/autoprefixer/lib/hacks/grid-template.js +0 -69
  69. package/template/node_modules/autoprefixer/lib/hacks/grid-utils.js +0 -1117
  70. package/template/node_modules/autoprefixer/lib/hacks/image-rendering.js +0 -48
  71. package/template/node_modules/autoprefixer/lib/hacks/image-set.js +0 -18
  72. package/template/node_modules/autoprefixer/lib/hacks/inline-logical.js +0 -34
  73. package/template/node_modules/autoprefixer/lib/hacks/intrinsic.js +0 -61
  74. package/template/node_modules/autoprefixer/lib/hacks/justify-content.js +0 -54
  75. package/template/node_modules/autoprefixer/lib/hacks/mask-border.js +0 -38
  76. package/template/node_modules/autoprefixer/lib/hacks/mask-composite.js +0 -88
  77. package/template/node_modules/autoprefixer/lib/hacks/order.js +0 -42
  78. package/template/node_modules/autoprefixer/lib/hacks/overscroll-behavior.js +0 -33
  79. package/template/node_modules/autoprefixer/lib/hacks/pixelated.js +0 -34
  80. package/template/node_modules/autoprefixer/lib/hacks/place-self.js +0 -32
  81. package/template/node_modules/autoprefixer/lib/hacks/placeholder-shown.js +0 -19
  82. package/template/node_modules/autoprefixer/lib/hacks/placeholder.js +0 -33
  83. package/template/node_modules/autoprefixer/lib/hacks/print-color-adjust.js +0 -25
  84. package/template/node_modules/autoprefixer/lib/hacks/text-decoration-skip-ink.js +0 -23
  85. package/template/node_modules/autoprefixer/lib/hacks/text-decoration.js +0 -25
  86. package/template/node_modules/autoprefixer/lib/hacks/text-emphasis-position.js +0 -14
  87. package/template/node_modules/autoprefixer/lib/hacks/transform-decl.js +0 -79
  88. package/template/node_modules/autoprefixer/lib/hacks/user-select.js +0 -33
  89. package/template/node_modules/autoprefixer/lib/hacks/writing-mode.js +0 -42
  90. package/template/node_modules/autoprefixer/lib/info.js +0 -123
  91. package/template/node_modules/autoprefixer/lib/old-selector.js +0 -67
  92. package/template/node_modules/autoprefixer/lib/old-value.js +0 -22
  93. package/template/node_modules/autoprefixer/lib/prefixer.js +0 -144
  94. package/template/node_modules/autoprefixer/lib/prefixes.js +0 -428
  95. package/template/node_modules/autoprefixer/lib/processor.js +0 -709
  96. package/template/node_modules/autoprefixer/lib/resolution.js +0 -97
  97. package/template/node_modules/autoprefixer/lib/selector.js +0 -150
  98. package/template/node_modules/autoprefixer/lib/supports.js +0 -302
  99. package/template/node_modules/autoprefixer/lib/transition.js +0 -329
  100. package/template/node_modules/autoprefixer/lib/utils.js +0 -93
  101. package/template/node_modules/autoprefixer/lib/value.js +0 -125
  102. package/template/node_modules/autoprefixer/lib/vendor.js +0 -14
  103. package/template/node_modules/autoprefixer/node_modules/.bin/autoprefixer +0 -21
  104. package/template/node_modules/autoprefixer/node_modules/.bin/browserslist +0 -21
  105. package/template/node_modules/autoprefixer/package.json +0 -48
  106. package/template/node_modules/postcss/LICENSE +0 -20
  107. package/template/node_modules/postcss/README.md +0 -29
  108. package/template/node_modules/postcss/lib/at-rule.d.ts +0 -140
  109. package/template/node_modules/postcss/lib/at-rule.js +0 -25
  110. package/template/node_modules/postcss/lib/comment.d.ts +0 -68
  111. package/template/node_modules/postcss/lib/comment.js +0 -13
  112. package/template/node_modules/postcss/lib/container.d.ts +0 -483
  113. package/template/node_modules/postcss/lib/container.js +0 -447
  114. package/template/node_modules/postcss/lib/css-syntax-error.d.ts +0 -248
  115. package/template/node_modules/postcss/lib/css-syntax-error.js +0 -133
  116. package/template/node_modules/postcss/lib/declaration.d.ts +0 -151
  117. package/template/node_modules/postcss/lib/declaration.js +0 -24
  118. package/template/node_modules/postcss/lib/document.d.ts +0 -69
  119. package/template/node_modules/postcss/lib/document.js +0 -33
  120. package/template/node_modules/postcss/lib/fromJSON.d.ts +0 -9
  121. package/template/node_modules/postcss/lib/fromJSON.js +0 -54
  122. package/template/node_modules/postcss/lib/input.d.ts +0 -227
  123. package/template/node_modules/postcss/lib/input.js +0 -265
  124. package/template/node_modules/postcss/lib/lazy-result.d.ts +0 -190
  125. package/template/node_modules/postcss/lib/lazy-result.js +0 -550
  126. package/template/node_modules/postcss/lib/list.d.ts +0 -60
  127. package/template/node_modules/postcss/lib/list.js +0 -58
  128. package/template/node_modules/postcss/lib/map-generator.js +0 -368
  129. package/template/node_modules/postcss/lib/no-work-result.d.ts +0 -46
  130. package/template/node_modules/postcss/lib/no-work-result.js +0 -138
  131. package/template/node_modules/postcss/lib/node.d.ts +0 -556
  132. package/template/node_modules/postcss/lib/node.js +0 -449
  133. package/template/node_modules/postcss/lib/parse.d.ts +0 -9
  134. package/template/node_modules/postcss/lib/parse.js +0 -42
  135. package/template/node_modules/postcss/lib/parser.js +0 -611
  136. package/template/node_modules/postcss/lib/postcss.d.mts +0 -69
  137. package/template/node_modules/postcss/lib/postcss.d.ts +0 -458
  138. package/template/node_modules/postcss/lib/postcss.js +0 -101
  139. package/template/node_modules/postcss/lib/postcss.mjs +0 -30
  140. package/template/node_modules/postcss/lib/previous-map.d.ts +0 -81
  141. package/template/node_modules/postcss/lib/previous-map.js +0 -144
  142. package/template/node_modules/postcss/lib/processor.d.ts +0 -115
  143. package/template/node_modules/postcss/lib/processor.js +0 -67
  144. package/template/node_modules/postcss/lib/result.d.ts +0 -205
  145. package/template/node_modules/postcss/lib/result.js +0 -42
  146. package/template/node_modules/postcss/lib/root.d.ts +0 -87
  147. package/template/node_modules/postcss/lib/root.js +0 -61
  148. package/template/node_modules/postcss/lib/rule.d.ts +0 -126
  149. package/template/node_modules/postcss/lib/rule.js +0 -27
  150. package/template/node_modules/postcss/lib/stringifier.d.ts +0 -46
  151. package/template/node_modules/postcss/lib/stringifier.js +0 -353
  152. package/template/node_modules/postcss/lib/stringify.d.ts +0 -9
  153. package/template/node_modules/postcss/lib/stringify.js +0 -11
  154. package/template/node_modules/postcss/lib/symbols.js +0 -5
  155. package/template/node_modules/postcss/lib/terminal-highlight.js +0 -70
  156. package/template/node_modules/postcss/lib/tokenize.js +0 -266
  157. package/template/node_modules/postcss/lib/warn-once.js +0 -13
  158. package/template/node_modules/postcss/lib/warning.d.ts +0 -147
  159. package/template/node_modules/postcss/lib/warning.js +0 -37
  160. package/template/node_modules/postcss/node_modules/.bin/nanoid +0 -21
  161. package/template/node_modules/postcss/package.json +0 -88
  162. package/template/tailwind.config.ts +0 -13
  163. /package/template/node_modules/@tailwindcss/{postcss → vite}/LICENSE +0 -0
@@ -1,709 +0,0 @@
1
- let parser = require('postcss-value-parser')
2
-
3
- let Value = require('./value')
4
- let insertAreas = require('./hacks/grid-utils').insertAreas
5
-
6
- const OLD_LINEAR = /(^|[^-])linear-gradient\(\s*(top|left|right|bottom)/i
7
- const OLD_RADIAL = /(^|[^-])radial-gradient\(\s*\d+(\w*|%)\s+\d+(\w*|%)\s*,/i
8
- const IGNORE_NEXT = /(!\s*)?autoprefixer:\s*ignore\s+next/i
9
- const GRID_REGEX = /(!\s*)?autoprefixer\s*grid:\s*(on|off|(no-)?autoplace)/i
10
-
11
- const SIZES = [
12
- 'width',
13
- 'height',
14
- 'min-width',
15
- 'max-width',
16
- 'min-height',
17
- 'max-height',
18
- 'inline-size',
19
- 'min-inline-size',
20
- 'max-inline-size',
21
- 'block-size',
22
- 'min-block-size',
23
- 'max-block-size'
24
- ]
25
-
26
- function hasGridTemplate(decl) {
27
- return decl.parent.some(
28
- i => i.prop === 'grid-template' || i.prop === 'grid-template-areas'
29
- )
30
- }
31
-
32
- function hasRowsAndColumns(decl) {
33
- let hasRows = decl.parent.some(i => i.prop === 'grid-template-rows')
34
- let hasColumns = decl.parent.some(i => i.prop === 'grid-template-columns')
35
- return hasRows && hasColumns
36
- }
37
-
38
- class Processor {
39
- constructor(prefixes) {
40
- this.prefixes = prefixes
41
- }
42
-
43
- /**
44
- * Add necessary prefixes
45
- */
46
- add(css, result) {
47
- // At-rules
48
- let resolution = this.prefixes.add['@resolution']
49
- let keyframes = this.prefixes.add['@keyframes']
50
- let viewport = this.prefixes.add['@viewport']
51
- let supports = this.prefixes.add['@supports']
52
-
53
- css.walkAtRules(rule => {
54
- if (rule.name === 'keyframes') {
55
- if (!this.disabled(rule, result)) {
56
- return keyframes && keyframes.process(rule)
57
- }
58
- } else if (rule.name === 'viewport') {
59
- if (!this.disabled(rule, result)) {
60
- return viewport && viewport.process(rule)
61
- }
62
- } else if (rule.name === 'supports') {
63
- if (
64
- this.prefixes.options.supports !== false &&
65
- !this.disabled(rule, result)
66
- ) {
67
- return supports.process(rule)
68
- }
69
- } else if (rule.name === 'media' && rule.params.includes('-resolution')) {
70
- if (!this.disabled(rule, result)) {
71
- return resolution && resolution.process(rule)
72
- }
73
- }
74
-
75
- return undefined
76
- })
77
-
78
- // Selectors
79
- css.walkRules(rule => {
80
- if (this.disabled(rule, result)) return undefined
81
-
82
- return this.prefixes.add.selectors.map(selector => {
83
- return selector.process(rule, result)
84
- })
85
- })
86
-
87
- function insideGrid(decl) {
88
- return decl.parent.nodes.some(node => {
89
- if (node.type !== 'decl') return false
90
- let displayGrid =
91
- node.prop === 'display' && /(inline-)?grid/.test(node.value)
92
- let gridTemplate = node.prop.startsWith('grid-template')
93
- let gridGap = /^grid-([A-z]+-)?gap/.test(node.prop)
94
- return displayGrid || gridTemplate || gridGap
95
- })
96
- }
97
-
98
- let gridPrefixes =
99
- this.gridStatus(css, result) &&
100
- this.prefixes.add['grid-area'] &&
101
- this.prefixes.add['grid-area'].prefixes
102
-
103
- css.walkDecls(decl => {
104
- if (this.disabledDecl(decl, result)) return undefined
105
-
106
- let parent = decl.parent
107
- let prop = decl.prop
108
- let value = decl.value
109
-
110
- if (prop === 'color-adjust') {
111
- if (parent.every(i => i.prop !== 'print-color-adjust')) {
112
- result.warn(
113
- 'Replace color-adjust to print-color-adjust. ' +
114
- 'The color-adjust shorthand is currently deprecated.',
115
- { node: decl }
116
- )
117
- }
118
- } else if (prop === 'grid-row-span') {
119
- result.warn(
120
- 'grid-row-span is not part of final Grid Layout. Use grid-row.',
121
- { node: decl }
122
- )
123
- return undefined
124
- } else if (prop === 'grid-column-span') {
125
- result.warn(
126
- 'grid-column-span is not part of final Grid Layout. Use grid-column.',
127
- { node: decl }
128
- )
129
- return undefined
130
- } else if (prop === 'display' && value === 'box') {
131
- result.warn(
132
- 'You should write display: flex by final spec ' +
133
- 'instead of display: box',
134
- { node: decl }
135
- )
136
- return undefined
137
- } else if (prop === 'text-emphasis-position') {
138
- if (value === 'under' || value === 'over') {
139
- result.warn(
140
- 'You should use 2 values for text-emphasis-position ' +
141
- 'For example, `under left` instead of just `under`.',
142
- { node: decl }
143
- )
144
- }
145
- } else if (prop === 'text-decoration-skip' && value === 'ink') {
146
- result.warn(
147
- 'Replace text-decoration-skip: ink to ' +
148
- 'text-decoration-skip-ink: auto, because spec had been changed',
149
- { node: decl }
150
- )
151
- } else {
152
- if (gridPrefixes && this.gridStatus(decl, result)) {
153
- if (decl.value === 'subgrid') {
154
- result.warn('IE does not support subgrid', { node: decl })
155
- }
156
- if (/^(align|justify|place)-items$/.test(prop) && insideGrid(decl)) {
157
- let fixed = prop.replace('-items', '-self')
158
- result.warn(
159
- `IE does not support ${prop} on grid containers. ` +
160
- `Try using ${fixed} on child elements instead: ` +
161
- `${decl.parent.selector} > * { ${fixed}: ${decl.value} }`,
162
- { node: decl }
163
- )
164
- } else if (
165
- /^(align|justify|place)-content$/.test(prop) &&
166
- insideGrid(decl)
167
- ) {
168
- result.warn(`IE does not support ${decl.prop} on grid containers`, {
169
- node: decl
170
- })
171
- } else if (prop === 'display' && decl.value === 'contents') {
172
- result.warn(
173
- 'Please do not use display: contents; ' +
174
- 'if you have grid setting enabled',
175
- { node: decl }
176
- )
177
- return undefined
178
- } else if (decl.prop === 'grid-gap') {
179
- let status = this.gridStatus(decl, result)
180
- if (
181
- status === 'autoplace' &&
182
- !hasRowsAndColumns(decl) &&
183
- !hasGridTemplate(decl)
184
- ) {
185
- result.warn(
186
- 'grid-gap only works if grid-template(-areas) is being ' +
187
- 'used or both rows and columns have been declared ' +
188
- 'and cells have not been manually ' +
189
- 'placed inside the explicit grid',
190
- { node: decl }
191
- )
192
- } else if (
193
- (status === true || status === 'no-autoplace') &&
194
- !hasGridTemplate(decl)
195
- ) {
196
- result.warn(
197
- 'grid-gap only works if grid-template(-areas) is being used',
198
- { node: decl }
199
- )
200
- }
201
- } else if (prop === 'grid-auto-columns') {
202
- result.warn('grid-auto-columns is not supported by IE', {
203
- node: decl
204
- })
205
- return undefined
206
- } else if (prop === 'grid-auto-rows') {
207
- result.warn('grid-auto-rows is not supported by IE', { node: decl })
208
- return undefined
209
- } else if (prop === 'grid-auto-flow') {
210
- let hasRows = parent.some(i => i.prop === 'grid-template-rows')
211
- let hasCols = parent.some(i => i.prop === 'grid-template-columns')
212
-
213
- if (hasGridTemplate(decl)) {
214
- result.warn('grid-auto-flow is not supported by IE', {
215
- node: decl
216
- })
217
- } else if (value.includes('dense')) {
218
- result.warn('grid-auto-flow: dense is not supported by IE', {
219
- node: decl
220
- })
221
- } else if (!hasRows && !hasCols) {
222
- result.warn(
223
- 'grid-auto-flow works only if grid-template-rows and ' +
224
- 'grid-template-columns are present in the same rule',
225
- { node: decl }
226
- )
227
- }
228
- return undefined
229
- } else if (value.includes('auto-fit')) {
230
- result.warn('auto-fit value is not supported by IE', {
231
- node: decl,
232
- word: 'auto-fit'
233
- })
234
- return undefined
235
- } else if (value.includes('auto-fill')) {
236
- result.warn('auto-fill value is not supported by IE', {
237
- node: decl,
238
- word: 'auto-fill'
239
- })
240
- return undefined
241
- } else if (prop.startsWith('grid-template') && value.includes('[')) {
242
- result.warn(
243
- 'Autoprefixer currently does not support line names. ' +
244
- 'Try using grid-template-areas instead.',
245
- { node: decl, word: '[' }
246
- )
247
- }
248
- }
249
- if (value.includes('radial-gradient')) {
250
- if (OLD_RADIAL.test(decl.value)) {
251
- result.warn(
252
- 'Gradient has outdated direction syntax. ' +
253
- 'New syntax is like `closest-side at 0 0` ' +
254
- 'instead of `0 0, closest-side`.',
255
- { node: decl }
256
- )
257
- } else {
258
- let ast = parser(value)
259
-
260
- for (let i of ast.nodes) {
261
- if (i.type === 'function' && i.value === 'radial-gradient') {
262
- for (let word of i.nodes) {
263
- if (word.type === 'word') {
264
- if (word.value === 'cover') {
265
- result.warn(
266
- 'Gradient has outdated direction syntax. ' +
267
- 'Replace `cover` to `farthest-corner`.',
268
- { node: decl }
269
- )
270
- } else if (word.value === 'contain') {
271
- result.warn(
272
- 'Gradient has outdated direction syntax. ' +
273
- 'Replace `contain` to `closest-side`.',
274
- { node: decl }
275
- )
276
- }
277
- }
278
- }
279
- }
280
- }
281
- }
282
- }
283
- if (value.includes('linear-gradient')) {
284
- if (OLD_LINEAR.test(value)) {
285
- result.warn(
286
- 'Gradient has outdated direction syntax. ' +
287
- 'New syntax is like `to left` instead of `right`.',
288
- { node: decl }
289
- )
290
- }
291
- }
292
- }
293
-
294
- if (SIZES.includes(decl.prop)) {
295
- if (!decl.value.includes('-fill-available')) {
296
- if (decl.value.includes('fill-available')) {
297
- result.warn(
298
- 'Replace fill-available to stretch, ' +
299
- 'because spec had been changed',
300
- { node: decl }
301
- )
302
- } else if (decl.value.includes('fill')) {
303
- let ast = parser(value)
304
- if (ast.nodes.some(i => i.type === 'word' && i.value === 'fill')) {
305
- result.warn(
306
- 'Replace fill to stretch, because spec had been changed',
307
- { node: decl }
308
- )
309
- }
310
- }
311
- }
312
- }
313
-
314
- let prefixer
315
-
316
- if (decl.prop === 'transition' || decl.prop === 'transition-property') {
317
- // Transition
318
- return this.prefixes.transition.add(decl, result)
319
- } else if (decl.prop === 'align-self') {
320
- // align-self flexbox or grid
321
- let display = this.displayType(decl)
322
- if (display !== 'grid' && this.prefixes.options.flexbox !== false) {
323
- prefixer = this.prefixes.add['align-self']
324
- if (prefixer && prefixer.prefixes) {
325
- prefixer.process(decl)
326
- }
327
- }
328
- if (this.gridStatus(decl, result) !== false) {
329
- prefixer = this.prefixes.add['grid-row-align']
330
- if (prefixer && prefixer.prefixes) {
331
- return prefixer.process(decl, result)
332
- }
333
- }
334
- } else if (decl.prop === 'justify-self') {
335
- // justify-self flexbox or grid
336
- if (this.gridStatus(decl, result) !== false) {
337
- prefixer = this.prefixes.add['grid-column-align']
338
- if (prefixer && prefixer.prefixes) {
339
- return prefixer.process(decl, result)
340
- }
341
- }
342
- } else if (decl.prop === 'place-self') {
343
- prefixer = this.prefixes.add['place-self']
344
- if (
345
- prefixer &&
346
- prefixer.prefixes &&
347
- this.gridStatus(decl, result) !== false
348
- ) {
349
- return prefixer.process(decl, result)
350
- }
351
- } else {
352
- // Properties
353
- prefixer = this.prefixes.add[decl.prop]
354
- if (prefixer && prefixer.prefixes) {
355
- return prefixer.process(decl, result)
356
- }
357
- }
358
-
359
- return undefined
360
- })
361
-
362
- // Insert grid-area prefixes. We need to be able to store the different
363
- // rules as a data and hack API is not enough for this
364
- if (this.gridStatus(css, result)) {
365
- insertAreas(css, this.disabled)
366
- }
367
-
368
- // Values
369
- return css.walkDecls(decl => {
370
- if (this.disabledValue(decl, result)) return
371
-
372
- let unprefixed = this.prefixes.unprefixed(decl.prop)
373
- let list = this.prefixes.values('add', unprefixed)
374
- if (Array.isArray(list)) {
375
- for (let value of list) {
376
- if (value.process) value.process(decl, result)
377
- }
378
- }
379
- Value.save(this.prefixes, decl)
380
- })
381
- }
382
-
383
- /**
384
- * Check for control comment and global options
385
- */
386
- disabled(node, result) {
387
- if (!node) return false
388
-
389
- if (node._autoprefixerDisabled !== undefined) {
390
- return node._autoprefixerDisabled
391
- }
392
-
393
- if (node.parent) {
394
- let p = node.prev()
395
- if (p && p.type === 'comment' && IGNORE_NEXT.test(p.text)) {
396
- node._autoprefixerDisabled = true
397
- node._autoprefixerSelfDisabled = true
398
- return true
399
- }
400
- }
401
-
402
- let value = null
403
- if (node.nodes) {
404
- let status
405
- node.each(i => {
406
- if (i.type !== 'comment') return
407
- if (/(!\s*)?autoprefixer:\s*(off|on)/i.test(i.text)) {
408
- if (typeof status !== 'undefined') {
409
- result.warn(
410
- 'Second Autoprefixer control comment ' +
411
- 'was ignored. Autoprefixer applies control ' +
412
- 'comment to whole block, not to next rules.',
413
- { node: i }
414
- )
415
- } else {
416
- status = /on/i.test(i.text)
417
- }
418
- }
419
- })
420
-
421
- if (status !== undefined) {
422
- value = !status
423
- }
424
- }
425
- if (!node.nodes || value === null) {
426
- if (node.parent) {
427
- let isParentDisabled = this.disabled(node.parent, result)
428
- if (node.parent._autoprefixerSelfDisabled === true) {
429
- value = false
430
- } else {
431
- value = isParentDisabled
432
- }
433
- } else {
434
- value = false
435
- }
436
- }
437
- node._autoprefixerDisabled = value
438
- return value
439
- }
440
-
441
- /**
442
- * Check for grid/flexbox options.
443
- */
444
- disabledDecl(node, result) {
445
- if (node.type === 'decl' && this.gridStatus(node, result) === false) {
446
- if (node.prop.includes('grid') || node.prop === 'justify-items') {
447
- return true
448
- }
449
- }
450
- if (node.type === 'decl' && this.prefixes.options.flexbox === false) {
451
- let other = ['order', 'justify-content', 'align-items', 'align-content']
452
- if (node.prop.includes('flex') || other.includes(node.prop)) {
453
- return true
454
- }
455
- }
456
-
457
- return this.disabled(node, result)
458
- }
459
-
460
- /**
461
- * Check for grid/flexbox options.
462
- */
463
- disabledValue(node, result) {
464
- if (this.gridStatus(node, result) === false && node.type === 'decl') {
465
- if (node.prop === 'display' && node.value.includes('grid')) {
466
- return true
467
- }
468
- }
469
- if (this.prefixes.options.flexbox === false && node.type === 'decl') {
470
- if (node.prop === 'display' && node.value.includes('flex')) {
471
- return true
472
- }
473
- }
474
- if (node.type === 'decl' && node.prop === 'content') {
475
- return true
476
- }
477
-
478
- return this.disabled(node, result)
479
- }
480
-
481
- /**
482
- * Is it flebox or grid rule
483
- */
484
- displayType(decl) {
485
- for (let i of decl.parent.nodes) {
486
- if (i.prop !== 'display') {
487
- continue
488
- }
489
-
490
- if (i.value.includes('flex')) {
491
- return 'flex'
492
- }
493
-
494
- if (i.value.includes('grid')) {
495
- return 'grid'
496
- }
497
- }
498
-
499
- return false
500
- }
501
-
502
- /**
503
- * Set grid option via control comment
504
- */
505
- gridStatus(node, result) {
506
- if (!node) return false
507
-
508
- if (node._autoprefixerGridStatus !== undefined) {
509
- return node._autoprefixerGridStatus
510
- }
511
-
512
- let value = null
513
- if (node.nodes) {
514
- let status
515
- node.each(i => {
516
- if (i.type !== 'comment') return
517
- if (GRID_REGEX.test(i.text)) {
518
- let hasAutoplace = /:\s*autoplace/i.test(i.text)
519
- let noAutoplace = /no-autoplace/i.test(i.text)
520
- if (typeof status !== 'undefined') {
521
- result.warn(
522
- 'Second Autoprefixer grid control comment was ' +
523
- 'ignored. Autoprefixer applies control comments to the whole ' +
524
- 'block, not to the next rules.',
525
- { node: i }
526
- )
527
- } else if (hasAutoplace) {
528
- status = 'autoplace'
529
- } else if (noAutoplace) {
530
- status = true
531
- } else {
532
- status = /on/i.test(i.text)
533
- }
534
- }
535
- })
536
-
537
- if (status !== undefined) {
538
- value = status
539
- }
540
- }
541
-
542
- if (node.type === 'atrule' && node.name === 'supports') {
543
- let params = node.params
544
- if (params.includes('grid') && params.includes('auto')) {
545
- value = false
546
- }
547
- }
548
-
549
- if (!node.nodes || value === null) {
550
- if (node.parent) {
551
- let isParentGrid = this.gridStatus(node.parent, result)
552
- if (node.parent._autoprefixerSelfDisabled === true) {
553
- value = false
554
- } else {
555
- value = isParentGrid
556
- }
557
- } else if (typeof this.prefixes.options.grid !== 'undefined') {
558
- value = this.prefixes.options.grid
559
- } else if (typeof process.env.AUTOPREFIXER_GRID !== 'undefined') {
560
- if (process.env.AUTOPREFIXER_GRID === 'autoplace') {
561
- value = 'autoplace'
562
- } else {
563
- value = true
564
- }
565
- } else {
566
- value = false
567
- }
568
- }
569
-
570
- node._autoprefixerGridStatus = value
571
- return value
572
- }
573
-
574
- /**
575
- * Normalize spaces in cascade declaration group
576
- */
577
- reduceSpaces(decl) {
578
- let stop = false
579
- this.prefixes.group(decl).up(() => {
580
- stop = true
581
- return true
582
- })
583
- if (stop) {
584
- return
585
- }
586
-
587
- let parts = decl.raw('before').split('\n')
588
- let prevMin = parts[parts.length - 1].length
589
- let diff = false
590
-
591
- this.prefixes.group(decl).down(other => {
592
- parts = other.raw('before').split('\n')
593
- let last = parts.length - 1
594
-
595
- if (parts[last].length > prevMin) {
596
- if (diff === false) {
597
- diff = parts[last].length - prevMin
598
- }
599
-
600
- parts[last] = parts[last].slice(0, -diff)
601
- other.raws.before = parts.join('\n')
602
- }
603
- })
604
- }
605
-
606
- /**
607
- * Remove unnecessary pefixes
608
- */
609
- remove(css, result) {
610
- // At-rules
611
- let resolution = this.prefixes.remove['@resolution']
612
-
613
- css.walkAtRules((rule, i) => {
614
- if (this.prefixes.remove[`@${rule.name}`]) {
615
- if (!this.disabled(rule, result)) {
616
- rule.parent.removeChild(i)
617
- }
618
- } else if (
619
- rule.name === 'media' &&
620
- rule.params.includes('-resolution') &&
621
- resolution
622
- ) {
623
- resolution.clean(rule)
624
- }
625
- })
626
-
627
- // Selectors
628
- css.walkRules((rule, i) => {
629
- if (this.disabled(rule, result)) return
630
-
631
- for (let checker of this.prefixes.remove.selectors) {
632
- if (checker.check(rule)) {
633
- rule.parent.removeChild(i)
634
- return
635
- }
636
- }
637
- })
638
-
639
- return css.walkDecls((decl, i) => {
640
- if (this.disabled(decl, result)) return
641
-
642
- let rule = decl.parent
643
- let unprefixed = this.prefixes.unprefixed(decl.prop)
644
-
645
- // Transition
646
- if (decl.prop === 'transition' || decl.prop === 'transition-property') {
647
- this.prefixes.transition.remove(decl)
648
- }
649
-
650
- // Properties
651
- if (
652
- this.prefixes.remove[decl.prop] &&
653
- this.prefixes.remove[decl.prop].remove
654
- ) {
655
- let notHack = this.prefixes.group(decl).down(other => {
656
- return this.prefixes.normalize(other.prop) === unprefixed
657
- })
658
-
659
- if (unprefixed === 'flex-flow') {
660
- notHack = true
661
- }
662
-
663
- if (decl.prop === '-webkit-box-orient') {
664
- let hacks = { 'flex-direction': true, 'flex-flow': true }
665
- if (!decl.parent.some(j => hacks[j.prop])) return
666
- }
667
-
668
- if (notHack && !this.withHackValue(decl)) {
669
- if (decl.raw('before').includes('\n')) {
670
- this.reduceSpaces(decl)
671
- }
672
- rule.removeChild(i)
673
- return
674
- }
675
- }
676
-
677
- // Values
678
- for (let checker of this.prefixes.values('remove', unprefixed)) {
679
- if (!checker.check) continue
680
- if (!checker.check(decl.value)) continue
681
-
682
- unprefixed = checker.unprefixed
683
- let notHack = this.prefixes.group(decl).down(other => {
684
- return other.value.includes(unprefixed)
685
- })
686
-
687
- if (notHack) {
688
- rule.removeChild(i)
689
- return
690
- }
691
- }
692
- })
693
- }
694
-
695
- /**
696
- * Some rare old values, which is not in standard
697
- */
698
- withHackValue(decl) {
699
- return (
700
- (decl.prop === '-webkit-background-clip' && decl.value === 'text') ||
701
- // Do not remove -webkit-box-orient when -webkit-line-clamp is present.
702
- // https://github.com/postcss/autoprefixer/issues/1510
703
- (decl.prop === '-webkit-box-orient' &&
704
- decl.parent.some(d => d.prop === '-webkit-line-clamp'))
705
- )
706
- }
707
- }
708
-
709
- module.exports = Processor