tailwindcss 0.0.0-insiders.fe08e91 → 0.0.0-oxide.dd87d75
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/CHANGELOG.md +379 -3
- package/LICENSE +1 -2
- package/README.md +12 -8
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +4 -0
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +48 -0
- package/lib/cli/build/plugin.js +367 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +178 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +239 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +13 -0
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +4 -740
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +6 -3
- package/lib/corePlugins.js +2064 -1811
- package/lib/css/preflight.css +5 -5
- package/lib/featureFlags.js +31 -22
- package/lib/index.js +4 -28
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +12 -9
- package/lib/lib/content.js +176 -0
- package/lib/lib/defaultExtractor.js +225 -31
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +118 -55
- package/lib/lib/expandApplyAtRules.js +439 -190
- package/lib/lib/expandTailwindAtRules.js +151 -134
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +454 -187
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +36 -32
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +89 -67
- package/lib/lib/setupContextUtils.js +667 -376
- package/lib/lib/setupTrackingContext.js +38 -67
- package/lib/lib/sharedState.js +27 -14
- package/lib/lib/substituteScreenAtRules.js +11 -9
- package/lib/plugin.js +48 -0
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +19 -0
- package/lib/postcss-plugins/nesting/plugin.js +87 -0
- package/lib/processTailwindFeatures.js +35 -25
- package/lib/public/colors.js +247 -245
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +8 -5
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +11 -6
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +53 -54
- package/lib/util/configurePlugins.js +5 -2
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -110
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +7 -4
- package/lib/util/escapeCommas.js +5 -2
- package/lib/util/flattenColorPalette.js +9 -12
- package/lib/util/formatVariantSelector.js +184 -85
- package/lib/util/getAllConfigs.js +27 -8
- package/lib/util/hashConfig.js +6 -3
- package/lib/util/isKeyframeRule.js +5 -2
- package/lib/util/isPlainObject.js +5 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +23 -15
- package/lib/util/log.js +20 -14
- package/lib/util/nameClass.js +20 -9
- package/lib/util/negateValue.js +23 -8
- package/lib/util/normalizeConfig.js +116 -72
- package/lib/util/normalizeScreens.js +120 -11
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- package/lib/util/parseDependency.js +38 -56
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +11 -8
- package/lib/util/pluginUtils.js +147 -50
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +97 -85
- package/lib/util/resolveConfigPath.js +11 -9
- package/lib/util/responsive.js +8 -5
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +5 -3
- package/lib/util/toPath.js +20 -4
- package/lib/util/transformThemeValue.js +37 -29
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/package.json +47 -42
- package/peers/index.js +11381 -7950
- package/plugin.d.ts +11 -0
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +439 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +227 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +234 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +6 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +4 -810
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +532 -217
- package/src/css/preflight.css +5 -5
- package/src/featureFlags.js +15 -9
- package/src/index.js +4 -27
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/content.js +212 -0
- package/src/lib/defaultExtractor.js +196 -33
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +482 -183
- package/src/lib/expandTailwindAtRules.js +106 -85
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +418 -129
- package/src/lib/normalizeTailwindDirectives.js +1 -0
- package/src/lib/offsets.js +270 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +51 -30
- package/src/lib/setupContextUtils.js +556 -208
- package/src/lib/setupTrackingContext.js +11 -48
- package/src/lib/sharedState.js +5 -0
- package/src/plugin.js +47 -0
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +8 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +25 -21
- package/src/util/dataTypes.js +29 -21
- package/src/util/formatVariantSelector.js +184 -61
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +8 -8
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +44 -6
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +132 -10
- package/src/util/prefixSelector.js +7 -5
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -32
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +23 -20
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +362 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -0
- package/nesting/plugin.js +0 -41
|
@@ -5,6 +5,9 @@ import parseValue from 'postcss-value-parser'
|
|
|
5
5
|
import { normalizeScreens } from '../util/normalizeScreens'
|
|
6
6
|
import buildMediaQuery from '../util/buildMediaQuery'
|
|
7
7
|
import { toPath } from '../util/toPath'
|
|
8
|
+
import { withAlphaValue } from '../util/withAlphaVariable'
|
|
9
|
+
import { parseColorFormat } from '../util/pluginUtils'
|
|
10
|
+
import log from '../util/log'
|
|
8
11
|
|
|
9
12
|
function isObject(input) {
|
|
10
13
|
return typeof input === 'object' && input !== null
|
|
@@ -37,10 +40,8 @@ function listKeys(obj) {
|
|
|
37
40
|
return list(Object.keys(obj))
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
function validatePath(config, path, defaultValue) {
|
|
41
|
-
const pathString = Array.isArray(path)
|
|
42
|
-
? pathToString(path)
|
|
43
|
-
: path.replace(/^['"]+/g, '').replace(/['"]+$/g, '')
|
|
43
|
+
function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
44
|
+
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g, '')
|
|
44
45
|
const pathSegments = Array.isArray(path) ? path : toPath(pathString)
|
|
45
46
|
const value = dlv(config.theme, pathSegments, defaultValue)
|
|
46
47
|
|
|
@@ -114,7 +115,7 @@ function validatePath(config, path, defaultValue) {
|
|
|
114
115
|
|
|
115
116
|
return {
|
|
116
117
|
isValid: true,
|
|
117
|
-
value: transformThemeValue(themeSection)(value),
|
|
118
|
+
value: transformThemeValue(themeSection)(value, themeOpts),
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -157,19 +158,89 @@ let nodeTypePropertyMap = {
|
|
|
157
158
|
decl: 'value',
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} path
|
|
163
|
+
* @returns {Iterable<[path: string, alpha: string|undefined]>}
|
|
164
|
+
*/
|
|
165
|
+
function* toPaths(path) {
|
|
166
|
+
// Strip quotes from beginning and end of string
|
|
167
|
+
// This allows the alpha value to be present inside of quotes
|
|
168
|
+
path = path.replace(/^['"]+|['"]+$/g, '')
|
|
169
|
+
|
|
170
|
+
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/)
|
|
171
|
+
let alpha = undefined
|
|
172
|
+
|
|
173
|
+
yield [path, undefined]
|
|
174
|
+
|
|
175
|
+
if (matches) {
|
|
176
|
+
path = matches[1]
|
|
177
|
+
alpha = matches[2]
|
|
178
|
+
|
|
179
|
+
yield [path, alpha]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* @param {any} config
|
|
186
|
+
* @param {string} path
|
|
187
|
+
* @param {any} defaultValue
|
|
188
|
+
*/
|
|
189
|
+
function resolvePath(config, path, defaultValue) {
|
|
190
|
+
const results = Array.from(toPaths(path)).map(([path, alpha]) => {
|
|
191
|
+
return Object.assign(validatePath(config, path, defaultValue, { opacityValue: alpha }), {
|
|
192
|
+
resolvedPath: path,
|
|
193
|
+
alpha,
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
return results.find((result) => result.isValid) ?? results[0]
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export default function (context) {
|
|
201
|
+
let config = context.tailwindConfig
|
|
202
|
+
|
|
161
203
|
let functions = {
|
|
162
204
|
theme: (node, path, ...defaultValue) => {
|
|
163
|
-
|
|
205
|
+
let { isValid, value, error, alpha } = resolvePath(
|
|
164
206
|
config,
|
|
165
207
|
path,
|
|
166
208
|
defaultValue.length ? defaultValue : undefined
|
|
167
209
|
)
|
|
168
210
|
|
|
169
211
|
if (!isValid) {
|
|
212
|
+
let parentNode = node.parent
|
|
213
|
+
let candidate = parentNode?.raws.tailwind?.candidate
|
|
214
|
+
|
|
215
|
+
if (parentNode && candidate !== undefined) {
|
|
216
|
+
// Remove this utility from any caches
|
|
217
|
+
context.markInvalidUtilityNode(parentNode)
|
|
218
|
+
|
|
219
|
+
// Remove the CSS node from the markup
|
|
220
|
+
parentNode.remove()
|
|
221
|
+
|
|
222
|
+
// Show a warning
|
|
223
|
+
log.warn('invalid-theme-key-in-class', [
|
|
224
|
+
`The utility \`${candidate}\` contains an invalid theme value and was not generated.`,
|
|
225
|
+
])
|
|
226
|
+
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
|
|
170
230
|
throw node.error(error)
|
|
171
231
|
}
|
|
172
232
|
|
|
233
|
+
let maybeColor = parseColorFormat(value)
|
|
234
|
+
let isColorFunction = maybeColor !== undefined && typeof maybeColor === 'function'
|
|
235
|
+
|
|
236
|
+
if (alpha !== undefined || isColorFunction) {
|
|
237
|
+
if (alpha === undefined) {
|
|
238
|
+
alpha = 1.0
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
value = withAlphaValue(maybeColor, alpha, maybeColor)
|
|
242
|
+
}
|
|
243
|
+
|
|
173
244
|
return value
|
|
174
245
|
},
|
|
175
246
|
screen: (node, screen) => {
|