tailwindcss 0.0.0-insiders.bb4f5da → 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 -98
- package/preflight.css +383 -0
- package/theme.css +453 -0
- package/CHANGELOG.md +0 -2130
- 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 -3
- package/defaultTheme.js +0 -2
- package/lib/cli-peer-dependencies.js +0 -16
- package/lib/cli.js +0 -798
- package/lib/constants.js +0 -37
- package/lib/corePluginList.js +0 -179
- package/lib/corePlugins.js +0 -3634
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -360
- 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 -57
- package/lib/lib/collapseDuplicateDeclarations.js +0 -80
- package/lib/lib/defaultExtractor.js +0 -171
- package/lib/lib/detectNesting.js +0 -34
- package/lib/lib/evaluateTailwindFunctions.js +0 -171
- package/lib/lib/expandApplyAtRules.js +0 -485
- package/lib/lib/expandTailwindAtRules.js +0 -262
- package/lib/lib/generateRules.js +0 -672
- 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 -53
- package/lib/lib/resolveDefaultsAtRules.js +0 -143
- package/lib/lib/setupContextUtils.js +0 -908
- package/lib/lib/setupTrackingContext.js +0 -174
- 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 -95
- 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 -242
- 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 -196
- 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 -233
- package/lib/util/normalizeScreens.js +0 -59
- package/lib/util/parseAnimationValue.js +0 -89
- 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 -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/splitAtTopLevelOnly.js +0 -72
- 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/validateConfig.js +0 -21
- package/lib/util/withAlphaVariable.js +0 -67
- package/nesting/index.js +0 -2
- package/peers/index.js +0 -75881
- package/plugin.d.ts +0 -6
- 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 -52
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli-peer-dependencies.js +0 -11
- package/src/cli.js +0 -883
- package/src/constants.js +0 -17
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2409
- 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 -180
- package/src/lib/detectNesting.js +0 -39
- package/src/lib/evaluateTailwindFunctions.js +0 -198
- package/src/lib/expandApplyAtRules.js +0 -539
- package/src/lib/expandTailwindAtRules.js +0 -292
- package/src/lib/generateRules.js +0 -672
- 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 -146
- package/src/lib/setupContextUtils.js +0 -945
- 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 -256
- 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 -207
- 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 -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 -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/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 -52
- package/src/util/validateConfig.js +0 -13
- package/src/util/withAlphaVariable.js +0 -49
- package/stubs/defaultConfig.stub.js +0 -953
- package/stubs/defaultPostCssConfig.stub.js +0 -6
- package/stubs/simpleConfig.stub.js +0 -7
- package/tailwind.css +0 -5
- package/types/config.d.ts +0 -323
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +0 -276
- package/types/generated/corePluginList.d.ts +0 -1
- package/types/index.d.ts +0 -1
- package/types.d.ts +0 -1
- package/variants.css +0 -1
|
@@ -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
|
@@ -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
|
-
}
|
|
@@ -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,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -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
|
-
}
|