tailwindcss 3.1.8 → 3.2.0

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 (112) hide show
  1. package/README.md +6 -5
  2. package/lib/cli/build/deps.js +54 -0
  3. package/lib/cli/build/index.js +44 -0
  4. package/lib/cli/build/plugin.js +335 -0
  5. package/lib/cli/build/utils.js +78 -0
  6. package/lib/cli/build/watching.js +113 -0
  7. package/lib/cli/help/index.js +71 -0
  8. package/lib/cli/index.js +18 -0
  9. package/lib/cli/init/index.js +46 -0
  10. package/lib/cli/shared.js +12 -0
  11. package/lib/cli.js +11 -590
  12. package/lib/corePlugins.js +332 -108
  13. package/lib/css/preflight.css +5 -0
  14. package/lib/featureFlags.js +7 -4
  15. package/lib/index.js +6 -1
  16. package/lib/lib/content.js +167 -0
  17. package/lib/lib/defaultExtractor.js +15 -10
  18. package/lib/lib/detectNesting.js +2 -2
  19. package/lib/lib/evaluateTailwindFunctions.js +17 -1
  20. package/lib/lib/expandApplyAtRules.js +66 -37
  21. package/lib/lib/expandTailwindAtRules.js +10 -42
  22. package/lib/lib/findAtConfigPath.js +44 -0
  23. package/lib/lib/generateRules.js +180 -93
  24. package/lib/lib/normalizeTailwindDirectives.js +1 -1
  25. package/lib/lib/offsets.js +217 -0
  26. package/lib/lib/regex.js +1 -1
  27. package/lib/lib/setupContextUtils.js +339 -100
  28. package/lib/lib/setupTrackingContext.js +5 -39
  29. package/lib/lib/sharedState.js +2 -0
  30. package/lib/public/colors.js +1 -1
  31. package/lib/util/buildMediaQuery.js +6 -3
  32. package/lib/util/configurePlugins.js +1 -1
  33. package/lib/util/dataTypes.js +15 -19
  34. package/lib/util/formatVariantSelector.js +92 -8
  35. package/lib/util/getAllConfigs.js +14 -3
  36. package/lib/util/isValidArbitraryValue.js +1 -1
  37. package/lib/util/nameClass.js +3 -0
  38. package/lib/util/negateValue.js +15 -2
  39. package/lib/util/normalizeConfig.js +17 -3
  40. package/lib/util/normalizeScreens.js +100 -3
  41. package/lib/util/parseAnimationValue.js +1 -1
  42. package/lib/util/parseBoxShadowValue.js +1 -1
  43. package/lib/util/parseDependency.js +33 -54
  44. package/lib/util/parseGlob.js +34 -0
  45. package/lib/util/parseObjectStyles.js +1 -1
  46. package/lib/util/pluginUtils.js +86 -17
  47. package/lib/util/resolveConfig.js +2 -2
  48. package/lib/util/splitAtTopLevelOnly.js +31 -81
  49. package/lib/util/transformThemeValue.js +9 -2
  50. package/lib/util/validateConfig.js +1 -1
  51. package/lib/util/validateFormalSyntax.js +24 -0
  52. package/package.json +13 -11
  53. package/peers/.DS_Store +0 -0
  54. package/peers/.svgo.yml +75 -0
  55. package/peers/index.js +3332 -2032
  56. package/peers/orders/concentric-css.json +299 -0
  57. package/peers/orders/smacss.json +299 -0
  58. package/peers/orders/source.json +295 -0
  59. package/plugin.d.ts +3 -3
  60. package/scripts/release-channel.js +18 -0
  61. package/scripts/release-notes.js +21 -0
  62. package/src/.DS_Store +0 -0
  63. package/src/cli/build/deps.js +56 -0
  64. package/src/cli/build/index.js +45 -0
  65. package/src/cli/build/plugin.js +397 -0
  66. package/src/cli/build/utils.js +76 -0
  67. package/src/cli/build/watching.js +134 -0
  68. package/src/cli/help/index.js +70 -0
  69. package/src/cli/index.js +3 -0
  70. package/src/cli/init/index.js +50 -0
  71. package/src/cli/shared.js +5 -0
  72. package/src/cli.js +4 -696
  73. package/src/corePlugins.js +262 -39
  74. package/src/css/preflight.css +5 -0
  75. package/src/featureFlags.js +12 -2
  76. package/src/index.js +5 -0
  77. package/src/lib/content.js +205 -0
  78. package/src/lib/defaultExtractor.js +3 -0
  79. package/src/lib/evaluateTailwindFunctions.js +22 -1
  80. package/src/lib/expandApplyAtRules.js +70 -29
  81. package/src/lib/expandTailwindAtRules.js +8 -46
  82. package/src/lib/findAtConfigPath.js +48 -0
  83. package/src/lib/generateRules.js +223 -101
  84. package/src/lib/offsets.js +270 -0
  85. package/src/lib/setupContextUtils.js +376 -89
  86. package/src/lib/setupTrackingContext.js +4 -45
  87. package/src/lib/sharedState.js +2 -0
  88. package/src/util/buildMediaQuery.js +5 -3
  89. package/src/util/dataTypes.js +15 -17
  90. package/src/util/formatVariantSelector.js +113 -9
  91. package/src/util/getAllConfigs.js +14 -2
  92. package/src/util/nameClass.js +4 -0
  93. package/src/util/negateValue.js +10 -2
  94. package/src/util/normalizeConfig.js +22 -2
  95. package/src/util/normalizeScreens.js +99 -4
  96. package/src/util/parseBoxShadowValue.js +1 -1
  97. package/src/util/parseDependency.js +37 -42
  98. package/src/util/parseGlob.js +24 -0
  99. package/src/util/pluginUtils.js +90 -14
  100. package/src/util/resolveConfig.js +1 -1
  101. package/src/util/splitAtTopLevelOnly.js +23 -49
  102. package/src/util/transformThemeValue.js +9 -1
  103. package/src/util/validateFormalSyntax.js +34 -0
  104. package/stubs/defaultConfig.stub.js +19 -3
  105. package/tmp.css +11 -0
  106. package/tmp.dependency-graph.js +2 -0
  107. package/tmp.in.css +3 -0
  108. package/tmp.js +0 -0
  109. package/tmp.out.css +524 -0
  110. package/types/config.d.ts +47 -13
  111. package/types/generated/default-theme.d.ts +11 -0
  112. package/CHANGELOG.md +0 -2231
@@ -0,0 +1,295 @@
1
+ [
2
+ "align-content",
3
+ "align-items",
4
+ "align-self",
5
+ "all",
6
+ "animation",
7
+ "animation-delay",
8
+ "animation-direction",
9
+ "animation-duration",
10
+ "animation-fill-mode",
11
+ "animation-iteration-count",
12
+ "animation-name",
13
+ "animation-play-state",
14
+ "animation-timing-function",
15
+ "backdrop-filter",
16
+ "backface-visibility",
17
+ "background",
18
+ "background-attachment",
19
+ "background-blend-mode",
20
+ "background-clip",
21
+ "background-color",
22
+ "background-image",
23
+ "background-origin",
24
+ "background-position",
25
+ "background-position-x",
26
+ "background-position-y",
27
+ "background-repeat",
28
+ "background-size",
29
+ "block-size",
30
+ "border",
31
+ "border-block-end",
32
+ "border-block-end-color",
33
+ "border-block-end-style",
34
+ "border-block-end-width",
35
+ "border-block-start",
36
+ "border-block-start-color",
37
+ "border-block-start-style",
38
+ "border-block-start-width",
39
+ "border-bottom",
40
+ "border-bottom-color",
41
+ "border-bottom-left-radius",
42
+ "border-bottom-right-radius",
43
+ "border-bottom-style",
44
+ "border-bottom-width",
45
+ "border-collapse",
46
+ "border-color",
47
+ "border-image",
48
+ "border-image-outset",
49
+ "border-image-repeat",
50
+ "border-image-slice",
51
+ "border-image-source",
52
+ "border-image-width",
53
+ "border-inline-end",
54
+ "border-inline-end-color",
55
+ "border-inline-end-style",
56
+ "border-inline-end-width",
57
+ "border-inline-start",
58
+ "border-inline-start-color",
59
+ "border-inline-start-style",
60
+ "border-inline-start-width",
61
+ "border-left",
62
+ "border-left-color",
63
+ "border-left-style",
64
+ "border-left-width",
65
+ "border-radius",
66
+ "border-right",
67
+ "border-right-color",
68
+ "border-right-style",
69
+ "border-right-width",
70
+ "border-spacing",
71
+ "border-style",
72
+ "border-top",
73
+ "border-top-color",
74
+ "border-top-left-radius",
75
+ "border-top-right-radius",
76
+ "border-top-style",
77
+ "border-top-width",
78
+ "border-width",
79
+ "bottom",
80
+ "box-decoration-break",
81
+ "box-shadow",
82
+ "box-sizing",
83
+ "break-after",
84
+ "break-before",
85
+ "break-inside",
86
+ "caption-side",
87
+ "caret-color",
88
+ "clear",
89
+ "clip-path",
90
+ "color",
91
+ "column-count",
92
+ "column-fill",
93
+ "column-gap",
94
+ "column-rule",
95
+ "column-rule-color",
96
+ "column-rule-style",
97
+ "column-rule-width",
98
+ "column-span",
99
+ "column-width",
100
+ "columns",
101
+ "content",
102
+ "counter-increment",
103
+ "counter-reset",
104
+ "cursor",
105
+ "direction",
106
+ "display",
107
+ "empty-cells",
108
+ "filter",
109
+ "flex",
110
+ "flex-basis",
111
+ "flex-direction",
112
+ "flex-flow",
113
+ "flex-grow",
114
+ "flex-shrink",
115
+ "flex-wrap",
116
+ "float",
117
+ "font",
118
+ "font-family",
119
+ "font-feature-settings",
120
+ "font-kerning",
121
+ "font-language-override",
122
+ "font-optical-sizing",
123
+ "font-size",
124
+ "font-size-adjust",
125
+ "font-stretch",
126
+ "font-style",
127
+ "font-synthesis",
128
+ "font-variant",
129
+ "font-variant-alternates",
130
+ "font-variant-caps",
131
+ "font-variant-east-asian",
132
+ "font-variant-ligatures",
133
+ "font-variant-numeric",
134
+ "font-variant-position",
135
+ "font-weight",
136
+ "grid",
137
+ "grid-area",
138
+ "grid-auto-columns",
139
+ "grid-auto-flow",
140
+ "grid-auto-rows",
141
+ "grid-column",
142
+ "grid-column-end",
143
+ "grid-column-start",
144
+ "grid-row",
145
+ "grid-row-end",
146
+ "grid-row-start",
147
+ "grid-template",
148
+ "grid-template-areas",
149
+ "grid-template-columns",
150
+ "grid-template-rows",
151
+ "height",
152
+ "hyphens",
153
+ "image-orientation",
154
+ "image-rendering",
155
+ "initial-letter",
156
+ "initial-letter-align",
157
+ "inline-size",
158
+ "isolation",
159
+ "justify-content",
160
+ "justify-items",
161
+ "justify-self",
162
+ "left",
163
+ "letter-spacing",
164
+ "line-break",
165
+ "line-height",
166
+ "list-style",
167
+ "list-style-image",
168
+ "list-style-position",
169
+ "list-style-type",
170
+ "margin",
171
+ "margin-block-end",
172
+ "margin-block-start",
173
+ "margin-bottom",
174
+ "margin-inline-end",
175
+ "margin-inline-start",
176
+ "margin-left",
177
+ "margin-right",
178
+ "margin-top",
179
+ "mask",
180
+ "mask-clip",
181
+ "mask-image",
182
+ "mask-origin",
183
+ "mask-position",
184
+ "mask-repeat",
185
+ "mask-size",
186
+ "mask-type",
187
+ "max-block-size",
188
+ "max-height",
189
+ "max-inline-size",
190
+ "max-width",
191
+ "min-block-size",
192
+ "min-height",
193
+ "min-inline-size",
194
+ "min-width",
195
+ "mix-blend-mode",
196
+ "object-fit",
197
+ "object-position",
198
+ "offset-block-end",
199
+ "offset-block-start",
200
+ "offset-inline-end",
201
+ "offset-inline-start",
202
+ "opacity",
203
+ "order",
204
+ "orphans",
205
+ "outline",
206
+ "outline-color",
207
+ "outline-offset",
208
+ "outline-style",
209
+ "outline-width",
210
+ "overflow",
211
+ "overflow-wrap",
212
+ "overflow-x",
213
+ "overflow-y",
214
+ "padding",
215
+ "padding-block-end",
216
+ "padding-block-start",
217
+ "padding-bottom",
218
+ "padding-inline-end",
219
+ "padding-inline-start",
220
+ "padding-left",
221
+ "padding-right",
222
+ "padding-top",
223
+ "page-break-after",
224
+ "page-break-before",
225
+ "page-break-inside",
226
+ "perspective",
227
+ "perspective-origin",
228
+ "place-content",
229
+ "place-items",
230
+ "place-self",
231
+ "pointer-events",
232
+ "position",
233
+ "quotes",
234
+ "resize",
235
+ "right",
236
+ "rotate",
237
+ "ruby-align",
238
+ "ruby-position",
239
+ "scale",
240
+ "scroll-behavior",
241
+ "scroll-snap-coordinate",
242
+ "scroll-snap-destination",
243
+ "scroll-snap-type",
244
+ "shape-image-threshold",
245
+ "shape-margin",
246
+ "shape-outside",
247
+ "tab-size",
248
+ "table-layout",
249
+ "text-align",
250
+ "text-align-last",
251
+ "text-combine-upright",
252
+ "text-decoration",
253
+ "text-decoration-color",
254
+ "text-decoration-line",
255
+ "text-decoration-skip",
256
+ "text-decoration-skip-ink",
257
+ "text-decoration-style",
258
+ "text-emphasis",
259
+ "text-emphasis-color",
260
+ "text-emphasis-position",
261
+ "text-emphasis-style",
262
+ "text-indent",
263
+ "text-justify",
264
+ "text-orientation",
265
+ "text-overflow",
266
+ "text-rendering",
267
+ "text-shadow",
268
+ "text-size-adjust",
269
+ "text-transform",
270
+ "text-underline-position",
271
+ "top",
272
+ "touch-action",
273
+ "transform",
274
+ "transform-box",
275
+ "transform-origin",
276
+ "transform-style",
277
+ "transition",
278
+ "transition-delay",
279
+ "transition-duration",
280
+ "transition-property",
281
+ "transition-timing-function",
282
+ "unicode-bidi",
283
+ "unicode-range",
284
+ "user-select",
285
+ "vertical-align",
286
+ "visibility",
287
+ "white-space",
288
+ "widows",
289
+ "width",
290
+ "will-change",
291
+ "word-break",
292
+ "word-spacing",
293
+ "writing-mode",
294
+ "z-index"
295
+ ]
package/plugin.d.ts CHANGED
@@ -2,9 +2,9 @@ import type { Config, PluginCreator } from './types/config'
2
2
  type Plugin = {
3
3
  withOptions<T>(
4
4
  plugin: (options: T) => PluginCreator,
5
- config?: (options: T) => Config
6
- ): { (options: T): { handler: PluginCreator; config?: Config }; __isOptionsFunction: true }
7
- (plugin: PluginCreator, config?: Config): { handler: PluginCreator; config?: Config }
5
+ config?: (options: T) => Partial<Config>
6
+ ): { (options: T): { handler: PluginCreator; config?: Partial<Config> }; __isOptionsFunction: true }
7
+ (plugin: PluginCreator, config?: Partial<Config>): { handler: PluginCreator; config?: Partial<Config> }
8
8
  }
9
9
 
10
10
  declare const plugin: Plugin
@@ -0,0 +1,18 @@
1
+ // Given a version, figure out what the release channel is so that we can publish to the correct
2
+ // channel on npm.
3
+ //
4
+ // E.g.:
5
+ //
6
+ // 1.2.3 -> latest (default)
7
+ // 0.0.0-insiders.ffaa88 -> insiders
8
+ // 4.1.0-alpha.4 -> alpha
9
+
10
+ let version =
11
+ process.argv[2] || process.env.npm_package_version || require('../package.json').version
12
+
13
+ let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
14
+ if (match) {
15
+ console.log(match[1])
16
+ } else {
17
+ console.log('latest')
18
+ }
@@ -0,0 +1,21 @@
1
+ // Given a version, figure out what the release notes are so that we can use this to pre-fill the
2
+ // relase notes on a GitHub release for the current version.
3
+
4
+ let path = require('path')
5
+ let fs = require('fs')
6
+
7
+ let version =
8
+ process.argv[2] || process.env.npm_package_version || require('../package.json').version
9
+
10
+ let changelog = fs.readFileSync(path.resolve(__dirname, '..', 'CHANGELOG.md'), 'utf8')
11
+ let match = new RegExp(
12
+ `## \\[${version}\\] - (.*)\\n\\n([\\s\\S]*?)\\n(?:(?:##\\s)|(?:\\[))`,
13
+ 'g'
14
+ ).exec(changelog)
15
+
16
+ if (match) {
17
+ let [, , notes] = match
18
+ console.log(notes.trim())
19
+ } else {
20
+ console.log(`Placeholder release notes for version: v${version}`)
21
+ }
package/src/.DS_Store ADDED
Binary file
@@ -0,0 +1,56 @@
1
+ // @ts-check
2
+
3
+ import {
4
+ // @ts-ignore
5
+ lazyPostcss,
6
+
7
+ // @ts-ignore
8
+ lazyPostcssImport,
9
+
10
+ // @ts-ignore
11
+ lazyCssnano,
12
+
13
+ // @ts-ignore
14
+ lazyAutoprefixer,
15
+ } from '../../../peers/index.js'
16
+
17
+ /**
18
+ * @returns {import('postcss')}
19
+ */
20
+ export function loadPostcss() {
21
+ // Try to load a local `postcss` version first
22
+ try {
23
+ return require('postcss')
24
+ } catch {}
25
+
26
+ return lazyPostcss()
27
+ }
28
+
29
+ export function loadPostcssImport() {
30
+ // Try to load a local `postcss-import` version first
31
+ try {
32
+ return require('postcss-import')
33
+ } catch {}
34
+
35
+ return lazyPostcssImport()
36
+ }
37
+
38
+ export function loadCssNano() {
39
+ let options = { preset: ['default', { cssDeclarationSorter: false }] }
40
+
41
+ // Try to load a local `cssnano` version first
42
+ try {
43
+ return require('cssnano')
44
+ } catch {}
45
+
46
+ return lazyCssnano()(options)
47
+ }
48
+
49
+ export function loadAutoprefixer() {
50
+ // Try to load a local `autoprefixer` version first
51
+ try {
52
+ return require('autoprefixer')
53
+ } catch {}
54
+
55
+ return lazyAutoprefixer()
56
+ }
@@ -0,0 +1,45 @@
1
+ // @ts-check
2
+
3
+ import fs from 'fs'
4
+ import path from 'path'
5
+ import { createProcessor } from './plugin.js'
6
+
7
+ export async function build(args, configs) {
8
+ let input = args['--input']
9
+ let shouldWatch = args['--watch']
10
+
11
+ // TODO: Deprecate this in future versions
12
+ if (!input && args['_'][1]) {
13
+ console.error('[deprecation] Running tailwindcss without -i, please provide an input file.')
14
+ input = args['--input'] = args['_'][1]
15
+ }
16
+
17
+ if (input && input !== '-' && !fs.existsSync((input = path.resolve(input)))) {
18
+ console.error(`Specified input file ${args['--input']} does not exist.`)
19
+ process.exit(9)
20
+ }
21
+
22
+ if (args['--config'] && !fs.existsSync((args['--config'] = path.resolve(args['--config'])))) {
23
+ console.error(`Specified config file ${args['--config']} does not exist.`)
24
+ process.exit(9)
25
+ }
26
+
27
+ // TODO: Reference the @config path here if exists
28
+ let configPath = args['--config']
29
+ ? args['--config']
30
+ : ((defaultPath) => (fs.existsSync(defaultPath) ? defaultPath : null))(
31
+ path.resolve(`./${configs.tailwind}`)
32
+ )
33
+
34
+ let processor = await createProcessor(args, configPath)
35
+
36
+ if (shouldWatch) {
37
+ /* Abort the watcher if stdin is closed to avoid zombie processes */
38
+ process.stdin.on('end', () => process.exit(0))
39
+ process.stdin.resume()
40
+
41
+ await processor.watch()
42
+ } else {
43
+ await processor.build()
44
+ }
45
+ }