tailwindcss 0.0.0-insiders.dddaded → 0.0.0-insiders.de00a62
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/lib/cli/build/deps.js +17 -9
- package/lib/cli/build/index.js +10 -8
- package/lib/cli/build/plugin.js +31 -29
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +13 -11
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +4 -4
- package/lib/cli/init/index.js +8 -6
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +8 -2
- package/lib/corePlugins.js +211 -48
- package/lib/css/preflight.css +24 -8
- package/lib/featureFlags.js +14 -9
- package/lib/index.js +1 -5
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +3 -1
- package/lib/lib/collapseDuplicateDeclarations.js +10 -8
- package/lib/lib/content.js +51 -14
- package/lib/lib/defaultExtractor.js +38 -28
- package/lib/lib/detectNesting.js +3 -1
- package/lib/lib/evaluateTailwindFunctions.js +20 -16
- package/lib/lib/expandApplyAtRules.js +41 -33
- package/lib/lib/expandTailwindAtRules.js +38 -19
- package/lib/lib/findAtConfigPath.js +6 -4
- package/lib/lib/generateRules.js +83 -55
- package/lib/lib/getModuleDependencies.js +10 -8
- package/lib/lib/load-config.js +18 -5
- package/lib/lib/normalizeTailwindDirectives.js +5 -3
- package/lib/lib/offsets.js +58 -7
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +3 -1
- package/lib/lib/resolveDefaultsAtRules.js +27 -21
- package/lib/lib/setupContextUtils.js +143 -94
- package/lib/lib/setupTrackingContext.js +27 -24
- package/lib/lib/sharedState.js +28 -24
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/oxide/cli/build/deps.js +16 -8
- package/lib/oxide/cli/build/index.js +6 -4
- package/lib/oxide/cli/build/plugin.js +25 -23
- package/lib/oxide/cli/build/utils.js +18 -8
- package/lib/oxide/cli/build/watching.js +10 -8
- package/lib/oxide/cli/help/index.js +6 -4
- package/lib/oxide/cli/index.js +4 -4
- package/lib/oxide/cli/init/index.js +6 -4
- package/lib/plugin.js +9 -9
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +8 -6
- package/lib/processTailwindFeatures.js +16 -14
- package/lib/public/colors.js +5 -3
- package/lib/public/create-plugin.js +5 -3
- package/lib/public/default-config.js +6 -4
- package/lib/public/default-theme.js +6 -4
- package/lib/public/load-config.js +5 -3
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +7 -5
- package/lib/util/bigSign.js +3 -1
- package/lib/util/buildMediaQuery.js +3 -1
- package/lib/util/cloneDeep.js +3 -1
- package/lib/util/cloneNodes.js +36 -14
- package/lib/util/color.js +11 -7
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +3 -1
- package/lib/util/createPlugin.js +3 -1
- package/lib/util/createUtilityPlugin.js +5 -3
- package/lib/util/dataTypes.js +180 -31
- package/lib/util/defaults.js +6 -4
- package/lib/util/escapeClassName.js +7 -5
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +36 -21
- package/lib/util/getAllConfigs.js +6 -4
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +4 -2
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +8 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +3 -1
- package/lib/util/normalizeConfig.js +7 -5
- package/lib/util/normalizeScreens.js +12 -4
- package/lib/util/parseAnimationValue.js +3 -1
- package/lib/util/parseBoxShadowValue.js +6 -2
- package/lib/util/parseDependency.js +3 -1
- package/lib/util/parseGlob.js +6 -4
- package/lib/util/parseObjectStyles.js +9 -7
- package/lib/util/pluginUtils.js +43 -18
- package/lib/util/prefixSelector.js +6 -4
- package/lib/util/pseudoElements.js +24 -35
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +10 -8
- package/lib/util/resolveConfigPath.js +9 -5
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +3 -1
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +3 -1
- package/lib/util/toPath.js +3 -1
- package/lib/util/transformThemeValue.js +6 -4
- package/lib/util/validateConfig.js +5 -3
- package/lib/util/validateFormalSyntax.js +3 -1
- package/lib/util/withAlphaVariable.js +6 -2
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/nesting/index.d.ts +4 -0
- package/package.json +31 -36
- package/peers/index.js +65266 -48224
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/src/cli/build/plugin.js +7 -7
- package/src/cli/build/watching.js +1 -1
- package/src/cli.js +1 -1
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +165 -29
- package/src/css/preflight.css +24 -8
- package/src/featureFlags.js +3 -8
- package/src/index.js +1 -5
- package/src/lib/content.js +42 -1
- package/src/lib/defaultExtractor.js +30 -17
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandApplyAtRules.js +7 -0
- package/src/lib/expandTailwindAtRules.js +26 -9
- package/src/lib/generateRules.js +50 -26
- package/src/lib/load-config.ts +8 -0
- package/src/lib/offsets.js +61 -2
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +77 -38
- package/src/lib/setupTrackingContext.js +2 -4
- package/src/lib/sharedState.js +0 -15
- package/src/oxide/cli/build/plugin.ts +7 -7
- package/src/plugin.js +4 -4
- package/src/processTailwindFeatures.js +3 -2
- package/src/util/cloneNodes.js +35 -14
- package/src/util/color.js +2 -2
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +143 -18
- package/src/util/formatVariantSelector.js +11 -3
- package/src/util/isPlainObject.js +1 -1
- package/src/util/pluginUtils.js +17 -5
- package/src/util/prefixSelector.js +1 -0
- package/src/util/pseudoElements.js +18 -17
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/config.full.js +86 -14
- package/types/config.d.ts +17 -9
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +35 -9
- package/types/index.d.ts +7 -3
package/resolveConfig.d.ts
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Config, ResolvableTo, ThemeConfig } from './types/config'
|
|
2
|
+
import { DefaultTheme } from './types/generated/default-theme'
|
|
3
|
+
import { DefaultColors } from './types/generated/colors'
|
|
4
|
+
|
|
5
|
+
type ResolvedConfig<T extends Config> = Omit<T, 'theme'> & {
|
|
6
|
+
theme: MergeThemes<
|
|
7
|
+
UnwrapResolvables<Omit<T['theme'], 'extend'>>,
|
|
8
|
+
T['theme'] extends { extend: infer TExtend } ? UnwrapResolvables<TExtend> : {}
|
|
9
|
+
>
|
|
10
|
+
}
|
|
2
11
|
|
|
3
12
|
type UnwrapResolvables<T> = {
|
|
4
13
|
[K in keyof T]: T[K] extends ResolvableTo<infer R> ? R : T[K]
|
|
5
14
|
}
|
|
6
15
|
|
|
7
|
-
type
|
|
8
|
-
|
|
16
|
+
type ThemeConfigResolved = UnwrapResolvables<ThemeConfig>
|
|
17
|
+
type DefaultThemeFull = DefaultTheme & { colors: DefaultColors }
|
|
18
|
+
|
|
19
|
+
type MergeThemes<Overrides extends object, Extensions extends object> = {
|
|
20
|
+
[K in keyof ThemeConfigResolved | keyof Overrides]: (K extends keyof Overrides
|
|
21
|
+
? Overrides[K]
|
|
22
|
+
: K extends keyof DefaultThemeFull
|
|
23
|
+
? DefaultThemeFull[K]
|
|
24
|
+
: K extends keyof ThemeConfigResolved
|
|
25
|
+
? ThemeConfigResolved[K]
|
|
26
|
+
: never) &
|
|
27
|
+
(K extends keyof Extensions ? Extensions[K] : {})
|
|
9
28
|
}
|
|
10
29
|
|
|
11
30
|
declare function resolveConfig<T extends Config>(config: T): ResolvedConfig<T>
|
|
@@ -91,9 +91,8 @@ fs.writeFileSync(
|
|
|
91
91
|
path.join(process.cwd(), 'types', 'generated', 'default-theme.d.ts'),
|
|
92
92
|
prettier.format(
|
|
93
93
|
`
|
|
94
|
-
import { Config } from '../../types'
|
|
95
94
|
type CSSDeclarationList = Record<string, string>
|
|
96
|
-
export type DefaultTheme =
|
|
95
|
+
export type DefaultTheme = { ${defaultThemeTypes} }
|
|
97
96
|
`,
|
|
98
97
|
{
|
|
99
98
|
semi: false,
|
package/src/cli/build/plugin.js
CHANGED
|
@@ -185,7 +185,7 @@ let state = {
|
|
|
185
185
|
let files = fastGlob.sync(this.contentPatterns.all)
|
|
186
186
|
|
|
187
187
|
for (let file of files) {
|
|
188
|
-
if (
|
|
188
|
+
if (__OXIDE__) {
|
|
189
189
|
content.push({
|
|
190
190
|
file,
|
|
191
191
|
extension: path.extname(file).slice(1),
|
|
@@ -211,16 +211,16 @@ let state = {
|
|
|
211
211
|
},
|
|
212
212
|
|
|
213
213
|
getContext({ createContext, cliConfigPath, root, result, content }) {
|
|
214
|
+
env.DEBUG && console.time('Searching for config')
|
|
215
|
+
let configPath = findAtConfigPath(root, result) ?? cliConfigPath
|
|
216
|
+
env.DEBUG && console.timeEnd('Searching for config')
|
|
217
|
+
|
|
214
218
|
if (this.context) {
|
|
215
219
|
this.context.changedContent = this.changedContent.splice(0)
|
|
216
220
|
|
|
217
221
|
return this.context
|
|
218
222
|
}
|
|
219
223
|
|
|
220
|
-
env.DEBUG && console.time('Searching for config')
|
|
221
|
-
let configPath = findAtConfigPath(root, result) ?? cliConfigPath
|
|
222
|
-
env.DEBUG && console.timeEnd('Searching for config')
|
|
223
|
-
|
|
224
224
|
env.DEBUG && console.time('Loading config')
|
|
225
225
|
let config = this.loadConfig(configPath, content)
|
|
226
226
|
env.DEBUG && console.timeEnd('Loading config')
|
|
@@ -278,9 +278,9 @@ export async function createProcessor(args, cliConfigPath) {
|
|
|
278
278
|
let tailwindPlugin = () => {
|
|
279
279
|
return {
|
|
280
280
|
postcssPlugin: 'tailwindcss',
|
|
281
|
-
Once(root, { result }) {
|
|
281
|
+
async Once(root, { result }) {
|
|
282
282
|
env.DEBUG && console.time('Compiling CSS')
|
|
283
|
-
tailwind(({ createContext }) => {
|
|
283
|
+
await tailwind(({ createContext }) => {
|
|
284
284
|
console.error()
|
|
285
285
|
console.error('Rebuilding...')
|
|
286
286
|
|
|
@@ -164,7 +164,7 @@ export function createWatcher(args, { state, rebuild }) {
|
|
|
164
164
|
// This is very likely a chokidar bug but it's one we need to work around
|
|
165
165
|
// We treat this as a change event and rebuild the CSS
|
|
166
166
|
watcher.on('raw', (evt, filePath, meta) => {
|
|
167
|
-
if (evt !== 'rename') {
|
|
167
|
+
if (evt !== 'rename' || filePath === null) {
|
|
168
168
|
return
|
|
169
169
|
}
|
|
170
170
|
|
package/src/cli.js
CHANGED
package/src/corePluginList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","lineClamp","display","aspectRatio","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","captionSide","borderCollapse","borderSpacing","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","listStyleImage","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","hyphens","whitespace","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","content"]
|
|
1
|
+
export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","lineClamp","display","aspectRatio","size","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","captionSide","borderCollapse","borderSpacing","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","listStyleImage","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","hyphens","whitespace","textWrap","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","contain","content","forcedColorAdjust"]
|
package/src/corePlugins.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import * as path from 'path'
|
|
3
3
|
import postcss from 'postcss'
|
|
4
|
-
import { env } from './lib/sharedState'
|
|
5
4
|
import createUtilityPlugin from './util/createUtilityPlugin'
|
|
6
5
|
import buildMediaQuery from './util/buildMediaQuery'
|
|
7
6
|
import escapeClassName from './util/escapeClassName'
|
|
@@ -23,8 +22,12 @@ import { formatBoxShadowValue, parseBoxShadowValue } from './util/parseBoxShadow
|
|
|
23
22
|
import { removeAlphaVariables } from './util/removeAlphaVariables'
|
|
24
23
|
import { flagEnabled } from './featureFlags'
|
|
25
24
|
import { normalize } from './util/dataTypes'
|
|
25
|
+
import { INTERNAL_FEATURES } from './lib/setupContextUtils'
|
|
26
26
|
|
|
27
27
|
export let variantPlugins = {
|
|
28
|
+
childVariant: ({ addVariant }) => {
|
|
29
|
+
addVariant('*', '& > *')
|
|
30
|
+
},
|
|
28
31
|
pseudoElementVariants: ({ addVariant }) => {
|
|
29
32
|
addVariant('first-letter', '&::first-letter')
|
|
30
33
|
addVariant('first-line', '&::first-line')
|
|
@@ -81,7 +84,7 @@ export let variantPlugins = {
|
|
|
81
84
|
})
|
|
82
85
|
},
|
|
83
86
|
|
|
84
|
-
pseudoClassVariants: ({ addVariant, matchVariant, config }) => {
|
|
87
|
+
pseudoClassVariants: ({ addVariant, matchVariant, config, prefix }) => {
|
|
85
88
|
let pseudoVariants = [
|
|
86
89
|
// Positional
|
|
87
90
|
['first', '&:first-child'],
|
|
@@ -152,12 +155,12 @@ export let variantPlugins = {
|
|
|
152
155
|
let variants = {
|
|
153
156
|
group: (_, { modifier }) =>
|
|
154
157
|
modifier
|
|
155
|
-
? [`:merge(.group\\/${escapeClassName(modifier)})`, ' &']
|
|
156
|
-
: [`:merge(.group)`, ' &'],
|
|
158
|
+
? [`:merge(${prefix('.group')}\\/${escapeClassName(modifier)})`, ' &']
|
|
159
|
+
: [`:merge(${prefix('.group')})`, ' &'],
|
|
157
160
|
peer: (_, { modifier }) =>
|
|
158
161
|
modifier
|
|
159
|
-
? [`:merge(.peer\\/${escapeClassName(modifier)})`, ' ~ &']
|
|
160
|
-
: [`:merge(.peer)`, ' ~ &'],
|
|
162
|
+
? [`:merge(${prefix('.peer')}\\/${escapeClassName(modifier)})`, ' ~ &']
|
|
163
|
+
: [`:merge(${prefix('.peer')})`, ' ~ &'],
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
for (let [name, fn] of Object.entries(variants)) {
|
|
@@ -193,14 +196,19 @@ export let variantPlugins = {
|
|
|
193
196
|
|
|
194
197
|
return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end)
|
|
195
198
|
},
|
|
196
|
-
{
|
|
199
|
+
{
|
|
200
|
+
values: Object.fromEntries(pseudoVariants),
|
|
201
|
+
[INTERNAL_FEATURES]: {
|
|
202
|
+
respectPrefix: false,
|
|
203
|
+
},
|
|
204
|
+
}
|
|
197
205
|
)
|
|
198
206
|
}
|
|
199
207
|
},
|
|
200
208
|
|
|
201
209
|
directionVariants: ({ addVariant }) => {
|
|
202
|
-
addVariant('ltr', '
|
|
203
|
-
addVariant('rtl', '
|
|
210
|
+
addVariant('ltr', '&:where([dir="ltr"], [dir="ltr"] *)')
|
|
211
|
+
addVariant('rtl', '&:where([dir="rtl"], [dir="rtl"] *)')
|
|
204
212
|
},
|
|
205
213
|
|
|
206
214
|
reducedMotionVariants: ({ addVariant }) => {
|
|
@@ -209,7 +217,7 @@ export let variantPlugins = {
|
|
|
209
217
|
},
|
|
210
218
|
|
|
211
219
|
darkVariants: ({ config, addVariant }) => {
|
|
212
|
-
let [mode,
|
|
220
|
+
let [mode, selector = '.dark'] = [].concat(config('darkMode', 'media'))
|
|
213
221
|
|
|
214
222
|
if (mode === false) {
|
|
215
223
|
mode = 'media'
|
|
@@ -220,10 +228,49 @@ export let variantPlugins = {
|
|
|
220
228
|
])
|
|
221
229
|
}
|
|
222
230
|
|
|
223
|
-
if (mode === '
|
|
224
|
-
|
|
231
|
+
if (mode === 'variant') {
|
|
232
|
+
let formats
|
|
233
|
+
if (Array.isArray(selector)) {
|
|
234
|
+
formats = selector
|
|
235
|
+
} else if (typeof selector === 'function') {
|
|
236
|
+
formats = selector
|
|
237
|
+
} else if (typeof selector === 'string') {
|
|
238
|
+
formats = [selector]
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// TODO: We could also add these warnings if the user passes a function that returns string | string[]
|
|
242
|
+
// But this is an advanced enough use case that it's probably not necessary
|
|
243
|
+
if (Array.isArray(formats)) {
|
|
244
|
+
for (let format of formats) {
|
|
245
|
+
if (format === '.dark') {
|
|
246
|
+
mode = false
|
|
247
|
+
log.warn('darkmode-variant-without-selector', [
|
|
248
|
+
'When using `variant` for `darkMode`, you must provide a selector.',
|
|
249
|
+
'Example: `darkMode: ["variant", ".your-selector &"]`',
|
|
250
|
+
])
|
|
251
|
+
} else if (!format.includes('&')) {
|
|
252
|
+
mode = false
|
|
253
|
+
log.warn('darkmode-variant-without-ampersand', [
|
|
254
|
+
'When using `variant` for `darkMode`, your selector must contain `&`.',
|
|
255
|
+
'Example `darkMode: ["variant", ".your-selector &"]`',
|
|
256
|
+
])
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
selector = formats
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (mode === 'selector') {
|
|
265
|
+
// New preferred behavior
|
|
266
|
+
addVariant('dark', `&:where(${selector}, ${selector} *)`)
|
|
225
267
|
} else if (mode === 'media') {
|
|
226
268
|
addVariant('dark', '@media (prefers-color-scheme: dark)')
|
|
269
|
+
} else if (mode === 'variant') {
|
|
270
|
+
addVariant('dark', selector)
|
|
271
|
+
} else if (mode === 'class') {
|
|
272
|
+
// Old behavior
|
|
273
|
+
addVariant('dark', `:is(${selector} &)`)
|
|
227
274
|
}
|
|
228
275
|
},
|
|
229
276
|
|
|
@@ -387,6 +434,26 @@ export let variantPlugins = {
|
|
|
387
434
|
)
|
|
388
435
|
},
|
|
389
436
|
|
|
437
|
+
hasVariants: ({ matchVariant }) => {
|
|
438
|
+
matchVariant('has', (value) => `&:has(${normalize(value)})`, { values: {} })
|
|
439
|
+
matchVariant(
|
|
440
|
+
'group-has',
|
|
441
|
+
(value, { modifier }) =>
|
|
442
|
+
modifier
|
|
443
|
+
? `:merge(.group\\/${modifier}):has(${normalize(value)}) &`
|
|
444
|
+
: `:merge(.group):has(${normalize(value)}) &`,
|
|
445
|
+
{ values: {} }
|
|
446
|
+
)
|
|
447
|
+
matchVariant(
|
|
448
|
+
'peer-has',
|
|
449
|
+
(value, { modifier }) =>
|
|
450
|
+
modifier
|
|
451
|
+
? `:merge(.peer\\/${modifier}):has(${normalize(value)}) ~ &`
|
|
452
|
+
: `:merge(.peer):has(${normalize(value)}) ~ &`,
|
|
453
|
+
{ values: {} }
|
|
454
|
+
)
|
|
455
|
+
},
|
|
456
|
+
|
|
390
457
|
ariaVariants: ({ matchVariant, theme }) => {
|
|
391
458
|
matchVariant('aria', (value) => `&[aria-${normalize(value)}]`, { values: theme('aria') ?? {} })
|
|
392
459
|
matchVariant(
|
|
@@ -436,6 +503,10 @@ export let variantPlugins = {
|
|
|
436
503
|
addVariant('contrast-more', '@media (prefers-contrast: more)')
|
|
437
504
|
addVariant('contrast-less', '@media (prefers-contrast: less)')
|
|
438
505
|
},
|
|
506
|
+
|
|
507
|
+
forcedColorsVariants: ({ addVariant }) => {
|
|
508
|
+
addVariant('forced-colors', '@media (forced-colors: active)')
|
|
509
|
+
},
|
|
439
510
|
}
|
|
440
511
|
|
|
441
512
|
let cssTransformValue = [
|
|
@@ -661,6 +732,8 @@ export let corePlugins = {
|
|
|
661
732
|
|
|
662
733
|
float: ({ addUtilities }) => {
|
|
663
734
|
addUtilities({
|
|
735
|
+
'.float-start': { float: 'inline-start' },
|
|
736
|
+
'.float-end': { float: 'inline-end' },
|
|
664
737
|
'.float-right': { float: 'right' },
|
|
665
738
|
'.float-left': { float: 'left' },
|
|
666
739
|
'.float-none': { float: 'none' },
|
|
@@ -669,6 +742,8 @@ export let corePlugins = {
|
|
|
669
742
|
|
|
670
743
|
clear: ({ addUtilities }) => {
|
|
671
744
|
addUtilities({
|
|
745
|
+
'.clear-start': { clear: 'inline-start' },
|
|
746
|
+
'.clear-end': { clear: 'inline-end' },
|
|
672
747
|
'.clear-left': { clear: 'left' },
|
|
673
748
|
'.clear-right': { clear: 'right' },
|
|
674
749
|
'.clear-both': { clear: 'both' },
|
|
@@ -754,6 +829,8 @@ export let corePlugins = {
|
|
|
754
829
|
|
|
755
830
|
aspectRatio: createUtilityPlugin('aspectRatio', [['aspect', ['aspect-ratio']]]),
|
|
756
831
|
|
|
832
|
+
size: createUtilityPlugin('size', [['size', ['width', 'height']]]),
|
|
833
|
+
|
|
757
834
|
height: createUtilityPlugin('height', [['h', ['height']]]),
|
|
758
835
|
maxHeight: createUtilityPlugin('maxHeight', [['max-h', ['maxHeight']]]),
|
|
759
836
|
minHeight: createUtilityPlugin('minHeight', [['min-h', ['minHeight']]]),
|
|
@@ -914,7 +991,7 @@ export let corePlugins = {
|
|
|
914
991
|
},
|
|
915
992
|
|
|
916
993
|
animation: ({ matchUtilities, theme, config }) => {
|
|
917
|
-
let prefixName = (name) =>
|
|
994
|
+
let prefixName = (name) => escapeClassName(config('prefix') + name)
|
|
918
995
|
let keyframes = Object.fromEntries(
|
|
919
996
|
Object.entries(theme('keyframes') ?? {}).map(([key, value]) => {
|
|
920
997
|
return [key, { [`@keyframes ${prefixName(key)}`]: value }]
|
|
@@ -1104,6 +1181,7 @@ export let corePlugins = {
|
|
|
1104
1181
|
appearance: ({ addUtilities }) => {
|
|
1105
1182
|
addUtilities({
|
|
1106
1183
|
'.appearance-none': { appearance: 'none' },
|
|
1184
|
+
'.appearance-auto': { appearance: 'auto' },
|
|
1107
1185
|
})
|
|
1108
1186
|
},
|
|
1109
1187
|
|
|
@@ -1262,7 +1340,7 @@ export let corePlugins = {
|
|
|
1262
1340
|
'space-x': (value) => {
|
|
1263
1341
|
value = value === '0' ? '0px' : value
|
|
1264
1342
|
|
|
1265
|
-
if (
|
|
1343
|
+
if (__OXIDE__) {
|
|
1266
1344
|
return {
|
|
1267
1345
|
'& > :not([hidden]) ~ :not([hidden])': {
|
|
1268
1346
|
'--tw-space-x-reverse': '0',
|
|
@@ -1307,7 +1385,7 @@ export let corePlugins = {
|
|
|
1307
1385
|
'divide-x': (value) => {
|
|
1308
1386
|
value = value === '0' ? '0px' : value
|
|
1309
1387
|
|
|
1310
|
-
if (
|
|
1388
|
+
if (__OXIDE__) {
|
|
1311
1389
|
return {
|
|
1312
1390
|
'& > :not([hidden]) ~ :not([hidden])': {
|
|
1313
1391
|
'@defaults border-width': {},
|
|
@@ -1504,6 +1582,15 @@ export let corePlugins = {
|
|
|
1504
1582
|
})
|
|
1505
1583
|
},
|
|
1506
1584
|
|
|
1585
|
+
textWrap: ({ addUtilities }) => {
|
|
1586
|
+
addUtilities({
|
|
1587
|
+
'.text-wrap': { 'text-wrap': 'wrap' },
|
|
1588
|
+
'.text-nowrap': { 'text-wrap': 'nowrap' },
|
|
1589
|
+
'.text-balance': { 'text-wrap': 'balance' },
|
|
1590
|
+
'.text-pretty': { 'text-wrap': 'pretty' },
|
|
1591
|
+
})
|
|
1592
|
+
},
|
|
1593
|
+
|
|
1507
1594
|
wordBreak: ({ addUtilities }) => {
|
|
1508
1595
|
addUtilities({
|
|
1509
1596
|
'.break-normal': { 'overflow-wrap': 'normal', 'word-break': 'normal' },
|
|
@@ -1750,7 +1837,13 @@ export let corePlugins = {
|
|
|
1750
1837
|
return withAlphaValue(value, 0, 'rgb(255 255 255 / 0)')
|
|
1751
1838
|
}
|
|
1752
1839
|
|
|
1753
|
-
return function ({ matchUtilities, theme }) {
|
|
1840
|
+
return function ({ matchUtilities, theme, addDefaults }) {
|
|
1841
|
+
addDefaults('gradient-color-stops', {
|
|
1842
|
+
'--tw-gradient-from-position': ' ',
|
|
1843
|
+
'--tw-gradient-via-position': ' ',
|
|
1844
|
+
'--tw-gradient-to-position': ' ',
|
|
1845
|
+
})
|
|
1846
|
+
|
|
1754
1847
|
let options = {
|
|
1755
1848
|
values: flattenColorPalette(theme('gradientColorStops')),
|
|
1756
1849
|
type: ['color', 'any'],
|
|
@@ -1767,13 +1860,9 @@ export let corePlugins = {
|
|
|
1767
1860
|
let transparentToValue = transparentTo(value)
|
|
1768
1861
|
|
|
1769
1862
|
return {
|
|
1770
|
-
'
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
)} var(--tw-gradient-from-position)`,
|
|
1774
|
-
'--tw-gradient-from-position': ' ',
|
|
1775
|
-
'--tw-gradient-to': `${transparentToValue} var(--tw-gradient-from-position)`,
|
|
1776
|
-
'--tw-gradient-to-position': ' ',
|
|
1863
|
+
'@defaults gradient-color-stops': {},
|
|
1864
|
+
'--tw-gradient-from': `${toColorValue(value)} var(--tw-gradient-from-position)`,
|
|
1865
|
+
'--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
|
|
1777
1866
|
'--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to)`,
|
|
1778
1867
|
}
|
|
1779
1868
|
},
|
|
@@ -1798,12 +1887,10 @@ export let corePlugins = {
|
|
|
1798
1887
|
let transparentToValue = transparentTo(value)
|
|
1799
1888
|
|
|
1800
1889
|
return {
|
|
1801
|
-
'
|
|
1890
|
+
'@defaults gradient-color-stops': {},
|
|
1802
1891
|
'--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
|
|
1803
|
-
'--tw-gradient-to-position': ' ',
|
|
1804
1892
|
'--tw-gradient-stops': `var(--tw-gradient-from), ${toColorValue(
|
|
1805
|
-
value
|
|
1806
|
-
'via'
|
|
1893
|
+
value
|
|
1807
1894
|
)} var(--tw-gradient-via-position), var(--tw-gradient-to)`,
|
|
1808
1895
|
}
|
|
1809
1896
|
},
|
|
@@ -1825,8 +1912,8 @@ export let corePlugins = {
|
|
|
1825
1912
|
matchUtilities(
|
|
1826
1913
|
{
|
|
1827
1914
|
to: (value) => ({
|
|
1828
|
-
'
|
|
1829
|
-
'--tw-gradient-to
|
|
1915
|
+
'@defaults gradient-color-stops': {},
|
|
1916
|
+
'--tw-gradient-to': `${toColorValue(value)} var(--tw-gradient-to-position)`,
|
|
1830
1917
|
}),
|
|
1831
1918
|
},
|
|
1832
1919
|
options
|
|
@@ -2297,6 +2384,7 @@ export let corePlugins = {
|
|
|
2297
2384
|
'.mix-blend-saturation': { 'mix-blend-mode': 'saturation' },
|
|
2298
2385
|
'.mix-blend-color': { 'mix-blend-mode': 'color' },
|
|
2299
2386
|
'.mix-blend-luminosity': { 'mix-blend-mode': 'luminosity' },
|
|
2387
|
+
'.mix-blend-plus-darker': { 'mix-blend-mode': 'plus-darker' },
|
|
2300
2388
|
'.mix-blend-plus-lighter': { 'mix-blend-mode': 'plus-lighter' },
|
|
2301
2389
|
})
|
|
2302
2390
|
},
|
|
@@ -2844,7 +2932,55 @@ export let corePlugins = {
|
|
|
2844
2932
|
{ filterDefault: true }
|
|
2845
2933
|
),
|
|
2846
2934
|
willChange: createUtilityPlugin('willChange', [['will-change', ['will-change']]]),
|
|
2935
|
+
contain: ({ addDefaults, addUtilities }) => {
|
|
2936
|
+
let cssContainValue =
|
|
2937
|
+
'var(--tw-contain-size) var(--tw-contain-layout) var(--tw-contain-paint) var(--tw-contain-style)'
|
|
2938
|
+
|
|
2939
|
+
addDefaults('contain', {
|
|
2940
|
+
'--tw-contain-size': ' ',
|
|
2941
|
+
'--tw-contain-layout': ' ',
|
|
2942
|
+
'--tw-contain-paint': ' ',
|
|
2943
|
+
'--tw-contain-style': ' ',
|
|
2944
|
+
})
|
|
2945
|
+
|
|
2946
|
+
addUtilities({
|
|
2947
|
+
'.contain-none': { contain: 'none' },
|
|
2948
|
+
'.contain-content': { contain: 'content' },
|
|
2949
|
+
'.contain-strict': { contain: 'strict' },
|
|
2950
|
+
'.contain-size': {
|
|
2951
|
+
'@defaults contain': {},
|
|
2952
|
+
'--tw-contain-size': 'size',
|
|
2953
|
+
contain: cssContainValue,
|
|
2954
|
+
},
|
|
2955
|
+
'.contain-inline-size': {
|
|
2956
|
+
'@defaults contain': {},
|
|
2957
|
+
'--tw-contain-size': 'inline-size',
|
|
2958
|
+
contain: cssContainValue,
|
|
2959
|
+
},
|
|
2960
|
+
'.contain-layout': {
|
|
2961
|
+
'@defaults contain': {},
|
|
2962
|
+
'--tw-contain-layout': 'layout',
|
|
2963
|
+
contain: cssContainValue,
|
|
2964
|
+
},
|
|
2965
|
+
'.contain-paint': {
|
|
2966
|
+
'@defaults contain': {},
|
|
2967
|
+
'--tw-contain-paint': 'paint',
|
|
2968
|
+
contain: cssContainValue,
|
|
2969
|
+
},
|
|
2970
|
+
'.contain-style': {
|
|
2971
|
+
'@defaults contain': {},
|
|
2972
|
+
'--tw-contain-style': 'style',
|
|
2973
|
+
contain: cssContainValue,
|
|
2974
|
+
},
|
|
2975
|
+
})
|
|
2976
|
+
},
|
|
2847
2977
|
content: createUtilityPlugin('content', [
|
|
2848
2978
|
['content', ['--tw-content', ['content', 'var(--tw-content)']]],
|
|
2849
2979
|
]),
|
|
2980
|
+
forcedColorAdjust: ({ addUtilities }) => {
|
|
2981
|
+
addUtilities({
|
|
2982
|
+
'.forced-color-adjust-auto': { 'forced-color-adjust': 'auto' },
|
|
2983
|
+
'.forced-color-adjust-none': { 'forced-color-adjust': 'none' },
|
|
2984
|
+
})
|
|
2985
|
+
},
|
|
2850
2986
|
}
|
package/src/css/preflight.css
CHANGED
|
@@ -24,16 +24,19 @@
|
|
|
24
24
|
4. Use the user's configured `sans` font-family by default.
|
|
25
25
|
5. Use the user's configured `sans` font-feature-settings by default.
|
|
26
26
|
6. Use the user's configured `sans` font-variation-settings by default.
|
|
27
|
+
7. Disable tap highlights on iOS
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
|
-
html
|
|
30
|
+
html,
|
|
31
|
+
:host {
|
|
30
32
|
line-height: 1.5; /* 1 */
|
|
31
33
|
-webkit-text-size-adjust: 100%; /* 2 */
|
|
32
34
|
-moz-tab-size: 4; /* 3 */
|
|
33
35
|
tab-size: 4; /* 3 */
|
|
34
|
-
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui,
|
|
36
|
+
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
|
|
35
37
|
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
36
38
|
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
39
|
+
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/*
|
|
@@ -99,8 +102,10 @@ strong {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
/*
|
|
102
|
-
1. Use the user's configured `mono` font
|
|
103
|
-
2.
|
|
105
|
+
1. Use the user's configured `mono` font-family by default.
|
|
106
|
+
2. Use the user's configured `mono` font-feature-settings by default.
|
|
107
|
+
3. Use the user's configured `mono` font-variation-settings by default.
|
|
108
|
+
4. Correct the odd `em` font sizing in all browsers.
|
|
104
109
|
*/
|
|
105
110
|
|
|
106
111
|
code,
|
|
@@ -108,7 +113,9 @@ kbd,
|
|
|
108
113
|
samp,
|
|
109
114
|
pre {
|
|
110
115
|
font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */
|
|
111
|
-
font-
|
|
116
|
+
font-feature-settings: theme('fontFamily.mono[1].fontFeatureSettings', normal); /* 2 */
|
|
117
|
+
font-variation-settings: theme('fontFamily.mono[1].fontVariationSettings', normal); /* 3 */
|
|
118
|
+
font-size: 1em; /* 4 */
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
/*
|
|
@@ -163,6 +170,8 @@ optgroup,
|
|
|
163
170
|
select,
|
|
164
171
|
textarea {
|
|
165
172
|
font-family: inherit; /* 1 */
|
|
173
|
+
font-feature-settings: inherit; /* 1 */
|
|
174
|
+
font-variation-settings: inherit; /* 1 */
|
|
166
175
|
font-size: 100%; /* 1 */
|
|
167
176
|
font-weight: inherit; /* 1 */
|
|
168
177
|
line-height: inherit; /* 1 */
|
|
@@ -186,9 +195,9 @@ select {
|
|
|
186
195
|
*/
|
|
187
196
|
|
|
188
197
|
button,
|
|
189
|
-
[type='button'],
|
|
190
|
-
[type='reset'],
|
|
191
|
-
[type='submit'] {
|
|
198
|
+
input:where([type='button']),
|
|
199
|
+
input:where([type='reset']),
|
|
200
|
+
input:where([type='submit']) {
|
|
192
201
|
-webkit-appearance: button; /* 1 */
|
|
193
202
|
background-color: transparent; /* 2 */
|
|
194
203
|
background-image: none; /* 2 */
|
|
@@ -300,6 +309,13 @@ menu {
|
|
|
300
309
|
padding: 0;
|
|
301
310
|
}
|
|
302
311
|
|
|
312
|
+
/*
|
|
313
|
+
Reset default styling for dialogs.
|
|
314
|
+
*/
|
|
315
|
+
dialog {
|
|
316
|
+
padding: 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
303
319
|
/*
|
|
304
320
|
Prevent resizing textareas horizontally by default.
|
|
305
321
|
*/
|
package/src/featureFlags.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import colors from 'picocolors'
|
|
2
2
|
import log from './util/log'
|
|
3
|
-
import { env } from './lib/sharedState'
|
|
4
3
|
|
|
5
4
|
let defaults = {
|
|
6
5
|
optimizeUniversalDefaults: false,
|
|
7
6
|
generalizedModifiers: true,
|
|
8
7
|
get disableColorOpacityUtilitiesByDefault() {
|
|
9
|
-
return
|
|
8
|
+
return __OXIDE__
|
|
10
9
|
},
|
|
11
10
|
get relativeContentPathsByDefault() {
|
|
12
|
-
return
|
|
11
|
+
return __OXIDE__
|
|
13
12
|
},
|
|
14
13
|
}
|
|
15
14
|
|
|
@@ -20,11 +19,7 @@ let featureFlags = {
|
|
|
20
19
|
'disableColorOpacityUtilitiesByDefault',
|
|
21
20
|
'relativeContentPathsByDefault',
|
|
22
21
|
],
|
|
23
|
-
experimental: [
|
|
24
|
-
'optimizeUniversalDefaults',
|
|
25
|
-
'generalizedModifiers',
|
|
26
|
-
// 'variantGrouping',
|
|
27
|
-
],
|
|
22
|
+
experimental: ['optimizeUniversalDefaults', 'generalizedModifiers'],
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
export function flagEnabled(config, flag) {
|
package/src/index.js
CHANGED
package/src/lib/content.js
CHANGED
|
@@ -4,10 +4,47 @@ import fs from 'fs'
|
|
|
4
4
|
import path from 'path'
|
|
5
5
|
import isGlob from 'is-glob'
|
|
6
6
|
import fastGlob from 'fast-glob'
|
|
7
|
-
import normalizePath from 'normalize-path'
|
|
8
7
|
import { parseGlob } from '../util/parseGlob'
|
|
9
8
|
import { env } from './sharedState'
|
|
10
9
|
|
|
10
|
+
/*!
|
|
11
|
+
* Modified version of normalize-path, original license below
|
|
12
|
+
*
|
|
13
|
+
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
16
|
+
* Released under the MIT License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function normalizePath(path) {
|
|
20
|
+
if (typeof path !== 'string') {
|
|
21
|
+
throw new TypeError('expected path to be a string')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (path === '\\' || path === '/') return '/'
|
|
25
|
+
|
|
26
|
+
var len = path.length
|
|
27
|
+
if (len <= 1) return path
|
|
28
|
+
|
|
29
|
+
// ensure that win32 namespaces has two leading slashes, so that the path is
|
|
30
|
+
// handled properly by the win32 version of path.parse() after being normalized
|
|
31
|
+
// https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
|
|
32
|
+
var prefix = ''
|
|
33
|
+
if (len > 4 && path[3] === '\\') {
|
|
34
|
+
var ch = path[2]
|
|
35
|
+
if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
|
|
36
|
+
path = path.slice(2)
|
|
37
|
+
prefix = '//'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Modified part: instead of purely splitting on `\\` and `/`, we split on
|
|
42
|
+
// `/` and `\\` that is _not_ followed by any of the following characters: ()[]
|
|
43
|
+
// This is to ensure that we keep the escaping of brackets and parentheses
|
|
44
|
+
let segs = path.split(/[/\\]+(?![\(\)\[\]])/)
|
|
45
|
+
return prefix + segs.join('/')
|
|
46
|
+
}
|
|
47
|
+
|
|
11
48
|
/** @typedef {import('../../types/config.js').RawFile} RawFile */
|
|
12
49
|
/** @typedef {import('../../types/config.js').FilePath} FilePath */
|
|
13
50
|
|
|
@@ -73,6 +110,10 @@ export function parseCandidateFiles(context, tailwindConfig) {
|
|
|
73
110
|
* @returns {ContentPath}
|
|
74
111
|
*/
|
|
75
112
|
function parseFilePath(filePath, ignore) {
|
|
113
|
+
// Escape special characters in the file path such as: ()[]
|
|
114
|
+
// But only if the special character isn't already escaped
|
|
115
|
+
filePath = filePath.replace(/(?<!\\)([\[\]\(\)])/g, '\\$1')
|
|
116
|
+
|
|
76
117
|
let contentPath = {
|
|
77
118
|
original: filePath,
|
|
78
119
|
base: filePath,
|