tailwindcss 0.0.0-insiders.89bf2ed → 0.0.0-insiders.8a2f9ed
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 +204 -6
- package/README.md +12 -8
- package/defaultTheme.d.ts +2 -1
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +44 -0
- package/lib/cli/build/plugin.js +351 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +175 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +12 -0
- package/lib/cli-peer-dependencies.js +18 -5
- package/lib/cli.js +44 -576
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +609 -344
- package/lib/css/preflight.css +3 -4
- package/lib/featureFlags.js +27 -15
- package/lib/index.js +16 -9
- package/lib/lib/cacheInvalidation.js +42 -21
- package/lib/lib/collapseAdjacentRules.js +15 -13
- package/lib/lib/collapseDuplicateDeclarations.js +11 -8
- package/lib/lib/content.js +177 -0
- package/lib/lib/defaultExtractor.js +225 -33
- package/lib/lib/detectNesting.js +6 -3
- package/lib/lib/evaluateTailwindFunctions.js +105 -42
- package/lib/lib/expandApplyAtRules.js +162 -82
- package/lib/lib/expandTailwindAtRules.js +130 -145
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +337 -167
- package/lib/lib/getModuleDependencies.js +21 -18
- package/lib/lib/normalizeTailwindDirectives.js +11 -8
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/partitionApplyAtRules.js +14 -11
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +97 -79
- package/lib/lib/setupContextUtils.js +551 -230
- package/lib/lib/setupTrackingContext.js +77 -106
- package/lib/lib/sharedState.js +18 -10
- package/lib/lib/substituteScreenAtRules.js +9 -7
- package/lib/postcss-plugins/nesting/index.js +7 -5
- package/lib/postcss-plugins/nesting/plugin.js +8 -6
- package/lib/processTailwindFeatures.js +34 -31
- package/lib/public/colors.js +7 -5
- 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 +13 -10
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +10 -5
- package/lib/util/cloneDeep.js +6 -5
- package/lib/util/cloneNodes.js +9 -2
- package/lib/util/color.js +37 -39
- package/lib/util/configurePlugins.js +5 -2
- package/lib/util/createPlugin.js +6 -5
- package/lib/util/createUtilityPlugin.js +14 -12
- package/lib/util/dataTypes.js +49 -50
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +12 -9
- package/lib/util/escapeCommas.js +4 -1
- package/lib/util/flattenColorPalette.js +7 -8
- package/lib/util/formatVariantSelector.js +166 -67
- package/lib/util/getAllConfigs.js +32 -13
- package/lib/util/hashConfig.js +10 -7
- package/lib/util/isKeyframeRule.js +4 -1
- package/lib/util/isPlainObject.js +4 -1
- package/lib/util/isValidArbitraryValue.js +33 -25
- package/lib/util/log.js +14 -8
- package/lib/util/nameClass.js +19 -8
- package/lib/util/negateValue.js +20 -5
- package/lib/util/normalizeConfig.js +68 -41
- package/lib/util/normalizeScreens.js +115 -4
- package/lib/util/parseAnimationValue.js +43 -41
- package/lib/util/parseBoxShadowValue.js +12 -45
- package/lib/util/parseDependency.js +37 -55
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +15 -12
- package/lib/util/pluginUtils.js +136 -37
- package/lib/util/prefixSelector.js +6 -3
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +104 -103
- package/lib/util/resolveConfigPath.js +20 -17
- package/lib/util/responsive.js +12 -9
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +4 -1
- package/lib/util/toPath.js +18 -2
- package/lib/util/transformThemeValue.js +23 -11
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +32 -24
- package/package.json +25 -22
- package/peers/index.js +6664 -3011
- package/plugin.d.ts +10 -5
- package/resolveConfig.d.ts +3 -0
- package/scripts/generate-types.js +53 -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 +45 -0
- package/src/cli/build/plugin.js +417 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +224 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +3 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +5 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +22 -637
- package/src/corePlugins.js +336 -78
- package/src/css/preflight.css +3 -4
- package/src/featureFlags.js +12 -2
- package/src/index.js +5 -0
- package/src/lib/content.js +213 -0
- package/src/lib/defaultExtractor.js +196 -35
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +156 -36
- package/src/lib/expandTailwindAtRules.js +12 -50
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +308 -109
- package/src/lib/offsets.js +270 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +53 -36
- package/src/lib/setupContextUtils.js +493 -115
- package/src/lib/setupTrackingContext.js +8 -45
- package/src/lib/sharedState.js +2 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +5 -1
- package/src/util/color.js +20 -18
- package/src/util/dataTypes.js +19 -23
- package/src/util/formatVariantSelector.js +184 -61
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/log.js +1 -1
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +10 -2
- package/src/util/normalizeConfig.js +22 -10
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +3 -50
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +125 -14
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -60
- 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 +20 -2
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +74 -35
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -1
- package/types.d.ts +0 -1
|
@@ -8,15 +8,14 @@ import { toPath } from './toPath'
|
|
|
8
8
|
import { normalizeConfig } from './normalizeConfig'
|
|
9
9
|
import isPlainObject from './isPlainObject'
|
|
10
10
|
import { cloneDeep } from './cloneDeep'
|
|
11
|
+
import { parseColorFormat } from './pluginUtils'
|
|
12
|
+
import { withAlphaValue } from './withAlphaVariable'
|
|
13
|
+
import toColorValue from './toColorValue'
|
|
11
14
|
|
|
12
15
|
function isFunction(input) {
|
|
13
16
|
return typeof input === 'function'
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
function isObject(input) {
|
|
17
|
-
return typeof input === 'object' && input !== null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
19
|
function mergeWith(target, ...sources) {
|
|
21
20
|
let customizer = sources.pop()
|
|
22
21
|
|
|
@@ -25,8 +24,8 @@ function mergeWith(target, ...sources) {
|
|
|
25
24
|
let merged = customizer(target[k], source[k])
|
|
26
25
|
|
|
27
26
|
if (merged === undefined) {
|
|
28
|
-
if (
|
|
29
|
-
target[k] = mergeWith(target[k], source[k], customizer)
|
|
27
|
+
if (isPlainObject(target[k]) && isPlainObject(source[k])) {
|
|
28
|
+
target[k] = mergeWith({}, target[k], source[k], customizer)
|
|
30
29
|
} else {
|
|
31
30
|
target[k] = source[k]
|
|
32
31
|
}
|
|
@@ -66,36 +65,6 @@ const configUtils = {
|
|
|
66
65
|
{}
|
|
67
66
|
)
|
|
68
67
|
},
|
|
69
|
-
rgb(property) {
|
|
70
|
-
if (!property.startsWith('--')) {
|
|
71
|
-
throw new Error(
|
|
72
|
-
'The rgb() helper requires a custom property name to be passed as the first argument.'
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return ({ opacityValue }) => {
|
|
77
|
-
if (opacityValue === undefined || opacityValue === 1) {
|
|
78
|
-
return `rgb(var(${property}) / 1.0)`
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return `rgb(var(${property}) / ${opacityValue})`
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
hsl(property) {
|
|
85
|
-
if (!property.startsWith('--')) {
|
|
86
|
-
throw new Error(
|
|
87
|
-
'The hsl() helper requires a custom property name to be passed as the first argument.'
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return ({ opacityValue }) => {
|
|
92
|
-
if (opacityValue === undefined || opacityValue === 1) {
|
|
93
|
-
return `hsl(var(${property}) / 1)`
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return `hsl(var(${property}) / ${opacityValue})`
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
68
|
}
|
|
100
69
|
|
|
101
70
|
function value(valueToResolve, ...args) {
|
|
@@ -130,12 +99,12 @@ function mergeThemes(themes) {
|
|
|
130
99
|
|
|
131
100
|
function mergeExtensionCustomizer(merged, value) {
|
|
132
101
|
// When we have an array of objects, we do want to merge it
|
|
133
|
-
if (Array.isArray(merged) &&
|
|
102
|
+
if (Array.isArray(merged) && isPlainObject(merged[0])) {
|
|
134
103
|
return merged.concat(value)
|
|
135
104
|
}
|
|
136
105
|
|
|
137
106
|
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
138
|
-
if (Array.isArray(value) &&
|
|
107
|
+
if (Array.isArray(value) && isPlainObject(value[0]) && isPlainObject(merged)) {
|
|
139
108
|
return [merged, ...value]
|
|
140
109
|
}
|
|
141
110
|
|
|
@@ -164,40 +133,81 @@ function mergeExtensions({ extend, ...theme }) {
|
|
|
164
133
|
})
|
|
165
134
|
}
|
|
166
135
|
|
|
136
|
+
/**
|
|
137
|
+
*
|
|
138
|
+
* @param {string} key
|
|
139
|
+
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
140
|
+
*/
|
|
141
|
+
function* toPaths(key) {
|
|
142
|
+
let path = toPath(key)
|
|
143
|
+
|
|
144
|
+
if (path.length === 0) {
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
yield path
|
|
149
|
+
|
|
150
|
+
if (Array.isArray(key)) {
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
let pattern = /^(.*?)\s*\/\s*([^/]+)$/
|
|
155
|
+
let matches = key.match(pattern)
|
|
156
|
+
|
|
157
|
+
if (matches !== null) {
|
|
158
|
+
let [, prefix, alpha] = matches
|
|
159
|
+
|
|
160
|
+
let newPath = toPath(prefix)
|
|
161
|
+
newPath.alpha = alpha
|
|
162
|
+
|
|
163
|
+
yield newPath
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
167
|
function resolveFunctionKeys(object) {
|
|
168
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
169
|
+
|
|
168
170
|
const resolvePath = (key, defaultValue) => {
|
|
169
|
-
const path
|
|
171
|
+
for (const path of toPaths(key)) {
|
|
172
|
+
let index = 0
|
|
173
|
+
let val = object
|
|
170
174
|
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
while (val !== undefined && val !== null && index < path.length) {
|
|
176
|
+
val = val[path[index++]]
|
|
173
177
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
val = isFunction(val) ? val(resolvePath, configUtils) : val
|
|
177
|
-
}
|
|
178
|
+
let shouldResolveAsFn =
|
|
179
|
+
isFunction(val) && (path.alpha === undefined || index <= path.length - 1)
|
|
178
180
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
181
|
+
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val
|
|
182
|
+
}
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
if (val !== undefined) {
|
|
185
|
+
if (path.alpha !== undefined) {
|
|
186
|
+
let normalized = parseColorFormat(val)
|
|
186
187
|
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
return withAlphaValue(normalized, path.alpha, toColorValue(normalized))
|
|
189
|
+
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
if (isPlainObject(val)) {
|
|
192
|
+
return cloneDeep(val)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return val
|
|
196
|
+
}
|
|
197
|
+
}
|
|
191
198
|
|
|
192
|
-
|
|
193
|
-
resolvePath[key] = configUtils[key]
|
|
199
|
+
return defaultValue
|
|
194
200
|
}
|
|
195
201
|
|
|
202
|
+
Object.assign(resolvePath, {
|
|
203
|
+
theme: resolvePath,
|
|
204
|
+
...configUtils,
|
|
205
|
+
})
|
|
206
|
+
|
|
196
207
|
return Object.keys(object).reduce((resolved, key) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
208
|
+
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
209
|
+
|
|
210
|
+
return resolved
|
|
201
211
|
}, {})
|
|
202
212
|
}
|
|
203
213
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This splits a string on a top-level character.
|
|
3
|
+
*
|
|
4
|
+
* Regex doesn't support recursion (at least not the JS-flavored version).
|
|
5
|
+
* So we have to use a tiny state machine to keep track of paren placement.
|
|
6
|
+
*
|
|
7
|
+
* Expected behavior using commas:
|
|
8
|
+
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
|
|
9
|
+
* ─┬─ ┬ ┬ ┬
|
|
10
|
+
* x x x ╰──────── Split because top-level
|
|
11
|
+
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
|
|
12
|
+
*
|
|
13
|
+
* @param {string} input
|
|
14
|
+
* @param {string} separator
|
|
15
|
+
*/
|
|
16
|
+
export function splitAtTopLevelOnly(input, separator) {
|
|
17
|
+
let stack = []
|
|
18
|
+
let parts = []
|
|
19
|
+
let lastPos = 0
|
|
20
|
+
|
|
21
|
+
for (let idx = 0; idx < input.length; idx++) {
|
|
22
|
+
let char = input[idx]
|
|
23
|
+
|
|
24
|
+
if (stack.length === 0 && char === separator[0]) {
|
|
25
|
+
if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
|
|
26
|
+
parts.push(input.slice(lastPos, idx))
|
|
27
|
+
lastPos = idx + separator.length
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (char === '(' || char === '[' || char === '{') {
|
|
32
|
+
stack.push(char)
|
|
33
|
+
} else if (
|
|
34
|
+
(char === ')' && stack[stack.length - 1] === '(') ||
|
|
35
|
+
(char === ']' && stack[stack.length - 1] === '[') ||
|
|
36
|
+
(char === '}' && stack[stack.length - 1] === '{')
|
|
37
|
+
) {
|
|
38
|
+
stack.pop()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
parts.push(input.slice(lastPos))
|
|
43
|
+
|
|
44
|
+
return parts
|
|
45
|
+
}
|
package/src/util/toPath.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import postcss from 'postcss'
|
|
2
|
+
import isPlainObject from './isPlainObject'
|
|
2
3
|
|
|
3
4
|
export default function transformThemeValue(themeSection) {
|
|
4
5
|
if (['fontSize', 'outline'].includes(themeSection)) {
|
|
@@ -10,9 +11,16 @@ export default function transformThemeValue(themeSection) {
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
if (themeSection === 'fontFamily') {
|
|
15
|
+
return (value) => {
|
|
16
|
+
if (typeof value === 'function') value = value({})
|
|
17
|
+
let families = Array.isArray(value) && isPlainObject(value[1]) ? value[0] : value
|
|
18
|
+
return Array.isArray(families) ? families.join(', ') : families
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
if (
|
|
14
23
|
[
|
|
15
|
-
'fontFamily',
|
|
16
24
|
'boxShadow',
|
|
17
25
|
'transitionProperty',
|
|
18
26
|
'transitionDuration',
|
|
@@ -44,8 +52,10 @@ export default function transformThemeValue(themeSection) {
|
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
return (value) => {
|
|
48
|
-
if (typeof value === 'function')
|
|
55
|
+
return (value, opts = {}) => {
|
|
56
|
+
if (typeof value === 'function') {
|
|
57
|
+
value = value(opts)
|
|
58
|
+
}
|
|
49
59
|
|
|
50
60
|
return value
|
|
51
61
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import log from './log'
|
|
2
|
+
|
|
3
|
+
export function validateConfig(config) {
|
|
4
|
+
if (config.content.files.length === 0) {
|
|
5
|
+
log.warn('content-problems', [
|
|
6
|
+
'The `content` option in your Tailwind CSS configuration is missing or empty.',
|
|
7
|
+
'Configure your content sources or your generated CSS will be missing styles.',
|
|
8
|
+
'https://tailwindcss.com/docs/content-configuration',
|
|
9
|
+
])
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return config
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { length, percentage } from './dataTypes'
|
|
2
|
+
import { splitAtTopLevelOnly } from './splitAtTopLevelOnly'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/background-size#formal_syntax
|
|
7
|
+
*
|
|
8
|
+
* background-size =
|
|
9
|
+
* <bg-size>#
|
|
10
|
+
*
|
|
11
|
+
* <bg-size> =
|
|
12
|
+
* [ <length-percentage [0,∞]> | auto ]{1,2} |
|
|
13
|
+
* cover |
|
|
14
|
+
* contain
|
|
15
|
+
*
|
|
16
|
+
* <length-percentage> =
|
|
17
|
+
* <length> |
|
|
18
|
+
* <percentage>
|
|
19
|
+
*
|
|
20
|
+
* @param {string} value
|
|
21
|
+
*/
|
|
22
|
+
export function backgroundSize(value) {
|
|
23
|
+
let keywordValues = ['cover', 'contain']
|
|
24
|
+
// the <length-percentage> type will probably be a css function
|
|
25
|
+
// so we have to use `splitAtTopLevelOnly`
|
|
26
|
+
return splitAtTopLevelOnly(value, ',').every((part) => {
|
|
27
|
+
let sizes = splitAtTopLevelOnly(part, '_').filter(Boolean)
|
|
28
|
+
if (sizes.length === 1 && keywordValues.includes(sizes[0])) return true
|
|
29
|
+
|
|
30
|
+
if (sizes.length !== 1 && sizes.length !== 2) return false
|
|
31
|
+
|
|
32
|
+
return sizes.every((size) => length(size) || percentage(size) || size === 'auto')
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
1
2
|
module.exports = {
|
|
2
3
|
content: [],
|
|
3
4
|
presets: [],
|
|
@@ -10,6 +11,7 @@ module.exports = {
|
|
|
10
11
|
xl: '1280px',
|
|
11
12
|
'2xl': '1536px',
|
|
12
13
|
},
|
|
14
|
+
supports: {},
|
|
13
15
|
colors: ({ colors }) => ({
|
|
14
16
|
inherit: colors.inherit,
|
|
15
17
|
current: colors.current,
|
|
@@ -111,6 +113,16 @@ module.exports = {
|
|
|
111
113
|
pulse: 'pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
|
112
114
|
bounce: 'bounce 1s infinite',
|
|
113
115
|
},
|
|
116
|
+
aria: {
|
|
117
|
+
checked: 'checked="true"',
|
|
118
|
+
disabled: 'disabled="true"',
|
|
119
|
+
expanded: 'expanded="true"',
|
|
120
|
+
hidden: 'hidden="true"',
|
|
121
|
+
pressed: 'pressed="true"',
|
|
122
|
+
readonly: 'readonly="true"',
|
|
123
|
+
required: 'required="true"',
|
|
124
|
+
selected: 'selected="true"',
|
|
125
|
+
},
|
|
114
126
|
aspectRatio: {
|
|
115
127
|
auto: 'auto',
|
|
116
128
|
square: '1 / 1',
|
|
@@ -283,7 +295,10 @@ module.exports = {
|
|
|
283
295
|
'2xl': '0 25px 25px rgb(0 0 0 / 0.15)',
|
|
284
296
|
none: '0 0 #0000',
|
|
285
297
|
},
|
|
286
|
-
fill: ({ theme }) =>
|
|
298
|
+
fill: ({ theme }) => ({
|
|
299
|
+
none: 'none',
|
|
300
|
+
...theme('colors'),
|
|
301
|
+
}),
|
|
287
302
|
grayscale: {
|
|
288
303
|
0: '0',
|
|
289
304
|
DEFAULT: '100%',
|
|
@@ -792,7 +807,10 @@ module.exports = {
|
|
|
792
807
|
space: ({ theme }) => ({
|
|
793
808
|
...theme('spacing'),
|
|
794
809
|
}),
|
|
795
|
-
stroke: ({ theme }) =>
|
|
810
|
+
stroke: ({ theme }) => ({
|
|
811
|
+
none: 'none',
|
|
812
|
+
...theme('colors'),
|
|
813
|
+
}),
|
|
796
814
|
strokeWidth: {
|
|
797
815
|
0: '0',
|
|
798
816
|
1: '1',
|
package/types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CorePluginList } from './generated/
|
|
1
|
+
import type { CorePluginList } from './generated/corePluginList'
|
|
2
2
|
import type { DefaultColors } from './generated/colors'
|
|
3
3
|
|
|
4
4
|
// Helpers
|
|
@@ -12,6 +12,7 @@ interface RecursiveKeyValuePair<K extends keyof any = string, V = string> {
|
|
|
12
12
|
[key: string]: V | RecursiveKeyValuePair<K, V>
|
|
13
13
|
}
|
|
14
14
|
type ResolvableTo<T> = T | ((utils: PluginUtils) => T)
|
|
15
|
+
type CSSRuleObject = RecursiveKeyValuePair<string, null | string | string[]>
|
|
15
16
|
|
|
16
17
|
interface PluginUtils {
|
|
17
18
|
colors: DefaultColors
|
|
@@ -30,6 +31,7 @@ type ContentConfig =
|
|
|
30
31
|
| (FilePath | RawFile)[]
|
|
31
32
|
| {
|
|
32
33
|
files: (FilePath | RawFile)[]
|
|
34
|
+
relative?: boolean
|
|
33
35
|
extract?: ExtractorFn | { [extension: string]: ExtractorFn }
|
|
34
36
|
transform?: TransformerFn | { [extension: string]: TransformerFn }
|
|
35
37
|
}
|
|
@@ -48,27 +50,31 @@ type SafelistConfig =
|
|
|
48
50
|
| string[]
|
|
49
51
|
| {
|
|
50
52
|
pattern: RegExp
|
|
51
|
-
variants
|
|
53
|
+
variants?: string[]
|
|
52
54
|
}[]
|
|
53
55
|
|
|
54
56
|
// Presets related config
|
|
55
57
|
type PresetsConfig = Config[]
|
|
56
58
|
|
|
57
59
|
// Future related config
|
|
58
|
-
type FutureConfigValues =
|
|
60
|
+
type FutureConfigValues =
|
|
61
|
+
| 'hoverOnlyWhenSupported'
|
|
62
|
+
| 'respectDefaultRingColorOpacity'
|
|
63
|
+
| 'disableColorOpacityUtilitiesByDefault'
|
|
64
|
+
| 'relativeContentPathsByDefault'
|
|
59
65
|
type FutureConfig = Expand<'all' | Partial<Record<FutureConfigValues, boolean>>> | []
|
|
60
66
|
|
|
61
67
|
// Experimental related config
|
|
62
|
-
type ExperimentalConfigValues = 'optimizeUniversalDefaults'
|
|
68
|
+
type ExperimentalConfigValues = 'optimizeUniversalDefaults' | 'matchVariant'
|
|
63
69
|
type ExperimentalConfig = Expand<'all' | Partial<Record<ExperimentalConfigValues, boolean>>> | []
|
|
64
70
|
|
|
65
71
|
// DarkMode related config
|
|
66
72
|
type DarkModeConfig =
|
|
67
|
-
|
|
73
|
+
// Use the `media` query strategy.
|
|
68
74
|
| 'media'
|
|
69
|
-
|
|
75
|
+
// Use the `class` strategy, which requires a `.dark` class on the `html`.
|
|
70
76
|
| 'class'
|
|
71
|
-
|
|
77
|
+
// Use the `class` strategy with a custom class instead of `.dark`.
|
|
72
78
|
| ['class', string]
|
|
73
79
|
|
|
74
80
|
type Screen = { raw: string } | { min: string } | { max: string } | { min: string; max: string }
|
|
@@ -76,16 +82,15 @@ type ScreensConfig = string[] | KeyValuePair<string, string | Screen | Screen[]>
|
|
|
76
82
|
|
|
77
83
|
// Theme related config
|
|
78
84
|
interface ThemeConfig {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/** Responsiveness */
|
|
85
|
+
// Responsiveness
|
|
82
86
|
screens: ResolvableTo<ScreensConfig>
|
|
87
|
+
supports: ResolvableTo<Record<string, string>>
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
// Reusable base configs
|
|
85
90
|
colors: ResolvableTo<RecursiveKeyValuePair>
|
|
86
91
|
spacing: ResolvableTo<KeyValuePair>
|
|
87
92
|
|
|
88
|
-
|
|
93
|
+
// Components
|
|
89
94
|
container: ResolvableTo<
|
|
90
95
|
Partial<{
|
|
91
96
|
screens: ScreensConfig
|
|
@@ -94,7 +99,7 @@ interface ThemeConfig {
|
|
|
94
99
|
}>
|
|
95
100
|
>
|
|
96
101
|
|
|
97
|
-
|
|
102
|
+
// Utilities
|
|
98
103
|
inset: ThemeConfig['spacing']
|
|
99
104
|
zIndex: ResolvableTo<KeyValuePair>
|
|
100
105
|
order: ResolvableTo<KeyValuePair>
|
|
@@ -154,7 +159,14 @@ interface ThemeConfig {
|
|
|
154
159
|
objectPosition: ResolvableTo<KeyValuePair>
|
|
155
160
|
padding: ThemeConfig['spacing']
|
|
156
161
|
textIndent: ThemeConfig['spacing']
|
|
157
|
-
fontFamily: ResolvableTo<
|
|
162
|
+
fontFamily: ResolvableTo<
|
|
163
|
+
KeyValuePair<
|
|
164
|
+
string,
|
|
165
|
+
| string
|
|
166
|
+
| string[]
|
|
167
|
+
| [fontFamily: string | string[], configuration: Partial<{ fontFeatureSettings: string }>]
|
|
168
|
+
>
|
|
169
|
+
>
|
|
158
170
|
fontSize: ResolvableTo<
|
|
159
171
|
KeyValuePair<
|
|
160
172
|
string,
|
|
@@ -165,6 +177,7 @@ interface ThemeConfig {
|
|
|
165
177
|
configuration: Partial<{
|
|
166
178
|
lineHeight: string
|
|
167
179
|
letterSpacing: string
|
|
180
|
+
fontWeight: string | number
|
|
168
181
|
}>
|
|
169
182
|
]
|
|
170
183
|
>
|
|
@@ -217,7 +230,7 @@ interface ThemeConfig {
|
|
|
217
230
|
willChange: ResolvableTo<KeyValuePair>
|
|
218
231
|
content: ResolvableTo<KeyValuePair>
|
|
219
232
|
|
|
220
|
-
|
|
233
|
+
// Custom
|
|
221
234
|
[key: string]: any
|
|
222
235
|
}
|
|
223
236
|
|
|
@@ -242,62 +255,88 @@ type ValueType =
|
|
|
242
255
|
| 'relative-size'
|
|
243
256
|
| 'shadow'
|
|
244
257
|
export interface PluginAPI {
|
|
245
|
-
|
|
258
|
+
// for registering new static utility styles
|
|
246
259
|
addUtilities(
|
|
247
|
-
utilities:
|
|
260
|
+
utilities: CSSRuleObject | CSSRuleObject[],
|
|
248
261
|
options?: Partial<{
|
|
249
262
|
respectPrefix: boolean
|
|
250
263
|
respectImportant: boolean
|
|
251
264
|
}>
|
|
252
265
|
): void
|
|
253
|
-
|
|
254
|
-
matchUtilities<T>(
|
|
255
|
-
utilities: KeyValuePair<
|
|
266
|
+
// for registering new dynamic utility styles
|
|
267
|
+
matchUtilities<T = string, U = string>(
|
|
268
|
+
utilities: KeyValuePair<
|
|
269
|
+
string,
|
|
270
|
+
(value: T | string, extra: { modifier: U | string | null }) => CSSRuleObject | null
|
|
271
|
+
>,
|
|
256
272
|
options?: Partial<{
|
|
257
273
|
respectPrefix: boolean
|
|
258
274
|
respectImportant: boolean
|
|
259
275
|
type: ValueType | ValueType[]
|
|
260
276
|
values: KeyValuePair<string, T>
|
|
277
|
+
modifiers: 'any' | KeyValuePair<string, U>
|
|
261
278
|
supportsNegativeValues: boolean
|
|
262
279
|
}>
|
|
263
280
|
): void
|
|
264
|
-
|
|
281
|
+
// for registering new static component styles
|
|
265
282
|
addComponents(
|
|
266
|
-
components:
|
|
283
|
+
components: CSSRuleObject | CSSRuleObject[],
|
|
267
284
|
options?: Partial<{
|
|
268
285
|
respectPrefix: boolean
|
|
269
286
|
respectImportant: boolean
|
|
270
287
|
}>
|
|
271
288
|
): void
|
|
272
|
-
|
|
273
|
-
matchComponents<T>(
|
|
274
|
-
components: KeyValuePair<
|
|
289
|
+
// for registering new dynamic component styles
|
|
290
|
+
matchComponents<T = string, U = string>(
|
|
291
|
+
components: KeyValuePair<
|
|
292
|
+
string,
|
|
293
|
+
(value: T | string, extra: { modifier: U | string | null }) => CSSRuleObject | null
|
|
294
|
+
>,
|
|
275
295
|
options?: Partial<{
|
|
276
296
|
respectPrefix: boolean
|
|
277
297
|
respectImportant: boolean
|
|
278
298
|
type: ValueType | ValueType[]
|
|
279
299
|
values: KeyValuePair<string, T>
|
|
300
|
+
modifiers: 'any' | KeyValuePair<string, U>
|
|
280
301
|
supportsNegativeValues: boolean
|
|
281
302
|
}>
|
|
282
303
|
): void
|
|
283
|
-
|
|
284
|
-
addBase(base:
|
|
285
|
-
|
|
304
|
+
// for registering new base styles
|
|
305
|
+
addBase(base: CSSRuleObject | CSSRuleObject[]): void
|
|
306
|
+
// for registering custom variants
|
|
286
307
|
addVariant(name: string, definition: string | string[] | (() => string) | (() => string)[]): void
|
|
287
|
-
|
|
308
|
+
matchVariant<T = string>(
|
|
309
|
+
name: string,
|
|
310
|
+
cb: (value: T | string, extra: { modifier: string | null }) => string | string[],
|
|
311
|
+
options?: {
|
|
312
|
+
values?: KeyValuePair<string, T>
|
|
313
|
+
sort?(
|
|
314
|
+
a: { value: T | string; modifier: string | null },
|
|
315
|
+
b: { value: T | string; modifier: string | null }
|
|
316
|
+
): number
|
|
317
|
+
}
|
|
318
|
+
): void
|
|
319
|
+
// for looking up values in the user’s theme configuration
|
|
288
320
|
theme: <TDefaultValue = Config['theme']>(
|
|
289
321
|
path?: string,
|
|
290
322
|
defaultValue?: TDefaultValue
|
|
291
323
|
) => TDefaultValue
|
|
292
|
-
|
|
324
|
+
// for looking up values in the user’s Tailwind configuration
|
|
293
325
|
config: <TDefaultValue = Config>(path?: string, defaultValue?: TDefaultValue) => TDefaultValue
|
|
294
|
-
|
|
326
|
+
// for checking if a core plugin is enabled
|
|
295
327
|
corePlugins(path: string): boolean
|
|
296
|
-
|
|
328
|
+
// for manually escaping strings meant to be used in class names
|
|
297
329
|
e: (className: string) => string
|
|
298
330
|
}
|
|
299
331
|
export type PluginCreator = (api: PluginAPI) => void
|
|
300
|
-
export type PluginsConfig = (
|
|
332
|
+
export type PluginsConfig = (
|
|
333
|
+
| PluginCreator
|
|
334
|
+
| { handler: PluginCreator; config?: Partial<Config> }
|
|
335
|
+
| {
|
|
336
|
+
(options: any): { handler: PluginCreator; config?: Partial<Config> }
|
|
337
|
+
__isOptionsFunction: true
|
|
338
|
+
}
|
|
339
|
+
)[]
|
|
301
340
|
|
|
302
341
|
// Top level config related
|
|
303
342
|
interface RequiredConfig {
|
|
@@ -313,10 +352,10 @@ interface OptionalConfig {
|
|
|
313
352
|
future: Partial<FutureConfig>
|
|
314
353
|
experimental: Partial<ExperimentalConfig>
|
|
315
354
|
darkMode: Partial<DarkModeConfig>
|
|
316
|
-
theme: Partial<ThemeConfig>
|
|
355
|
+
theme: Partial<ThemeConfig & { extend: Partial<ThemeConfig> }>
|
|
317
356
|
corePlugins: Partial<CorePluginsConfig>
|
|
318
357
|
plugins: Partial<PluginsConfig>
|
|
319
|
-
|
|
358
|
+
// Custom
|
|
320
359
|
[key: string]: any
|
|
321
360
|
}
|
|
322
361
|
|