tailwindcss 0.0.0-insiders.bbafc8e → 0.0.0-insiders.bbc2f3f
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/README.md +16 -13
- package/dist/chunk-5C7JPVMO.mjs +10 -0
- package/dist/chunk-AZANAYY2.mjs +1 -0
- package/dist/chunk-V2K3XTS4.mjs +1 -0
- package/dist/colors-b_6i0Oi7.d.ts +295 -0
- package/dist/colors.d.mts +295 -0
- package/dist/colors.d.ts +5 -0
- package/dist/colors.js +1 -0
- package/dist/colors.mjs +1 -0
- package/dist/default-theme.d.mts +1147 -0
- package/dist/default-theme.d.ts +1147 -0
- package/dist/default-theme.js +1 -0
- package/dist/default-theme.mjs +1 -0
- package/dist/flatten-color-palette.d.mts +6 -0
- package/dist/flatten-color-palette.d.ts +6 -0
- package/dist/flatten-color-palette.js +1 -0
- package/dist/flatten-color-palette.mjs +1 -0
- package/dist/lib.d.mts +260 -0
- package/dist/lib.d.ts +3 -0
- package/dist/lib.js +33 -0
- package/dist/lib.mjs +24 -0
- package/dist/plugin.d.mts +11 -0
- package/dist/plugin.d.ts +104 -0
- package/dist/plugin.js +1 -0
- package/dist/plugin.mjs +1 -0
- package/dist/resolve-config-BIFUA2FY.d.ts +29 -0
- package/dist/resolve-config-QUZ9b-Gn.d.mts +190 -0
- package/dist/types-B254mqw1.d.mts +98 -0
- package/index.css +865 -0
- package/package.json +73 -95
- package/preflight.css +383 -0
- package/theme.css +453 -0
- package/CHANGELOG.md +0 -2084
- package/base.css +0 -1
- package/colors.js +0 -2
- package/components.css +0 -1
- package/defaultConfig.js +0 -2
- package/defaultTheme.js +0 -2
- package/lib/cli-peer-dependencies.js +0 -15
- package/lib/cli.js +0 -741
- package/lib/constants.js +0 -37
- package/lib/corePluginList.js +0 -178
- package/lib/corePlugins.js +0 -3587
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -367
- package/lib/featureFlags.js +0 -59
- package/lib/index.js +0 -41
- package/lib/lib/cacheInvalidation.js +0 -69
- package/lib/lib/collapseAdjacentRules.js +0 -54
- package/lib/lib/collapseDuplicateDeclarations.js +0 -80
- package/lib/lib/defaultExtractor.js +0 -44
- package/lib/lib/detectNesting.js +0 -34
- package/lib/lib/evaluateTailwindFunctions.js +0 -171
- package/lib/lib/expandApplyAtRules.js +0 -433
- package/lib/lib/expandTailwindAtRules.js +0 -262
- package/lib/lib/generateRules.js +0 -631
- package/lib/lib/getModuleDependencies.js +0 -48
- package/lib/lib/normalizeTailwindDirectives.js +0 -84
- package/lib/lib/partitionApplyAtRules.js +0 -53
- package/lib/lib/resolveDefaultsAtRules.js +0 -143
- package/lib/lib/setupContextUtils.js +0 -859
- package/lib/lib/setupTrackingContext.js +0 -171
- package/lib/lib/sharedState.js +0 -52
- package/lib/lib/substituteScreenAtRules.js +0 -27
- package/lib/postcss-plugins/nesting/README.md +0 -42
- package/lib/postcss-plugins/nesting/index.js +0 -17
- package/lib/postcss-plugins/nesting/plugin.js +0 -85
- package/lib/processTailwindFeatures.js +0 -59
- package/lib/public/colors.js +0 -329
- package/lib/public/create-plugin.js +0 -13
- package/lib/public/default-config.js +0 -14
- package/lib/public/default-theme.js +0 -14
- package/lib/public/resolve-config.js +0 -19
- package/lib/util/bigSign.js +0 -8
- package/lib/util/buildMediaQuery.js +0 -20
- package/lib/util/cloneDeep.js +0 -19
- package/lib/util/cloneNodes.js +0 -25
- package/lib/util/color.js +0 -99
- package/lib/util/configurePlugins.js +0 -18
- package/lib/util/createPlugin.js +0 -29
- package/lib/util/createUtilityPlugin.js +0 -49
- package/lib/util/dataTypes.js +0 -233
- package/lib/util/defaults.js +0 -22
- package/lib/util/escapeClassName.js +0 -19
- package/lib/util/escapeCommas.js +0 -8
- package/lib/util/flattenColorPalette.js +0 -17
- package/lib/util/formatVariantSelector.js +0 -186
- package/lib/util/getAllConfigs.js +0 -29
- package/lib/util/hashConfig.js +0 -16
- package/lib/util/isKeyframeRule.js +0 -8
- package/lib/util/isPlainObject.js +0 -12
- package/lib/util/isValidArbitraryValue.js +0 -64
- package/lib/util/log.js +0 -51
- package/lib/util/nameClass.js +0 -32
- package/lib/util/negateValue.js +0 -19
- package/lib/util/normalizeConfig.js +0 -240
- package/lib/util/normalizeScreens.js +0 -59
- package/lib/util/parseAnimationValue.js +0 -89
- package/lib/util/parseBoxShadowValue.js +0 -117
- package/lib/util/parseDependency.js +0 -63
- package/lib/util/parseObjectStyles.js +0 -31
- package/lib/util/pluginUtils.js +0 -179
- package/lib/util/prefixSelector.js +0 -20
- package/lib/util/resolveConfig.js +0 -255
- package/lib/util/resolveConfigPath.js +0 -51
- package/lib/util/responsive.js +0 -19
- package/lib/util/tap.js +0 -9
- package/lib/util/toColorValue.js +0 -8
- package/lib/util/toPath.js +0 -14
- package/lib/util/transformThemeValue.js +0 -59
- package/lib/util/withAlphaVariable.js +0 -67
- package/nesting/index.js +0 -2
- package/peers/index.js +0 -75077
- package/plugin.js +0 -2
- package/prettier.config.js +0 -19
- package/resolveConfig.js +0 -2
- package/screens.css +0 -1
- package/scripts/create-plugin-list.js +0 -10
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli-peer-dependencies.js +0 -9
- package/src/cli.js +0 -815
- package/src/constants.js +0 -17
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2365
- package/src/css/LICENSE +0 -25
- package/src/css/preflight.css +0 -367
- package/src/featureFlags.js +0 -54
- package/src/index.js +0 -42
- package/src/lib/cacheInvalidation.js +0 -52
- package/src/lib/collapseAdjacentRules.js +0 -54
- package/src/lib/collapseDuplicateDeclarations.js +0 -93
- package/src/lib/defaultExtractor.js +0 -50
- package/src/lib/detectNesting.js +0 -39
- package/src/lib/evaluateTailwindFunctions.js +0 -198
- package/src/lib/expandApplyAtRules.js +0 -480
- package/src/lib/expandTailwindAtRules.js +0 -292
- package/src/lib/generateRules.js +0 -623
- package/src/lib/getModuleDependencies.js +0 -39
- package/src/lib/normalizeTailwindDirectives.js +0 -84
- package/src/lib/partitionApplyAtRules.js +0 -52
- package/src/lib/resolveDefaultsAtRules.js +0 -146
- package/src/lib/setupContextUtils.js +0 -883
- package/src/lib/setupTrackingContext.js +0 -183
- package/src/lib/sharedState.js +0 -48
- package/src/lib/substituteScreenAtRules.js +0 -19
- package/src/postcss-plugins/nesting/README.md +0 -42
- package/src/postcss-plugins/nesting/index.js +0 -13
- package/src/postcss-plugins/nesting/plugin.js +0 -80
- package/src/processTailwindFeatures.js +0 -58
- package/src/public/colors.js +0 -300
- package/src/public/create-plugin.js +0 -2
- package/src/public/default-config.js +0 -4
- package/src/public/default-theme.js +0 -4
- package/src/public/resolve-config.js +0 -7
- package/src/util/bigSign.js +0 -3
- package/src/util/buildMediaQuery.js +0 -20
- package/src/util/cloneDeep.js +0 -11
- package/src/util/cloneNodes.js +0 -24
- package/src/util/color.js +0 -69
- package/src/util/configurePlugins.js +0 -23
- package/src/util/createPlugin.js +0 -27
- package/src/util/createUtilityPlugin.js +0 -37
- package/src/util/dataTypes.js +0 -248
- package/src/util/defaults.js +0 -17
- package/src/util/escapeClassName.js +0 -8
- package/src/util/escapeCommas.js +0 -3
- package/src/util/flattenColorPalette.js +0 -13
- package/src/util/formatVariantSelector.js +0 -196
- package/src/util/getAllConfigs.js +0 -19
- package/src/util/hashConfig.js +0 -5
- package/src/util/isKeyframeRule.js +0 -3
- package/src/util/isPlainObject.js +0 -8
- package/src/util/isValidArbitraryValue.js +0 -61
- package/src/util/log.js +0 -29
- package/src/util/nameClass.js +0 -26
- package/src/util/negateValue.js +0 -16
- package/src/util/normalizeConfig.js +0 -270
- package/src/util/normalizeScreens.js +0 -45
- package/src/util/parseAnimationValue.js +0 -68
- package/src/util/parseBoxShadowValue.js +0 -119
- package/src/util/parseDependency.js +0 -49
- package/src/util/parseObjectStyles.js +0 -19
- package/src/util/pluginUtils.js +0 -192
- package/src/util/prefixSelector.js +0 -14
- package/src/util/resolveConfig.js +0 -269
- package/src/util/resolveConfigPath.js +0 -55
- package/src/util/responsive.js +0 -10
- package/src/util/tap.js +0 -4
- package/src/util/toColorValue.js +0 -3
- package/src/util/toPath.js +0 -26
- package/src/util/transformThemeValue.js +0 -52
- package/src/util/withAlphaVariable.js +0 -49
- package/stubs/defaultConfig.stub.js +0 -950
- package/stubs/defaultPostCssConfig.stub.js +0 -6
- package/stubs/simpleConfig.stub.js +0 -7
- package/tailwind.css +0 -5
- package/variants.css +0 -1
package/src/util/pluginUtils.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import selectorParser from 'postcss-selector-parser'
|
|
2
|
-
import escapeCommas from './escapeCommas'
|
|
3
|
-
import { withAlphaValue } from './withAlphaVariable'
|
|
4
|
-
import {
|
|
5
|
-
normalize,
|
|
6
|
-
length,
|
|
7
|
-
number,
|
|
8
|
-
percentage,
|
|
9
|
-
url,
|
|
10
|
-
color as validateColor,
|
|
11
|
-
genericName,
|
|
12
|
-
familyName,
|
|
13
|
-
image,
|
|
14
|
-
absoluteSize,
|
|
15
|
-
relativeSize,
|
|
16
|
-
position,
|
|
17
|
-
lineWidth,
|
|
18
|
-
shadow,
|
|
19
|
-
} from './dataTypes'
|
|
20
|
-
import negateValue from './negateValue'
|
|
21
|
-
|
|
22
|
-
export function updateAllClasses(selectors, updateClass) {
|
|
23
|
-
let parser = selectorParser((selectors) => {
|
|
24
|
-
selectors.walkClasses((sel) => {
|
|
25
|
-
let updatedClass = updateClass(sel.value)
|
|
26
|
-
sel.value = updatedClass
|
|
27
|
-
if (sel.raws && sel.raws.value) {
|
|
28
|
-
sel.raws.value = escapeCommas(sel.raws.value)
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
let result = parser.processSync(selectors)
|
|
34
|
-
|
|
35
|
-
return result
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function resolveArbitraryValue(modifier, validate) {
|
|
39
|
-
if (!isArbitraryValue(modifier)) {
|
|
40
|
-
return undefined
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
let value = modifier.slice(1, -1)
|
|
44
|
-
|
|
45
|
-
if (!validate(value)) {
|
|
46
|
-
return undefined
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return normalize(value)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function asNegativeValue(modifier, lookup = {}, validate) {
|
|
53
|
-
let positiveValue = lookup[modifier]
|
|
54
|
-
|
|
55
|
-
if (positiveValue !== undefined) {
|
|
56
|
-
return negateValue(positiveValue)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (isArbitraryValue(modifier)) {
|
|
60
|
-
let resolved = resolveArbitraryValue(modifier, validate)
|
|
61
|
-
|
|
62
|
-
if (resolved === undefined) {
|
|
63
|
-
return undefined
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return negateValue(resolved)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function asValue(modifier, options = {}, { validate = () => true } = {}) {
|
|
71
|
-
let value = options.values?.[modifier]
|
|
72
|
-
|
|
73
|
-
if (value !== undefined) {
|
|
74
|
-
return value
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (options.supportsNegativeValues && modifier.startsWith('-')) {
|
|
78
|
-
return asNegativeValue(modifier.slice(1), options.values, validate)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return resolveArbitraryValue(modifier, validate)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function isArbitraryValue(input) {
|
|
85
|
-
return input.startsWith('[') && input.endsWith(']')
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function splitAlpha(modifier) {
|
|
89
|
-
let slashIdx = modifier.lastIndexOf('/')
|
|
90
|
-
|
|
91
|
-
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
|
92
|
-
return [modifier]
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return [modifier.slice(0, slashIdx), modifier.slice(slashIdx + 1)]
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function asColor(modifier, options = {}, { tailwindConfig = {} } = {}) {
|
|
99
|
-
if (options.values?.[modifier] !== undefined) {
|
|
100
|
-
return options.values?.[modifier]
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
let [color, alpha] = splitAlpha(modifier)
|
|
104
|
-
|
|
105
|
-
if (alpha !== undefined) {
|
|
106
|
-
let normalizedColor =
|
|
107
|
-
options.values?.[color] ?? (isArbitraryValue(color) ? color.slice(1, -1) : undefined)
|
|
108
|
-
|
|
109
|
-
if (normalizedColor === undefined) {
|
|
110
|
-
return undefined
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (isArbitraryValue(alpha)) {
|
|
114
|
-
return withAlphaValue(normalizedColor, alpha.slice(1, -1))
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (tailwindConfig.theme?.opacity?.[alpha] === undefined) {
|
|
118
|
-
return undefined
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return withAlphaValue(normalizedColor, tailwindConfig.theme.opacity[alpha])
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return asValue(modifier, options, { validate: validateColor })
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function asLookupValue(modifier, options = {}) {
|
|
128
|
-
return options.values?.[modifier]
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function guess(validate) {
|
|
132
|
-
return (modifier, options) => {
|
|
133
|
-
return asValue(modifier, options, { validate })
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let typeMap = {
|
|
138
|
-
any: asValue,
|
|
139
|
-
color: asColor,
|
|
140
|
-
url: guess(url),
|
|
141
|
-
image: guess(image),
|
|
142
|
-
length: guess(length),
|
|
143
|
-
percentage: guess(percentage),
|
|
144
|
-
position: guess(position),
|
|
145
|
-
lookup: asLookupValue,
|
|
146
|
-
'generic-name': guess(genericName),
|
|
147
|
-
'family-name': guess(familyName),
|
|
148
|
-
number: guess(number),
|
|
149
|
-
'line-width': guess(lineWidth),
|
|
150
|
-
'absolute-size': guess(absoluteSize),
|
|
151
|
-
'relative-size': guess(relativeSize),
|
|
152
|
-
shadow: guess(shadow),
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
let supportedTypes = Object.keys(typeMap)
|
|
156
|
-
|
|
157
|
-
function splitAtFirst(input, delim) {
|
|
158
|
-
let idx = input.indexOf(delim)
|
|
159
|
-
if (idx === -1) return [undefined, input]
|
|
160
|
-
return [input.slice(0, idx), input.slice(idx + 1)]
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export function coerceValue(types, modifier, options, tailwindConfig) {
|
|
164
|
-
if (isArbitraryValue(modifier)) {
|
|
165
|
-
let arbitraryValue = modifier.slice(1, -1)
|
|
166
|
-
let [explicitType, value] = splitAtFirst(arbitraryValue, ':')
|
|
167
|
-
|
|
168
|
-
// It could be that this resolves to `url(https` which is not a valid
|
|
169
|
-
// identifier. We currently only support "simple" words with dashes or
|
|
170
|
-
// underscores. E.g.: family-name
|
|
171
|
-
if (!/^[\w-_]+$/g.test(explicitType)) {
|
|
172
|
-
value = arbitraryValue
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
else if (explicitType !== undefined && !supportedTypes.includes(explicitType)) {
|
|
177
|
-
return []
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (value.length > 0 && supportedTypes.includes(explicitType)) {
|
|
181
|
-
return [asValue(`[${value}]`, options), explicitType]
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Find first matching type
|
|
186
|
-
for (let type of [].concat(types)) {
|
|
187
|
-
let result = typeMap[type](modifier, options, { tailwindConfig })
|
|
188
|
-
if (result !== undefined) return [result, type]
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return []
|
|
192
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import parser from 'postcss-selector-parser'
|
|
2
|
-
|
|
3
|
-
export default function (prefix, selector, prependNegative = false) {
|
|
4
|
-
return parser((selectors) => {
|
|
5
|
-
selectors.walkClasses((classSelector) => {
|
|
6
|
-
let baseClass = classSelector.value
|
|
7
|
-
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith('-')
|
|
8
|
-
|
|
9
|
-
classSelector.value = shouldPlaceNegativeBeforePrefix
|
|
10
|
-
? `-${prefix}${baseClass.slice(1)}`
|
|
11
|
-
: `${prefix}${baseClass}`
|
|
12
|
-
})
|
|
13
|
-
}).processSync(selector)
|
|
14
|
-
}
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import negateValue from './negateValue'
|
|
2
|
-
import corePluginList from '../corePluginList'
|
|
3
|
-
import configurePlugins from './configurePlugins'
|
|
4
|
-
import defaultConfig from '../../stubs/defaultConfig.stub'
|
|
5
|
-
import colors from '../public/colors'
|
|
6
|
-
import { defaults } from './defaults'
|
|
7
|
-
import { toPath } from './toPath'
|
|
8
|
-
import { normalizeConfig } from './normalizeConfig'
|
|
9
|
-
import isPlainObject from './isPlainObject'
|
|
10
|
-
import { cloneDeep } from './cloneDeep'
|
|
11
|
-
|
|
12
|
-
function isFunction(input) {
|
|
13
|
-
return typeof input === 'function'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function isObject(input) {
|
|
17
|
-
return typeof input === 'object' && input !== null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function mergeWith(target, ...sources) {
|
|
21
|
-
let customizer = sources.pop()
|
|
22
|
-
|
|
23
|
-
for (let source of sources) {
|
|
24
|
-
for (let k in source) {
|
|
25
|
-
let merged = customizer(target[k], source[k])
|
|
26
|
-
|
|
27
|
-
if (merged === undefined) {
|
|
28
|
-
if (isObject(target[k]) && isObject(source[k])) {
|
|
29
|
-
target[k] = mergeWith(target[k], source[k], customizer)
|
|
30
|
-
} else {
|
|
31
|
-
target[k] = source[k]
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
target[k] = merged
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return target
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const configUtils = {
|
|
43
|
-
colors,
|
|
44
|
-
negative(scale) {
|
|
45
|
-
// TODO: Log that this function isn't really needed anymore?
|
|
46
|
-
return Object.keys(scale)
|
|
47
|
-
.filter((key) => scale[key] !== '0')
|
|
48
|
-
.reduce((negativeScale, key) => {
|
|
49
|
-
let negativeValue = negateValue(scale[key])
|
|
50
|
-
|
|
51
|
-
if (negativeValue !== undefined) {
|
|
52
|
-
negativeScale[`-${key}`] = negativeValue
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return negativeScale
|
|
56
|
-
}, {})
|
|
57
|
-
},
|
|
58
|
-
breakpoints(screens) {
|
|
59
|
-
return Object.keys(screens)
|
|
60
|
-
.filter((key) => typeof screens[key] === 'string')
|
|
61
|
-
.reduce(
|
|
62
|
-
(breakpoints, key) => ({
|
|
63
|
-
...breakpoints,
|
|
64
|
-
[`screen-${key}`]: screens[key],
|
|
65
|
-
}),
|
|
66
|
-
{}
|
|
67
|
-
)
|
|
68
|
-
},
|
|
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
|
-
}
|
|
100
|
-
|
|
101
|
-
function value(valueToResolve, ...args) {
|
|
102
|
-
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function collectExtends(items) {
|
|
106
|
-
return items.reduce((merged, { extend }) => {
|
|
107
|
-
return mergeWith(merged, extend, (mergedValue, extendValue) => {
|
|
108
|
-
if (mergedValue === undefined) {
|
|
109
|
-
return [extendValue]
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (Array.isArray(mergedValue)) {
|
|
113
|
-
return [extendValue, ...mergedValue]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return [extendValue, mergedValue]
|
|
117
|
-
})
|
|
118
|
-
}, {})
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function mergeThemes(themes) {
|
|
122
|
-
return {
|
|
123
|
-
...themes.reduce((merged, theme) => defaults(merged, theme), {}),
|
|
124
|
-
|
|
125
|
-
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
126
|
-
// into arrays instead of objects so they aren't overridden.
|
|
127
|
-
extend: collectExtends(themes),
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function mergeExtensionCustomizer(merged, value) {
|
|
132
|
-
// When we have an array of objects, we do want to merge it
|
|
133
|
-
if (Array.isArray(merged) && isObject(merged[0])) {
|
|
134
|
-
return merged.concat(value)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
138
|
-
if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
|
|
139
|
-
return [merged, ...value]
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Override arrays (for example for font-families, box-shadows, ...)
|
|
143
|
-
if (Array.isArray(value)) {
|
|
144
|
-
return value
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Execute default behaviour
|
|
148
|
-
return undefined
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function mergeExtensions({ extend, ...theme }) {
|
|
152
|
-
return mergeWith(theme, extend, (themeValue, extensions) => {
|
|
153
|
-
// The `extend` property is an array, so we need to check if it contains any functions
|
|
154
|
-
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
155
|
-
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return (resolveThemePath, utils) =>
|
|
159
|
-
mergeWith(
|
|
160
|
-
{},
|
|
161
|
-
...[themeValue, ...extensions].map((e) => value(e, resolveThemePath, utils)),
|
|
162
|
-
mergeExtensionCustomizer
|
|
163
|
-
)
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function resolveFunctionKeys(object) {
|
|
168
|
-
const resolvePath = (key, defaultValue) => {
|
|
169
|
-
const path = toPath(key)
|
|
170
|
-
|
|
171
|
-
let index = 0
|
|
172
|
-
let val = object
|
|
173
|
-
|
|
174
|
-
while (val !== undefined && val !== null && index < path.length) {
|
|
175
|
-
val = val[path[index++]]
|
|
176
|
-
val = isFunction(val) ? val(resolvePath, configUtils) : val
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (val === undefined) {
|
|
180
|
-
return defaultValue
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (isPlainObject(val)) {
|
|
184
|
-
return cloneDeep(val)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return val
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
resolvePath.theme = resolvePath
|
|
191
|
-
|
|
192
|
-
for (let key in configUtils) {
|
|
193
|
-
resolvePath[key] = configUtils[key]
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return Object.keys(object).reduce((resolved, key) => {
|
|
197
|
-
return {
|
|
198
|
-
...resolved,
|
|
199
|
-
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key],
|
|
200
|
-
}
|
|
201
|
-
}, {})
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function extractPluginConfigs(configs) {
|
|
205
|
-
let allConfigs = []
|
|
206
|
-
|
|
207
|
-
configs.forEach((config) => {
|
|
208
|
-
allConfigs = [...allConfigs, config]
|
|
209
|
-
|
|
210
|
-
const plugins = config?.plugins ?? []
|
|
211
|
-
|
|
212
|
-
if (plugins.length === 0) {
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
plugins.forEach((plugin) => {
|
|
217
|
-
if (plugin.__isOptionsFunction) {
|
|
218
|
-
plugin = plugin()
|
|
219
|
-
}
|
|
220
|
-
allConfigs = [...allConfigs, ...extractPluginConfigs([plugin?.config ?? {}])]
|
|
221
|
-
})
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
return allConfigs
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function resolveCorePlugins(corePluginConfigs) {
|
|
228
|
-
const result = [...corePluginConfigs].reduceRight((resolved, corePluginConfig) => {
|
|
229
|
-
if (isFunction(corePluginConfig)) {
|
|
230
|
-
return corePluginConfig({ corePlugins: resolved })
|
|
231
|
-
}
|
|
232
|
-
return configurePlugins(corePluginConfig, resolved)
|
|
233
|
-
}, corePluginList)
|
|
234
|
-
|
|
235
|
-
return result
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function resolvePluginLists(pluginLists) {
|
|
239
|
-
const result = [...pluginLists].reduceRight((resolved, pluginList) => {
|
|
240
|
-
return [...resolved, ...pluginList]
|
|
241
|
-
}, [])
|
|
242
|
-
|
|
243
|
-
return result
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export default function resolveConfig(configs) {
|
|
247
|
-
let allConfigs = [
|
|
248
|
-
...extractPluginConfigs(configs),
|
|
249
|
-
{
|
|
250
|
-
prefix: '',
|
|
251
|
-
important: false,
|
|
252
|
-
separator: ':',
|
|
253
|
-
variantOrder: defaultConfig.variantOrder,
|
|
254
|
-
},
|
|
255
|
-
]
|
|
256
|
-
|
|
257
|
-
return normalizeConfig(
|
|
258
|
-
defaults(
|
|
259
|
-
{
|
|
260
|
-
theme: resolveFunctionKeys(
|
|
261
|
-
mergeExtensions(mergeThemes(allConfigs.map((t) => t?.theme ?? {})))
|
|
262
|
-
),
|
|
263
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c) => c.corePlugins)),
|
|
264
|
-
plugins: resolvePluginLists(configs.map((c) => c?.plugins ?? [])),
|
|
265
|
-
},
|
|
266
|
-
...allConfigs
|
|
267
|
-
)
|
|
268
|
-
)
|
|
269
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
function isObject(value) {
|
|
5
|
-
return typeof value === 'object' && value !== null
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function isEmpty(obj) {
|
|
9
|
-
return Object.keys(obj).length === 0
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function isString(value) {
|
|
13
|
-
return typeof value === 'string' || value instanceof String
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default function resolveConfigPath(pathOrConfig) {
|
|
17
|
-
// require('tailwindcss')({ theme: ..., variants: ... })
|
|
18
|
-
if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
|
|
19
|
-
return null
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// require('tailwindcss')({ config: 'custom-config.js' })
|
|
23
|
-
if (
|
|
24
|
-
isObject(pathOrConfig) &&
|
|
25
|
-
pathOrConfig.config !== undefined &&
|
|
26
|
-
isString(pathOrConfig.config)
|
|
27
|
-
) {
|
|
28
|
-
return path.resolve(pathOrConfig.config)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// require('tailwindcss')({ config: { theme: ..., variants: ... } })
|
|
32
|
-
if (
|
|
33
|
-
isObject(pathOrConfig) &&
|
|
34
|
-
pathOrConfig.config !== undefined &&
|
|
35
|
-
isObject(pathOrConfig.config)
|
|
36
|
-
) {
|
|
37
|
-
return null
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// require('tailwindcss')('custom-config.js')
|
|
41
|
-
if (isString(pathOrConfig)) {
|
|
42
|
-
return path.resolve(pathOrConfig)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// require('tailwindcss')
|
|
46
|
-
for (const configFile of ['./tailwind.config.js', './tailwind.config.cjs']) {
|
|
47
|
-
try {
|
|
48
|
-
const configPath = path.resolve(configFile)
|
|
49
|
-
fs.accessSync(configPath)
|
|
50
|
-
return configPath
|
|
51
|
-
} catch (err) {}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return null
|
|
55
|
-
}
|
package/src/util/responsive.js
DELETED
package/src/util/tap.js
DELETED
package/src/util/toColorValue.js
DELETED
package/src/util/toPath.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a path string into an array of path segments.
|
|
3
|
-
*
|
|
4
|
-
* Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
|
|
5
|
-
*
|
|
6
|
-
* Example:
|
|
7
|
-
* a -> ['a]
|
|
8
|
-
* a.b.c -> ['a', 'b', 'c']
|
|
9
|
-
* a[b].c -> ['a', 'b', 'c']
|
|
10
|
-
* a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
|
|
11
|
-
* a[b][c][d] -> ['a', 'b', 'c', 'd']
|
|
12
|
-
*
|
|
13
|
-
* @param {string|string[]} path
|
|
14
|
-
**/
|
|
15
|
-
export function toPath(path) {
|
|
16
|
-
if (Array.isArray(path)) return path
|
|
17
|
-
|
|
18
|
-
let openBrackets = path.split('[').length - 1
|
|
19
|
-
let closedBrackets = path.split(']').length - 1
|
|
20
|
-
|
|
21
|
-
if (openBrackets !== closedBrackets) {
|
|
22
|
-
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean)
|
|
26
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import postcss from 'postcss'
|
|
2
|
-
|
|
3
|
-
export default function transformThemeValue(themeSection) {
|
|
4
|
-
if (['fontSize', 'outline'].includes(themeSection)) {
|
|
5
|
-
return (value) => {
|
|
6
|
-
if (typeof value === 'function') value = value({})
|
|
7
|
-
if (Array.isArray(value)) value = value[0]
|
|
8
|
-
|
|
9
|
-
return value
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
[
|
|
15
|
-
'fontFamily',
|
|
16
|
-
'boxShadow',
|
|
17
|
-
'transitionProperty',
|
|
18
|
-
'transitionDuration',
|
|
19
|
-
'transitionDelay',
|
|
20
|
-
'transitionTimingFunction',
|
|
21
|
-
'backgroundImage',
|
|
22
|
-
'backgroundSize',
|
|
23
|
-
'backgroundColor',
|
|
24
|
-
'cursor',
|
|
25
|
-
'animation',
|
|
26
|
-
].includes(themeSection)
|
|
27
|
-
) {
|
|
28
|
-
return (value) => {
|
|
29
|
-
if (typeof value === 'function') value = value({})
|
|
30
|
-
if (Array.isArray(value)) value = value.join(', ')
|
|
31
|
-
|
|
32
|
-
return value
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// For backwards compatibility reasons, before we switched to underscores
|
|
37
|
-
// instead of commas for arbitrary values.
|
|
38
|
-
if (['gridTemplateColumns', 'gridTemplateRows', 'objectPosition'].includes(themeSection)) {
|
|
39
|
-
return (value) => {
|
|
40
|
-
if (typeof value === 'function') value = value({})
|
|
41
|
-
if (typeof value === 'string') value = postcss.list.comma(value).join(' ')
|
|
42
|
-
|
|
43
|
-
return value
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (value) => {
|
|
48
|
-
if (typeof value === 'function') value = value({})
|
|
49
|
-
|
|
50
|
-
return value
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { parseColor, formatColor } from './color'
|
|
2
|
-
|
|
3
|
-
export function withAlphaValue(color, alphaValue, defaultValue) {
|
|
4
|
-
if (typeof color === 'function') {
|
|
5
|
-
return color({ opacityValue: alphaValue })
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let parsed = parseColor(color)
|
|
9
|
-
|
|
10
|
-
if (parsed === null) {
|
|
11
|
-
return defaultValue
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return formatColor({ ...parsed, alpha: alphaValue })
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function withAlphaVariable({ color, property, variable }) {
|
|
18
|
-
let properties = [].concat(property)
|
|
19
|
-
if (typeof color === 'function') {
|
|
20
|
-
return {
|
|
21
|
-
[variable]: '1',
|
|
22
|
-
...Object.fromEntries(
|
|
23
|
-
properties.map((p) => {
|
|
24
|
-
return [p, color({ opacityVariable: variable, opacityValue: `var(${variable})` })]
|
|
25
|
-
})
|
|
26
|
-
),
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const parsed = parseColor(color)
|
|
31
|
-
|
|
32
|
-
if (parsed === null) {
|
|
33
|
-
return Object.fromEntries(properties.map((p) => [p, color]))
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (parsed.alpha !== undefined) {
|
|
37
|
-
// Has an alpha value, return color as-is
|
|
38
|
-
return Object.fromEntries(properties.map((p) => [p, color]))
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
[variable]: '1',
|
|
43
|
-
...Object.fromEntries(
|
|
44
|
-
properties.map((p) => {
|
|
45
|
-
return [p, formatColor({ ...parsed, alpha: `var(${variable})` })]
|
|
46
|
-
})
|
|
47
|
-
),
|
|
48
|
-
}
|
|
49
|
-
}
|