tailwindcss 0.0.0-insiders.deefbf5 → 0.0.0-insiders.df96ea5
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 -17
- package/dist/chunk-GFBUASX3.mjs +1 -0
- package/dist/chunk-HTB5LLOP.mjs +1 -0
- package/dist/chunk-KV2PFGBW.mjs +38 -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 +3 -0
- package/dist/flatten-color-palette.mjs +1 -0
- package/dist/lib.d.mts +378 -0
- package/dist/lib.d.ts +3 -0
- package/dist/lib.js +38 -0
- package/dist/lib.mjs +1 -0
- package/dist/plugin.d.mts +11 -0
- package/dist/plugin.d.ts +134 -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-CJYAW1ql.d.mts +128 -0
- package/index.css +896 -0
- package/package.json +76 -100
- package/preflight.css +393 -0
- package/theme.css +462 -0
- package/CHANGELOG.md +0 -2206
- package/base.css +0 -1
- package/colors.d.ts +0 -3
- package/colors.js +0 -2
- package/components.css +0 -1
- package/defaultConfig.d.ts +0 -3
- package/defaultConfig.js +0 -2
- package/defaultTheme.d.ts +0 -4
- package/defaultTheme.js +0 -2
- package/lib/cli-peer-dependencies.js +0 -20
- package/lib/cli.js +0 -805
- package/lib/constants.js +0 -37
- package/lib/corePluginList.js +0 -179
- package/lib/corePlugins.js +0 -3662
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -360
- package/lib/featureFlags.js +0 -61
- package/lib/index.js +0 -40
- package/lib/lib/cacheInvalidation.js +0 -87
- package/lib/lib/collapseAdjacentRules.js +0 -56
- package/lib/lib/collapseDuplicateDeclarations.js +0 -80
- package/lib/lib/defaultExtractor.js +0 -228
- package/lib/lib/detectNesting.js +0 -34
- package/lib/lib/evaluateTailwindFunctions.js +0 -215
- package/lib/lib/expandApplyAtRules.js +0 -470
- package/lib/lib/expandTailwindAtRules.js +0 -276
- package/lib/lib/generateRules.js +0 -722
- package/lib/lib/getModuleDependencies.js +0 -48
- package/lib/lib/normalizeTailwindDirectives.js +0 -84
- package/lib/lib/partitionApplyAtRules.js +0 -53
- package/lib/lib/regex.js +0 -52
- package/lib/lib/resolveDefaultsAtRules.js +0 -154
- package/lib/lib/setupContextUtils.js +0 -932
- package/lib/lib/setupTrackingContext.js +0 -169
- package/lib/lib/sharedState.js +0 -51
- package/lib/lib/substituteScreenAtRules.js +0 -26
- 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 -84
- 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 -19
- package/lib/util/cloneDeep.js +0 -17
- package/lib/util/cloneNodes.js +0 -25
- package/lib/util/color.js +0 -90
- package/lib/util/configurePlugins.js +0 -18
- package/lib/util/createPlugin.js +0 -28
- package/lib/util/createUtilityPlugin.js +0 -48
- package/lib/util/dataTypes.js +0 -235
- 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 -14
- package/lib/util/formatVariantSelector.js +0 -194
- package/lib/util/getAllConfigs.js +0 -34
- 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 -63
- package/lib/util/log.js +0 -50
- package/lib/util/nameClass.js +0 -32
- package/lib/util/negateValue.js +0 -18
- package/lib/util/normalizeConfig.js +0 -250
- package/lib/util/normalizeScreens.js +0 -58
- package/lib/util/parseAnimationValue.js +0 -88
- package/lib/util/parseBoxShadowValue.js +0 -76
- package/lib/util/parseDependency.js +0 -63
- package/lib/util/parseObjectStyles.js +0 -31
- package/lib/util/pluginUtils.js +0 -187
- package/lib/util/prefixSelector.js +0 -20
- package/lib/util/removeAlphaVariables.js +0 -18
- package/lib/util/resolveConfig.js +0 -256
- package/lib/util/resolveConfigPath.js +0 -51
- package/lib/util/responsive.js +0 -19
- package/lib/util/splitAtTopLevelOnly.js +0 -90
- 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 -61
- package/lib/util/validateConfig.js +0 -21
- package/lib/util/withAlphaVariable.js +0 -67
- package/nesting/index.js +0 -2
- package/peers/index.js +0 -77956
- package/plugin.d.ts +0 -11
- 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/generate-types.js +0 -105
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/scripts/type-utils.js +0 -27
- package/src/cli-peer-dependencies.js +0 -15
- package/src/cli.js +0 -915
- package/src/constants.js +0 -17
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2442
- package/src/css/LICENSE +0 -25
- package/src/css/preflight.css +0 -360
- 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 -58
- package/src/lib/collapseDuplicateDeclarations.js +0 -93
- package/src/lib/defaultExtractor.js +0 -208
- package/src/lib/detectNesting.js +0 -39
- package/src/lib/evaluateTailwindFunctions.js +0 -248
- package/src/lib/expandApplyAtRules.js +0 -539
- package/src/lib/expandTailwindAtRules.js +0 -292
- package/src/lib/generateRules.js +0 -719
- package/src/lib/getModuleDependencies.js +0 -39
- package/src/lib/normalizeTailwindDirectives.js +0 -84
- package/src/lib/partitionApplyAtRules.js +0 -52
- package/src/lib/regex.js +0 -74
- package/src/lib/resolveDefaultsAtRules.js +0 -163
- package/src/lib/setupContextUtils.js +0 -977
- package/src/lib/setupTrackingContext.js +0 -187
- 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 -73
- 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 -254
- 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 -215
- package/src/util/getAllConfigs.js +0 -26
- 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 -262
- package/src/util/normalizeScreens.js +0 -45
- package/src/util/parseAnimationValue.js +0 -68
- package/src/util/parseBoxShadowValue.js +0 -72
- package/src/util/parseDependency.js +0 -49
- package/src/util/parseObjectStyles.js +0 -19
- package/src/util/pluginUtils.js +0 -204
- package/src/util/prefixSelector.js +0 -14
- package/src/util/removeAlphaVariables.js +0 -24
- package/src/util/resolveConfig.js +0 -283
- package/src/util/resolveConfigPath.js +0 -55
- package/src/util/responsive.js +0 -10
- package/src/util/splitAtTopLevelOnly.js +0 -71
- 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 -54
- package/src/util/validateConfig.js +0 -13
- package/src/util/withAlphaVariable.js +0 -49
- package/stubs/defaultConfig.stub.js +0 -954
- package/stubs/defaultPostCssConfig.stub.js +0 -6
- package/stubs/simpleConfig.stub.js +0 -8
- package/tailwind.css +0 -5
- package/types/config.d.ts +0 -327
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +0 -276
- package/types/generated/corePluginList.d.ts +0 -1
- package/types/generated/default-theme.d.ts +0 -331
- package/types/index.d.ts +0 -7
- package/variants.css +0 -1
package/src/util/pluginUtils.js
DELETED
|
@@ -1,204 +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 parseColorFormat(value) {
|
|
99
|
-
if (typeof value === 'string' && value.includes('<alpha-value>')) {
|
|
100
|
-
let oldValue = value
|
|
101
|
-
|
|
102
|
-
return ({ opacityValue = 1 }) => oldValue.replace('<alpha-value>', opacityValue)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return value
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function asColor(modifier, options = {}, { tailwindConfig = {} } = {}) {
|
|
109
|
-
if (options.values?.[modifier] !== undefined) {
|
|
110
|
-
return parseColorFormat(options.values?.[modifier])
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let [color, alpha] = splitAlpha(modifier)
|
|
114
|
-
|
|
115
|
-
if (alpha !== undefined) {
|
|
116
|
-
let normalizedColor =
|
|
117
|
-
options.values?.[color] ?? (isArbitraryValue(color) ? color.slice(1, -1) : undefined)
|
|
118
|
-
|
|
119
|
-
if (normalizedColor === undefined) {
|
|
120
|
-
return undefined
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
normalizedColor = parseColorFormat(normalizedColor)
|
|
124
|
-
|
|
125
|
-
if (isArbitraryValue(alpha)) {
|
|
126
|
-
return withAlphaValue(normalizedColor, alpha.slice(1, -1))
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (tailwindConfig.theme?.opacity?.[alpha] === undefined) {
|
|
130
|
-
return undefined
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return withAlphaValue(normalizedColor, tailwindConfig.theme.opacity[alpha])
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return asValue(modifier, options, { validate: validateColor })
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function asLookupValue(modifier, options = {}) {
|
|
140
|
-
return options.values?.[modifier]
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function guess(validate) {
|
|
144
|
-
return (modifier, options) => {
|
|
145
|
-
return asValue(modifier, options, { validate })
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let typeMap = {
|
|
150
|
-
any: asValue,
|
|
151
|
-
color: asColor,
|
|
152
|
-
url: guess(url),
|
|
153
|
-
image: guess(image),
|
|
154
|
-
length: guess(length),
|
|
155
|
-
percentage: guess(percentage),
|
|
156
|
-
position: guess(position),
|
|
157
|
-
lookup: asLookupValue,
|
|
158
|
-
'generic-name': guess(genericName),
|
|
159
|
-
'family-name': guess(familyName),
|
|
160
|
-
number: guess(number),
|
|
161
|
-
'line-width': guess(lineWidth),
|
|
162
|
-
'absolute-size': guess(absoluteSize),
|
|
163
|
-
'relative-size': guess(relativeSize),
|
|
164
|
-
shadow: guess(shadow),
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
let supportedTypes = Object.keys(typeMap)
|
|
168
|
-
|
|
169
|
-
function splitAtFirst(input, delim) {
|
|
170
|
-
let idx = input.indexOf(delim)
|
|
171
|
-
if (idx === -1) return [undefined, input]
|
|
172
|
-
return [input.slice(0, idx), input.slice(idx + 1)]
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function coerceValue(types, modifier, options, tailwindConfig) {
|
|
176
|
-
if (isArbitraryValue(modifier)) {
|
|
177
|
-
let arbitraryValue = modifier.slice(1, -1)
|
|
178
|
-
let [explicitType, value] = splitAtFirst(arbitraryValue, ':')
|
|
179
|
-
|
|
180
|
-
// It could be that this resolves to `url(https` which is not a valid
|
|
181
|
-
// identifier. We currently only support "simple" words with dashes or
|
|
182
|
-
// underscores. E.g.: family-name
|
|
183
|
-
if (!/^[\w-_]+$/g.test(explicitType)) {
|
|
184
|
-
value = arbitraryValue
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
else if (explicitType !== undefined && !supportedTypes.includes(explicitType)) {
|
|
189
|
-
return []
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (value.length > 0 && supportedTypes.includes(explicitType)) {
|
|
193
|
-
return [asValue(`[${value}]`, options), explicitType]
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Find first matching type
|
|
198
|
-
for (let type of [].concat(types)) {
|
|
199
|
-
let result = typeMap[type](modifier, options, { tailwindConfig })
|
|
200
|
-
if (result !== undefined) return [result, type]
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return []
|
|
204
|
-
}
|
|
@@ -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,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function removes any uses of CSS variables used as an alpha channel
|
|
3
|
-
*
|
|
4
|
-
* This is required for selectors like `:visited` which do not allow
|
|
5
|
-
* changes in opacity or external control using CSS variables.
|
|
6
|
-
*
|
|
7
|
-
* @param {import('postcss').Container} container
|
|
8
|
-
* @param {string[]} toRemove
|
|
9
|
-
*/
|
|
10
|
-
export function removeAlphaVariables(container, toRemove) {
|
|
11
|
-
container.walkDecls((decl) => {
|
|
12
|
-
if (toRemove.includes(decl.prop)) {
|
|
13
|
-
decl.remove()
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
for (let varName of toRemove) {
|
|
19
|
-
if (decl.value.includes(`/ var(${varName})`)) {
|
|
20
|
-
decl.value = decl.value.replace(`/ var(${varName})`, '')
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
}
|
|
@@ -1,283 +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
|
-
import { parseColorFormat } from './pluginUtils'
|
|
12
|
-
import { withAlphaValue } from './withAlphaVariable'
|
|
13
|
-
import toColorValue from './toColorValue'
|
|
14
|
-
|
|
15
|
-
function isFunction(input) {
|
|
16
|
-
return typeof input === 'function'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function isObject(input) {
|
|
20
|
-
return typeof input === 'object' && input !== null
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function mergeWith(target, ...sources) {
|
|
24
|
-
let customizer = sources.pop()
|
|
25
|
-
|
|
26
|
-
for (let source of sources) {
|
|
27
|
-
for (let k in source) {
|
|
28
|
-
let merged = customizer(target[k], source[k])
|
|
29
|
-
|
|
30
|
-
if (merged === undefined) {
|
|
31
|
-
if (isObject(target[k]) && isObject(source[k])) {
|
|
32
|
-
target[k] = mergeWith(target[k], source[k], customizer)
|
|
33
|
-
} else {
|
|
34
|
-
target[k] = source[k]
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
target[k] = merged
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return target
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const configUtils = {
|
|
46
|
-
colors,
|
|
47
|
-
negative(scale) {
|
|
48
|
-
// TODO: Log that this function isn't really needed anymore?
|
|
49
|
-
return Object.keys(scale)
|
|
50
|
-
.filter((key) => scale[key] !== '0')
|
|
51
|
-
.reduce((negativeScale, key) => {
|
|
52
|
-
let negativeValue = negateValue(scale[key])
|
|
53
|
-
|
|
54
|
-
if (negativeValue !== undefined) {
|
|
55
|
-
negativeScale[`-${key}`] = negativeValue
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return negativeScale
|
|
59
|
-
}, {})
|
|
60
|
-
},
|
|
61
|
-
breakpoints(screens) {
|
|
62
|
-
return Object.keys(screens)
|
|
63
|
-
.filter((key) => typeof screens[key] === 'string')
|
|
64
|
-
.reduce(
|
|
65
|
-
(breakpoints, key) => ({
|
|
66
|
-
...breakpoints,
|
|
67
|
-
[`screen-${key}`]: screens[key],
|
|
68
|
-
}),
|
|
69
|
-
{}
|
|
70
|
-
)
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function value(valueToResolve, ...args) {
|
|
75
|
-
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function collectExtends(items) {
|
|
79
|
-
return items.reduce((merged, { extend }) => {
|
|
80
|
-
return mergeWith(merged, extend, (mergedValue, extendValue) => {
|
|
81
|
-
if (mergedValue === undefined) {
|
|
82
|
-
return [extendValue]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (Array.isArray(mergedValue)) {
|
|
86
|
-
return [extendValue, ...mergedValue]
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return [extendValue, mergedValue]
|
|
90
|
-
})
|
|
91
|
-
}, {})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function mergeThemes(themes) {
|
|
95
|
-
return {
|
|
96
|
-
...themes.reduce((merged, theme) => defaults(merged, theme), {}),
|
|
97
|
-
|
|
98
|
-
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
99
|
-
// into arrays instead of objects so they aren't overridden.
|
|
100
|
-
extend: collectExtends(themes),
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function mergeExtensionCustomizer(merged, value) {
|
|
105
|
-
// When we have an array of objects, we do want to merge it
|
|
106
|
-
if (Array.isArray(merged) && isObject(merged[0])) {
|
|
107
|
-
return merged.concat(value)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
111
|
-
if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
|
|
112
|
-
return [merged, ...value]
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Override arrays (for example for font-families, box-shadows, ...)
|
|
116
|
-
if (Array.isArray(value)) {
|
|
117
|
-
return value
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Execute default behaviour
|
|
121
|
-
return undefined
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function mergeExtensions({ extend, ...theme }) {
|
|
125
|
-
return mergeWith(theme, extend, (themeValue, extensions) => {
|
|
126
|
-
// The `extend` property is an array, so we need to check if it contains any functions
|
|
127
|
-
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
128
|
-
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return (resolveThemePath, utils) =>
|
|
132
|
-
mergeWith(
|
|
133
|
-
{},
|
|
134
|
-
...[themeValue, ...extensions].map((e) => value(e, resolveThemePath, utils)),
|
|
135
|
-
mergeExtensionCustomizer
|
|
136
|
-
)
|
|
137
|
-
})
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param {string} key
|
|
143
|
-
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
144
|
-
*/
|
|
145
|
-
function* toPaths(key) {
|
|
146
|
-
let path = toPath(key)
|
|
147
|
-
|
|
148
|
-
if (path.length === 0) {
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
yield path
|
|
153
|
-
|
|
154
|
-
if (Array.isArray(key)) {
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
let pattern = /^(.*?)\s*\/\s*([^/]+)$/
|
|
159
|
-
let matches = key.match(pattern)
|
|
160
|
-
|
|
161
|
-
if (matches !== null) {
|
|
162
|
-
let [, prefix, alpha] = matches
|
|
163
|
-
|
|
164
|
-
let newPath = toPath(prefix)
|
|
165
|
-
newPath.alpha = alpha
|
|
166
|
-
|
|
167
|
-
yield newPath
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function resolveFunctionKeys(object) {
|
|
172
|
-
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
173
|
-
|
|
174
|
-
const resolvePath = (key, defaultValue) => {
|
|
175
|
-
for (const path of toPaths(key)) {
|
|
176
|
-
let index = 0
|
|
177
|
-
let val = object
|
|
178
|
-
|
|
179
|
-
while (val !== undefined && val !== null && index < path.length) {
|
|
180
|
-
val = val[path[index++]]
|
|
181
|
-
|
|
182
|
-
let shouldResolveAsFn =
|
|
183
|
-
isFunction(val) && (path.alpha === undefined || index < path.length - 1)
|
|
184
|
-
|
|
185
|
-
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (val !== undefined) {
|
|
189
|
-
if (path.alpha !== undefined) {
|
|
190
|
-
let normalized = parseColorFormat(val)
|
|
191
|
-
|
|
192
|
-
return withAlphaValue(normalized, path.alpha, toColorValue(normalized))
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (isPlainObject(val)) {
|
|
196
|
-
return cloneDeep(val)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return val
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return defaultValue
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
Object.assign(resolvePath, {
|
|
207
|
-
theme: resolvePath,
|
|
208
|
-
...configUtils,
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
return Object.keys(object).reduce((resolved, key) => {
|
|
212
|
-
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
213
|
-
|
|
214
|
-
return resolved
|
|
215
|
-
}, {})
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function extractPluginConfigs(configs) {
|
|
219
|
-
let allConfigs = []
|
|
220
|
-
|
|
221
|
-
configs.forEach((config) => {
|
|
222
|
-
allConfigs = [...allConfigs, config]
|
|
223
|
-
|
|
224
|
-
const plugins = config?.plugins ?? []
|
|
225
|
-
|
|
226
|
-
if (plugins.length === 0) {
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
plugins.forEach((plugin) => {
|
|
231
|
-
if (plugin.__isOptionsFunction) {
|
|
232
|
-
plugin = plugin()
|
|
233
|
-
}
|
|
234
|
-
allConfigs = [...allConfigs, ...extractPluginConfigs([plugin?.config ?? {}])]
|
|
235
|
-
})
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
return allConfigs
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function resolveCorePlugins(corePluginConfigs) {
|
|
242
|
-
const result = [...corePluginConfigs].reduceRight((resolved, corePluginConfig) => {
|
|
243
|
-
if (isFunction(corePluginConfig)) {
|
|
244
|
-
return corePluginConfig({ corePlugins: resolved })
|
|
245
|
-
}
|
|
246
|
-
return configurePlugins(corePluginConfig, resolved)
|
|
247
|
-
}, corePluginList)
|
|
248
|
-
|
|
249
|
-
return result
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function resolvePluginLists(pluginLists) {
|
|
253
|
-
const result = [...pluginLists].reduceRight((resolved, pluginList) => {
|
|
254
|
-
return [...resolved, ...pluginList]
|
|
255
|
-
}, [])
|
|
256
|
-
|
|
257
|
-
return result
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export default function resolveConfig(configs) {
|
|
261
|
-
let allConfigs = [
|
|
262
|
-
...extractPluginConfigs(configs),
|
|
263
|
-
{
|
|
264
|
-
prefix: '',
|
|
265
|
-
important: false,
|
|
266
|
-
separator: ':',
|
|
267
|
-
variantOrder: defaultConfig.variantOrder,
|
|
268
|
-
},
|
|
269
|
-
]
|
|
270
|
-
|
|
271
|
-
return normalizeConfig(
|
|
272
|
-
defaults(
|
|
273
|
-
{
|
|
274
|
-
theme: resolveFunctionKeys(
|
|
275
|
-
mergeExtensions(mergeThemes(allConfigs.map((t) => t?.theme ?? {})))
|
|
276
|
-
),
|
|
277
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c) => c.corePlugins)),
|
|
278
|
-
plugins: resolvePluginLists(configs.map((c) => c?.plugins ?? [])),
|
|
279
|
-
},
|
|
280
|
-
...allConfigs
|
|
281
|
-
)
|
|
282
|
-
)
|
|
283
|
-
}
|
|
@@ -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
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as regex from '../lib/regex'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This splits a string on a top-level character.
|
|
5
|
-
*
|
|
6
|
-
* Regex doesn't support recursion (at least not the JS-flavored version).
|
|
7
|
-
* So we have to use a tiny state machine to keep track of paren placement.
|
|
8
|
-
*
|
|
9
|
-
* Expected behavior using commas:
|
|
10
|
-
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
|
|
11
|
-
* ─┬─ ┬ ┬ ┬
|
|
12
|
-
* x x x ╰──────── Split because top-level
|
|
13
|
-
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
|
|
14
|
-
*
|
|
15
|
-
* @param {string} input
|
|
16
|
-
* @param {string} separator
|
|
17
|
-
*/
|
|
18
|
-
export function* splitAtTopLevelOnly(input, separator) {
|
|
19
|
-
let SPECIALS = new RegExp(`[(){}\\[\\]${regex.escape(separator)}]`, 'g')
|
|
20
|
-
|
|
21
|
-
let depth = 0
|
|
22
|
-
let lastIndex = 0
|
|
23
|
-
let found = false
|
|
24
|
-
let separatorIndex = 0
|
|
25
|
-
let separatorStart = 0
|
|
26
|
-
let separatorLength = separator.length
|
|
27
|
-
|
|
28
|
-
// Find all paren-like things & character
|
|
29
|
-
// And only split on commas if they're top-level
|
|
30
|
-
for (let match of input.matchAll(SPECIALS)) {
|
|
31
|
-
let matchesSeparator = match[0] === separator[separatorIndex]
|
|
32
|
-
let atEndOfSeparator = separatorIndex === separatorLength - 1
|
|
33
|
-
let matchesFullSeparator = matchesSeparator && atEndOfSeparator
|
|
34
|
-
|
|
35
|
-
if (match[0] === '(') depth++
|
|
36
|
-
if (match[0] === ')') depth--
|
|
37
|
-
if (match[0] === '[') depth++
|
|
38
|
-
if (match[0] === ']') depth--
|
|
39
|
-
if (match[0] === '{') depth++
|
|
40
|
-
if (match[0] === '}') depth--
|
|
41
|
-
|
|
42
|
-
if (matchesSeparator && depth === 0) {
|
|
43
|
-
if (separatorStart === 0) {
|
|
44
|
-
separatorStart = match.index
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
separatorIndex++
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (matchesFullSeparator && depth === 0) {
|
|
51
|
-
found = true
|
|
52
|
-
|
|
53
|
-
yield input.substring(lastIndex, separatorStart)
|
|
54
|
-
lastIndex = separatorStart + separatorLength
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (separatorIndex === separatorLength) {
|
|
58
|
-
separatorIndex = 0
|
|
59
|
-
separatorStart = 0
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Provide the last segment of the string if available
|
|
64
|
-
// Otherwise the whole string since no `char`s were found
|
|
65
|
-
// This mirrors the behavior of string.split()
|
|
66
|
-
if (found) {
|
|
67
|
-
yield input.substring(lastIndex)
|
|
68
|
-
} else {
|
|
69
|
-
yield input
|
|
70
|
-
}
|
|
71
|
-
}
|
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
|
-
}
|