tailwindcss 0.0.0-insiders.4e21639 → 0.0.0-insiders.4e62334
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 +435 -3
- package/LICENSE +1 -2
- package/README.md +13 -6
- package/colors.d.ts +3 -0
- package/colors.js +2 -1
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -1
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -1
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +460 -259
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +9 -3
- package/lib/corePlugins.js +1840 -1753
- package/lib/css/preflight.css +8 -9
- package/lib/featureFlags.js +29 -20
- package/lib/index.js +22 -11
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +58 -4
- package/lib/lib/defaultExtractor.js +231 -0
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +119 -52
- package/lib/lib/expandApplyAtRules.js +440 -161
- package/lib/lib/expandTailwindAtRules.js +130 -128
- package/lib/lib/generateRules.js +410 -171
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +43 -32
- package/lib/lib/offsets.js +199 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +91 -55
- package/lib/lib/setupContextUtils.js +453 -347
- package/lib/lib/setupTrackingContext.js +52 -44
- package/lib/lib/sharedState.js +48 -9
- package/lib/lib/substituteScreenAtRules.js +13 -8
- 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 +36 -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 +16 -25
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +54 -40
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -102
- package/lib/util/defaults.js +10 -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 +223 -40
- 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 +72 -0
- package/lib/util/log.js +22 -12
- package/lib/util/nameClass.js +17 -8
- package/lib/util/negateValue.js +22 -7
- package/lib/util/normalizeConfig.js +99 -54
- package/lib/util/normalizeScreens.js +73 -0
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- package/lib/util/parseDependency.js +18 -15
- package/lib/util/parseObjectStyles.js +10 -7
- package/lib/util/pluginUtils.js +51 -42
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +91 -66
- 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 +24 -3
- package/lib/util/transformThemeValue.js +37 -29
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/package.json +43 -43
- package/peers/index.js +11543 -8114
- package/plugin.d.ts +11 -0
- package/plugin.js +2 -1
- package/resolveConfig.d.ts +3 -0
- package/resolveConfig.js +2 -1
- package/scripts/generate-types.js +105 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +293 -36
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +428 -285
- package/src/css/preflight.css +8 -9
- package/src/featureFlags.js +9 -5
- package/src/index.js +14 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/defaultExtractor.js +208 -0
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +488 -153
- package/src/lib/expandTailwindAtRules.js +82 -80
- package/src/lib/generateRules.js +352 -120
- package/src/lib/normalizeTailwindDirectives.js +7 -1
- package/src/lib/offsets.js +239 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +59 -17
- package/src/lib/setupContextUtils.js +337 -174
- package/src/lib/setupTrackingContext.js +13 -8
- package/src/lib/sharedState.js +42 -4
- package/src/lib/substituteScreenAtRules.js +6 -3
- 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 +12 -2
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +31 -14
- package/src/util/dataTypes.js +28 -19
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +237 -23
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +11 -7
- package/src/util/nameClass.js +1 -1
- package/src/util/negateValue.js +10 -2
- package/src/util/normalizeConfig.js +16 -3
- package/src/util/normalizeScreens.js +45 -0
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/pluginUtils.js +14 -2
- package/src/util/prefixSelector.js +7 -5
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +71 -17
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +13 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +24 -3
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +334 -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 +331 -0
- package/types/index.d.ts +7 -0
- package/lib/lib/setupWatchingContext.js +0 -288
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -311
package/plugin.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Config, PluginCreator } from './types/config'
|
|
2
|
+
type Plugin = {
|
|
3
|
+
withOptions<T>(
|
|
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 }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const plugin: Plugin
|
|
11
|
+
export = plugin
|
package/plugin.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
let createPlugin = require('./lib/public/create-plugin')
|
|
2
|
+
module.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default
|
package/resolveConfig.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
let resolveConfig = require('./lib/public/resolve-config')
|
|
2
|
+
module.exports = (resolveConfig.__esModule ? resolveConfig : { default: resolveConfig }).default
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import prettier from 'prettier'
|
|
2
|
+
import { corePlugins } from '../src/corePlugins'
|
|
3
|
+
import colors from '../src/public/colors'
|
|
4
|
+
import defaultTheme from '../src/public/default-theme'
|
|
5
|
+
import fs from 'fs'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
import * as types from './type-utils'
|
|
8
|
+
|
|
9
|
+
fs.writeFileSync(
|
|
10
|
+
path.join(process.cwd(), 'types', 'generated', 'corePluginList.d.ts'),
|
|
11
|
+
`export type CorePluginList = ${Object.keys(corePlugins)
|
|
12
|
+
.map((p) => `'${p}'`)
|
|
13
|
+
.join(' | ')}`
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
let colorsWithoutDeprecatedColors = Object.fromEntries(
|
|
17
|
+
Object.entries(Object.getOwnPropertyDescriptors(colors))
|
|
18
|
+
.filter(([_, { value }]) => {
|
|
19
|
+
return typeof value !== 'undefined'
|
|
20
|
+
})
|
|
21
|
+
.map(([name, definition]) => [name, definition.value])
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
let deprecatedColors = Object.entries(Object.getOwnPropertyDescriptors(colors))
|
|
25
|
+
.filter(([_, { value }]) => {
|
|
26
|
+
return typeof value === 'undefined'
|
|
27
|
+
})
|
|
28
|
+
.map(([name, definition]) => {
|
|
29
|
+
let warn = console.warn
|
|
30
|
+
let messages = []
|
|
31
|
+
console.warn = (...args) => messages.push(args.pop())
|
|
32
|
+
definition.get()
|
|
33
|
+
console.warn = warn
|
|
34
|
+
let message = messages.join(' ').trim()
|
|
35
|
+
let newColor = message.match(/renamed to `(.*)`/)[1]
|
|
36
|
+
return `/** @deprecated ${message} */${name}: DefaultColors['${newColor}'],`
|
|
37
|
+
})
|
|
38
|
+
.join('\n')
|
|
39
|
+
|
|
40
|
+
fs.writeFileSync(
|
|
41
|
+
path.join(process.cwd(), 'types', 'generated', 'colors.d.ts'),
|
|
42
|
+
prettier.format(
|
|
43
|
+
`export interface DefaultColors { ${JSON.stringify(colorsWithoutDeprecatedColors).slice(
|
|
44
|
+
1,
|
|
45
|
+
-1
|
|
46
|
+
)}\n${deprecatedColors}\n}`,
|
|
47
|
+
{
|
|
48
|
+
semi: false,
|
|
49
|
+
singleQuote: true,
|
|
50
|
+
printWidth: 100,
|
|
51
|
+
parser: 'typescript',
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const defaultThemeTypes = Object.entries(defaultTheme)
|
|
57
|
+
.map(([name, value]) => {
|
|
58
|
+
// Special cases for slightly more accurate types
|
|
59
|
+
if (name === 'keyframes') {
|
|
60
|
+
return [name, `Record<${types.forKeys(value)}, Record<string, CSSDeclarationList>>`]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (name === 'fontSize') {
|
|
64
|
+
return [name, `Record<${types.forKeys(value)}, [string, { lineHeight: string }]>`]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// General cases
|
|
68
|
+
if (typeof value === 'string') {
|
|
69
|
+
return [name, `string`]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (typeof value === 'function') {
|
|
73
|
+
return [name, null]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (typeof value === 'object') {
|
|
77
|
+
if (Object.keys(value).length === 0) {
|
|
78
|
+
return [name, null]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return [name, types.forValue(value)]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return [name, `unknown`]
|
|
85
|
+
})
|
|
86
|
+
.filter(([, type]) => type !== null)
|
|
87
|
+
.map(([name, type]) => `${name}: ${type}`)
|
|
88
|
+
.join('\n')
|
|
89
|
+
|
|
90
|
+
fs.writeFileSync(
|
|
91
|
+
path.join(process.cwd(), 'types', 'generated', 'default-theme.d.ts'),
|
|
92
|
+
prettier.format(
|
|
93
|
+
`
|
|
94
|
+
import { Config } from '../../types'
|
|
95
|
+
type CSSDeclarationList = Record<string, string>
|
|
96
|
+
export type DefaultTheme = Config['theme'] & { ${defaultThemeTypes} }
|
|
97
|
+
`,
|
|
98
|
+
{
|
|
99
|
+
semi: false,
|
|
100
|
+
singleQuote: true,
|
|
101
|
+
printWidth: 100,
|
|
102
|
+
parser: 'typescript',
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function union(types) {
|
|
2
|
+
return [...new Set(types)].join(' | ')
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function unionValues(values) {
|
|
6
|
+
return union(values.map(forValue))
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function forKeys(value) {
|
|
10
|
+
return union(Object.keys(value).map((key) => `'${key}'`))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function forValue(value) {
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
return `(${unionValues(value)})[]`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (typeof value === 'object') {
|
|
19
|
+
return `Record<${forKeys(value)}, ${unionValues(Object.values(value))}>`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (typeof value === 'string') {
|
|
23
|
+
return `string`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return `any`
|
|
27
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function lazyPostcss() {
|
|
2
|
+
return require('postcss')
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function lazyPostcssImport() {
|
|
6
|
+
return require('postcss-import')
|
|
7
|
+
}
|
|
2
8
|
|
|
3
9
|
export function lazyAutoprefixer() {
|
|
4
10
|
return require('autoprefixer')
|