tailwindcss 0.0.0-insiders.f9fb2ce → 0.0.0-insiders.fa3f45f
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/LICENSE +1 -2
- package/README.md +18 -15
- package/dist/chunk-4V6TN65S.mjs +35 -0
- package/dist/chunk-G32FJCSR.mjs +1 -0
- package/dist/chunk-HTB5LLOP.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 +3 -0
- package/dist/flatten-color-palette.mjs +1 -0
- package/dist/lib.d.mts +351 -0
- package/dist/lib.d.ts +3 -0
- package/dist/lib.js +35 -0
- package/dist/lib.mjs +1 -0
- package/dist/plugin.d.mts +11 -0
- package/dist/plugin.d.ts +131 -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-WlZgYgM8.d.mts +125 -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 -1816
- package/base.css +0 -1
- package/colors.js +0 -1
- package/components.css +0 -1
- package/defaultConfig.js +0 -1
- package/defaultTheme.js +0 -1
- package/lib/cli-peer-dependencies.js +0 -15
- package/lib/cli.js +0 -706
- package/lib/constants.js +0 -37
- package/lib/corePluginList.js +0 -174
- package/lib/corePlugins.js +0 -3562
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -366
- package/lib/featureFlags.js +0 -60
- package/lib/index.js +0 -32
- package/lib/lib/collapseAdjacentRules.js +0 -41
- package/lib/lib/collapseDuplicateDeclarations.js +0 -29
- package/lib/lib/detectNesting.js +0 -19
- package/lib/lib/evaluateTailwindFunctions.js +0 -167
- package/lib/lib/expandApplyAtRules.js +0 -228
- package/lib/lib/expandTailwindAtRules.js +0 -245
- package/lib/lib/generateRules.js +0 -493
- package/lib/lib/getModuleDependencies.js +0 -48
- package/lib/lib/normalizeTailwindDirectives.js +0 -76
- package/lib/lib/resolveDefaultsAtRules.js +0 -125
- package/lib/lib/setupContextUtils.js +0 -860
- package/lib/lib/setupTrackingContext.js +0 -170
- package/lib/lib/setupWatchingContext.js +0 -288
- package/lib/lib/sharedState.js +0 -19
- package/lib/lib/substituteScreenAtRules.js +0 -24
- package/lib/processTailwindFeatures.js +0 -51
- 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 -31
- package/lib/util/cloneDeep.js +0 -19
- package/lib/util/cloneNodes.js +0 -14
- package/lib/util/color.js +0 -84
- package/lib/util/configurePlugins.js +0 -18
- package/lib/util/createPlugin.js +0 -30
- package/lib/util/createUtilityPlugin.js +0 -53
- package/lib/util/dataTypes.js +0 -211
- package/lib/util/defaults.js +0 -16
- package/lib/util/escapeClassName.js +0 -19
- package/lib/util/escapeCommas.js +0 -8
- package/lib/util/flattenColorPalette.js +0 -19
- package/lib/util/formatVariantSelector.js +0 -102
- 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/log.js +0 -47
- package/lib/util/nameClass.js +0 -31
- package/lib/util/negateValue.js +0 -19
- package/lib/util/normalizeConfig.js +0 -208
- package/lib/util/parseAnimationValue.js +0 -89
- package/lib/util/parseDependency.js +0 -63
- package/lib/util/parseObjectStyles.js +0 -31
- package/lib/util/pluginUtils.js +0 -185
- package/lib/util/prefixSelector.js +0 -21
- package/lib/util/resolveConfig.js +0 -234
- package/lib/util/resolveConfigPath.js +0 -52
- package/lib/util/responsive.js +0 -19
- package/lib/util/tap.js +0 -9
- package/lib/util/toColorValue.js +0 -9
- package/lib/util/toPath.js +0 -9
- package/lib/util/transformThemeValue.js +0 -63
- package/lib/util/withAlphaVariable.js +0 -67
- package/nesting/README.md +0 -42
- package/nesting/index.js +0 -12
- package/nesting/plugin.js +0 -41
- package/peers/index.js +0 -75407
- package/plugin.js +0 -1
- package/prettier.config.js +0 -19
- package/resolveConfig.js +0 -1
- 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 -768
- package/src/constants.js +0 -17
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2291
- package/src/css/LICENSE +0 -25
- package/src/css/preflight.css +0 -366
- package/src/featureFlags.js +0 -54
- package/src/index.js +0 -34
- package/src/lib/collapseAdjacentRules.js +0 -39
- package/src/lib/collapseDuplicateDeclarations.js +0 -28
- package/src/lib/detectNesting.js +0 -20
- package/src/lib/evaluateTailwindFunctions.js +0 -195
- package/src/lib/expandApplyAtRules.js +0 -251
- package/src/lib/expandTailwindAtRules.js +0 -252
- package/src/lib/generateRules.js +0 -495
- package/src/lib/getModuleDependencies.js +0 -39
- package/src/lib/normalizeTailwindDirectives.js +0 -78
- package/src/lib/resolveDefaultsAtRules.js +0 -121
- package/src/lib/setupContextUtils.js +0 -853
- package/src/lib/setupTrackingContext.js +0 -182
- package/src/lib/setupWatchingContext.js +0 -311
- package/src/lib/sharedState.js +0 -10
- package/src/lib/substituteScreenAtRules.js +0 -16
- package/src/processTailwindFeatures.js +0 -48
- 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 -24
- package/src/util/cloneDeep.js +0 -11
- package/src/util/cloneNodes.js +0 -11
- package/src/util/color.js +0 -56
- 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 -230
- package/src/util/defaults.js +0 -11
- 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 -105
- 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/log.js +0 -25
- package/src/util/nameClass.js +0 -26
- package/src/util/negateValue.js +0 -16
- package/src/util/normalizeConfig.js +0 -249
- package/src/util/parseAnimationValue.js +0 -68
- package/src/util/parseDependency.js +0 -49
- package/src/util/parseObjectStyles.js +0 -19
- package/src/util/pluginUtils.js +0 -190
- package/src/util/prefixSelector.js +0 -12
- package/src/util/resolveConfig.js +0 -229
- 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 -4
- package/src/util/transformThemeValue.js +0 -52
- package/src/util/withAlphaVariable.js +0 -49
- package/stubs/defaultConfig.stub.js +0 -932
- 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/dataTypes.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { parseColor } from './color'
|
|
2
|
-
|
|
3
|
-
// Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
|
|
4
|
-
|
|
5
|
-
let COMMA = /,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
6
|
-
let UNDERSCORE = /_(?![^(]*\))/g // Underscore separator that is not located between brackets. E.g.: `rgba(255,_255,_255)_black` these don't count.
|
|
7
|
-
|
|
8
|
-
// This is not a data type, but rather a function that can normalize the
|
|
9
|
-
// correct values.
|
|
10
|
-
export function normalize(value, isRoot = true) {
|
|
11
|
-
// Keep raw strings if it starts with `url(`
|
|
12
|
-
if (value.includes('url(')) {
|
|
13
|
-
return value
|
|
14
|
-
.split(/(url\(.*?\))/g)
|
|
15
|
-
.filter(Boolean)
|
|
16
|
-
.map((part) => {
|
|
17
|
-
if (/^url\(.*?\)$/.test(part)) {
|
|
18
|
-
return part
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return normalize(part, false)
|
|
22
|
-
})
|
|
23
|
-
.join('')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Convert `_` to ` `, except for escaped underscores `\_`
|
|
27
|
-
value = value
|
|
28
|
-
.replace(
|
|
29
|
-
/([^\\])_+/g,
|
|
30
|
-
(fullMatch, characterBefore) => characterBefore + ' '.repeat(fullMatch.length - 1)
|
|
31
|
-
)
|
|
32
|
-
.replace(/^_/g, ' ')
|
|
33
|
-
.replace(/\\_/g, '_')
|
|
34
|
-
|
|
35
|
-
// Remove leftover whitespace
|
|
36
|
-
if (isRoot) {
|
|
37
|
-
value = value.trim()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Add spaces around operators inside calc() that do not follow an operator
|
|
41
|
-
// or '('.
|
|
42
|
-
return value.replace(
|
|
43
|
-
/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,
|
|
44
|
-
'$1 $2 '
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function url(value) {
|
|
49
|
-
return value.startsWith('url(')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function number(value) {
|
|
53
|
-
return !isNaN(Number(value))
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function percentage(value) {
|
|
57
|
-
return /%$/g.test(value) || /^calc\(.+?%\)/g.test(value)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
let lengthUnits = [
|
|
61
|
-
'cm',
|
|
62
|
-
'mm',
|
|
63
|
-
'Q',
|
|
64
|
-
'in',
|
|
65
|
-
'pc',
|
|
66
|
-
'pt',
|
|
67
|
-
'px',
|
|
68
|
-
'em',
|
|
69
|
-
'ex',
|
|
70
|
-
'ch',
|
|
71
|
-
'rem',
|
|
72
|
-
'lh',
|
|
73
|
-
'vw',
|
|
74
|
-
'vh',
|
|
75
|
-
'vmin',
|
|
76
|
-
'vmax',
|
|
77
|
-
]
|
|
78
|
-
let lengthUnitsPattern = `(?:${lengthUnits.join('|')})`
|
|
79
|
-
export function length(value) {
|
|
80
|
-
return (
|
|
81
|
-
new RegExp(`${lengthUnitsPattern}$`).test(value) ||
|
|
82
|
-
new RegExp(`^calc\\(.+?${lengthUnitsPattern}`).test(value)
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
let lineWidths = new Set(['thin', 'medium', 'thick'])
|
|
87
|
-
export function lineWidth(value) {
|
|
88
|
-
return lineWidths.has(value)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function color(value) {
|
|
92
|
-
let colors = 0
|
|
93
|
-
|
|
94
|
-
let result = value.split(UNDERSCORE).every((part) => {
|
|
95
|
-
part = normalize(part)
|
|
96
|
-
|
|
97
|
-
if (part.startsWith('var(')) return true
|
|
98
|
-
if (parseColor(part) !== null) return colors++, true
|
|
99
|
-
|
|
100
|
-
return false
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
if (!result) return false
|
|
104
|
-
return colors > 0
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function image(value) {
|
|
108
|
-
let images = 0
|
|
109
|
-
let result = value.split(COMMA).every((part) => {
|
|
110
|
-
part = normalize(part)
|
|
111
|
-
|
|
112
|
-
if (part.startsWith('var(')) return true
|
|
113
|
-
if (
|
|
114
|
-
url(part) ||
|
|
115
|
-
gradient(part) ||
|
|
116
|
-
['element(', 'image(', 'cross-fade(', 'image-set('].some((fn) => part.startsWith(fn))
|
|
117
|
-
) {
|
|
118
|
-
images++
|
|
119
|
-
return true
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return false
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
if (!result) return false
|
|
126
|
-
return images > 0
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let gradientTypes = new Set([
|
|
130
|
-
'linear-gradient',
|
|
131
|
-
'radial-gradient',
|
|
132
|
-
'repeating-linear-gradient',
|
|
133
|
-
'repeating-radial-gradient',
|
|
134
|
-
'conic-gradient',
|
|
135
|
-
])
|
|
136
|
-
export function gradient(value) {
|
|
137
|
-
value = normalize(value)
|
|
138
|
-
|
|
139
|
-
for (let type of gradientTypes) {
|
|
140
|
-
if (value.startsWith(`${type}(`)) {
|
|
141
|
-
return true
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return false
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
let validPositions = new Set(['center', 'top', 'right', 'bottom', 'left'])
|
|
148
|
-
export function position(value) {
|
|
149
|
-
let positions = 0
|
|
150
|
-
let result = value.split(UNDERSCORE).every((part) => {
|
|
151
|
-
part = normalize(part)
|
|
152
|
-
|
|
153
|
-
if (part.startsWith('var(')) return true
|
|
154
|
-
if (validPositions.has(part) || length(part) || percentage(part)) {
|
|
155
|
-
positions++
|
|
156
|
-
return true
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return false
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
if (!result) return false
|
|
163
|
-
return positions > 0
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export function familyName(value) {
|
|
167
|
-
let fonts = 0
|
|
168
|
-
let result = value.split(COMMA).every((part) => {
|
|
169
|
-
part = normalize(part)
|
|
170
|
-
|
|
171
|
-
if (part.startsWith('var(')) return true
|
|
172
|
-
|
|
173
|
-
// If it contains spaces, then it should be quoted
|
|
174
|
-
if (part.includes(' ')) {
|
|
175
|
-
if (!/(['"])([^"']+)\1/g.test(part)) {
|
|
176
|
-
return false
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// If it starts with a number, it's invalid
|
|
181
|
-
if (/^\d/g.test(part)) {
|
|
182
|
-
return false
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
fonts++
|
|
186
|
-
|
|
187
|
-
return true
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
if (!result) return false
|
|
191
|
-
return fonts > 0
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
let genericNames = new Set([
|
|
195
|
-
'serif',
|
|
196
|
-
'sans-serif',
|
|
197
|
-
'monospace',
|
|
198
|
-
'cursive',
|
|
199
|
-
'fantasy',
|
|
200
|
-
'system-ui',
|
|
201
|
-
'ui-serif',
|
|
202
|
-
'ui-sans-serif',
|
|
203
|
-
'ui-monospace',
|
|
204
|
-
'ui-rounded',
|
|
205
|
-
'math',
|
|
206
|
-
'emoji',
|
|
207
|
-
'fangsong',
|
|
208
|
-
])
|
|
209
|
-
export function genericName(value) {
|
|
210
|
-
return genericNames.has(value)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
let absoluteSizes = new Set([
|
|
214
|
-
'xx-small',
|
|
215
|
-
'x-small',
|
|
216
|
-
'small',
|
|
217
|
-
'medium',
|
|
218
|
-
'large',
|
|
219
|
-
'x-large',
|
|
220
|
-
'x-large',
|
|
221
|
-
'xxx-large',
|
|
222
|
-
])
|
|
223
|
-
export function absoluteSize(value) {
|
|
224
|
-
return absoluteSizes.has(value)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
let relativeSizes = new Set(['larger', 'smaller'])
|
|
228
|
-
export function relativeSize(value) {
|
|
229
|
-
return relativeSizes.has(value)
|
|
230
|
-
}
|
package/src/util/defaults.js
DELETED
package/src/util/escapeCommas.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const flattenColorPalette = (colors) =>
|
|
2
|
-
Object.assign(
|
|
3
|
-
{},
|
|
4
|
-
...Object.entries(colors ?? {}).flatMap(([color, values]) =>
|
|
5
|
-
typeof values == 'object'
|
|
6
|
-
? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
|
|
7
|
-
[color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex,
|
|
8
|
-
}))
|
|
9
|
-
: [{ [`${color}`]: values }]
|
|
10
|
-
)
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
export default flattenColorPalette
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import selectorParser from 'postcss-selector-parser'
|
|
2
|
-
import unescape from 'postcss-selector-parser/dist/util/unesc'
|
|
3
|
-
import escapeClassName from '../util/escapeClassName'
|
|
4
|
-
import prefixSelector from '../util/prefixSelector'
|
|
5
|
-
|
|
6
|
-
let MERGE = ':merge'
|
|
7
|
-
let PARENT = '&'
|
|
8
|
-
|
|
9
|
-
export let selectorFunctions = new Set([MERGE])
|
|
10
|
-
|
|
11
|
-
export function formatVariantSelector(current, ...others) {
|
|
12
|
-
for (let other of others) {
|
|
13
|
-
let incomingValue = resolveFunctionArgument(other, MERGE)
|
|
14
|
-
if (incomingValue !== null) {
|
|
15
|
-
let existingValue = resolveFunctionArgument(current, MERGE, incomingValue)
|
|
16
|
-
if (existingValue !== null) {
|
|
17
|
-
let existingTarget = `${MERGE}(${incomingValue})`
|
|
18
|
-
let splitIdx = other.indexOf(existingTarget)
|
|
19
|
-
let addition = other.slice(splitIdx + existingTarget.length).split(' ')[0]
|
|
20
|
-
|
|
21
|
-
current = current.replace(existingTarget, existingTarget + addition)
|
|
22
|
-
continue
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
current = other.replace(PARENT, current)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return current
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function finalizeSelector(format, { selector, candidate, context }) {
|
|
33
|
-
let base = candidate.split(context?.tailwindConfig?.separator ?? ':').pop()
|
|
34
|
-
|
|
35
|
-
if (context?.tailwindConfig?.prefix) {
|
|
36
|
-
format = prefixSelector(context.tailwindConfig.prefix, format)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
format = format.replace(PARENT, `.${escapeClassName(candidate)}`)
|
|
40
|
-
|
|
41
|
-
// Normalize escaped classes, e.g.:
|
|
42
|
-
//
|
|
43
|
-
// The idea would be to replace the escaped `base` in the selector with the
|
|
44
|
-
// `format`. However, in css you can escape the same selector in a few
|
|
45
|
-
// different ways. This would result in different strings and therefore we
|
|
46
|
-
// can't replace it properly.
|
|
47
|
-
//
|
|
48
|
-
// base: bg-[rgb(255,0,0)]
|
|
49
|
-
// base in selector: bg-\\[rgb\\(255\\,0\\,0\\)\\]
|
|
50
|
-
// escaped base: bg-\\[rgb\\(255\\2c 0\\2c 0\\)\\]
|
|
51
|
-
//
|
|
52
|
-
selector = selectorParser((selectors) => {
|
|
53
|
-
return selectors.walkClasses((node) => {
|
|
54
|
-
if (node.raws && node.value.includes(base)) {
|
|
55
|
-
node.raws.value = escapeClassName(unescape(node.raws.value))
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return node
|
|
59
|
-
})
|
|
60
|
-
}).processSync(selector)
|
|
61
|
-
|
|
62
|
-
// We can safely replace the escaped base now, since the `base` section is
|
|
63
|
-
// now in a normalized escaped value.
|
|
64
|
-
selector = selector.replace(`.${escapeClassName(base)}`, format)
|
|
65
|
-
|
|
66
|
-
// Remove unnecessary pseudo selectors that we used as placeholders
|
|
67
|
-
return selectorParser((selectors) => {
|
|
68
|
-
return selectors.map((selector) => {
|
|
69
|
-
selector.walkPseudos((p) => {
|
|
70
|
-
if (selectorFunctions.has(p.value)) {
|
|
71
|
-
p.replaceWith(p.nodes)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return p
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
return selector
|
|
78
|
-
})
|
|
79
|
-
}).processSync(selector)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function resolveFunctionArgument(haystack, needle, arg) {
|
|
83
|
-
let startIdx = haystack.indexOf(arg ? `${needle}(${arg})` : needle)
|
|
84
|
-
if (startIdx === -1) return null
|
|
85
|
-
|
|
86
|
-
// Start inside the `(`
|
|
87
|
-
startIdx += needle.length + 1
|
|
88
|
-
|
|
89
|
-
let target = ''
|
|
90
|
-
let count = 0
|
|
91
|
-
|
|
92
|
-
for (let char of haystack.slice(startIdx)) {
|
|
93
|
-
if (char !== '(' && char !== ')') {
|
|
94
|
-
target += char
|
|
95
|
-
} else if (char === '(') {
|
|
96
|
-
target += char
|
|
97
|
-
count++
|
|
98
|
-
} else if (char === ')') {
|
|
99
|
-
if (--count < 0) break // unbalanced
|
|
100
|
-
target += char
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return target
|
|
105
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import defaultConfig from '../../stubs/defaultConfig.stub.js'
|
|
2
|
-
import { flagEnabled } from '../featureFlags'
|
|
3
|
-
|
|
4
|
-
export default function getAllConfigs(config) {
|
|
5
|
-
const configs = (config?.presets ?? [defaultConfig])
|
|
6
|
-
.slice()
|
|
7
|
-
.reverse()
|
|
8
|
-
.flatMap((preset) => getAllConfigs(preset instanceof Function ? preset() : preset))
|
|
9
|
-
|
|
10
|
-
const features = {
|
|
11
|
-
// Add experimental configs here...
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const experimentals = Object.keys(features)
|
|
15
|
-
.filter((feature) => flagEnabled(config, feature))
|
|
16
|
-
.map((feature) => features[feature])
|
|
17
|
-
|
|
18
|
-
return [config, ...experimentals, ...configs]
|
|
19
|
-
}
|
package/src/util/hashConfig.js
DELETED
package/src/util/log.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk'
|
|
2
|
-
|
|
3
|
-
let alreadyShown = new Set()
|
|
4
|
-
|
|
5
|
-
function log(chalk, messages, key) {
|
|
6
|
-
if (process.env.JEST_WORKER_ID !== undefined) return
|
|
7
|
-
|
|
8
|
-
if (key && alreadyShown.has(key)) return
|
|
9
|
-
if (key) alreadyShown.add(key)
|
|
10
|
-
|
|
11
|
-
console.warn('')
|
|
12
|
-
messages.forEach((message) => console.warn(chalk, '-', message))
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
info(key, messages) {
|
|
17
|
-
log(chalk.bold.cyan('info'), ...(Array.isArray(key) ? [key] : [messages, key]))
|
|
18
|
-
},
|
|
19
|
-
warn(key, messages) {
|
|
20
|
-
log(chalk.bold.yellow('warn'), ...(Array.isArray(key) ? [key] : [messages, key]))
|
|
21
|
-
},
|
|
22
|
-
risk(key, messages) {
|
|
23
|
-
log(chalk.bold.magenta('risk'), ...(Array.isArray(key) ? [key] : [messages, key]))
|
|
24
|
-
},
|
|
25
|
-
}
|
package/src/util/nameClass.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import escapeClassName from './escapeClassName'
|
|
2
|
-
import escapeCommas from './escapeCommas'
|
|
3
|
-
|
|
4
|
-
function asClass(name) {
|
|
5
|
-
return escapeCommas(`.${escapeClassName(name)}`)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function nameClass(classPrefix, key) {
|
|
9
|
-
return asClass(formatClass(classPrefix, key))
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function formatClass(classPrefix, key) {
|
|
13
|
-
if (key === 'DEFAULT') {
|
|
14
|
-
return classPrefix
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (key === '-' || key === '-DEFAULT') {
|
|
18
|
-
return `-${classPrefix}`
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (key.startsWith('-')) {
|
|
22
|
-
return `-${classPrefix}${key}`
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return `${classPrefix}-${key}`
|
|
26
|
-
}
|
package/src/util/negateValue.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default function (value) {
|
|
2
|
-
value = `${value}`
|
|
3
|
-
|
|
4
|
-
if (value === '0') {
|
|
5
|
-
return '0'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Flip sign of numbers
|
|
9
|
-
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
|
10
|
-
return value.replace(/^[+-]?/, (sign) => (sign === '-' ? '' : '-'))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (value.includes('var(') || value.includes('calc(')) {
|
|
14
|
-
return `calc(${value} * -1)`
|
|
15
|
-
}
|
|
16
|
-
}
|