tailwindcss 0.0.0-insiders.bd970d0 → 0.0.0-insiders.bda8421
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 +1 -2
- package/lib/cli/build/deps.js +62 -0
- package/lib/cli/build/index.js +12 -15
- package/lib/cli/build/plugin.js +107 -167
- package/lib/cli/build/utils.js +13 -13
- package/lib/cli/build/watching.js +10 -10
- package/lib/cli/help/index.js +11 -11
- package/lib/cli/index.js +60 -61
- package/lib/cli/init/index.js +16 -16
- package/lib/cli-peer-dependencies.js +36 -0
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +4 -1
- package/lib/corePlugins.js +2018 -1905
- package/lib/css/preflight.css +18 -12
- package/lib/featureFlags.js +17 -23
- package/lib/index.js +1 -1
- package/lib/lib/cacheInvalidation.js +3 -3
- package/lib/lib/collapseAdjacentRules.js +6 -6
- package/lib/lib/collapseDuplicateDeclarations.js +1 -1
- package/lib/lib/content.js +39 -32
- package/lib/lib/defaultExtractor.js +40 -17
- package/lib/lib/evaluateTailwindFunctions.js +23 -23
- package/lib/lib/expandApplyAtRules.js +37 -18
- package/lib/lib/expandTailwindAtRules.js +49 -85
- package/lib/lib/findAtConfigPath.js +5 -5
- package/lib/lib/generateRules.js +82 -55
- package/lib/lib/getModuleDependencies.js +23 -23
- package/lib/lib/load-config.js +21 -6
- package/lib/lib/normalizeTailwindDirectives.js +36 -21
- package/lib/lib/offsets.js +97 -48
- package/lib/lib/partitionApplyAtRules.js +2 -2
- package/lib/lib/regex.js +5 -5
- package/lib/lib/resolveDefaultsAtRules.js +27 -25
- package/lib/lib/setupContextUtils.js +195 -167
- package/lib/lib/setupTrackingContext.js +4 -5
- package/lib/lib/sharedState.js +10 -10
- package/lib/lib/substituteScreenAtRules.js +4 -4
- package/lib/plugin.js +8 -124
- package/lib/postcss-plugins/nesting/index.js +2 -2
- package/lib/postcss-plugins/nesting/plugin.js +11 -11
- package/lib/processTailwindFeatures.js +3 -5
- package/lib/public/colors.js +264 -264
- package/lib/util/applyImportantSelector.js +2 -2
- package/lib/util/buildMediaQuery.js +2 -2
- package/lib/util/cloneDeep.js +1 -1
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +19 -19
- package/lib/util/createUtilityPlugin.js +3 -3
- package/lib/util/dataTypes.js +170 -113
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +2 -2
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -2
- package/lib/util/formatVariantSelector.js +24 -19
- package/lib/util/getAllConfigs.js +4 -5
- package/lib/util/isKeyframeRule.js +1 -1
- package/lib/util/isPlainObject.js +2 -2
- package/lib/util/isSyntacticallyValidPropertyValue.js +10 -10
- package/lib/util/log.js +6 -23
- package/lib/util/nameClass.js +4 -4
- package/lib/util/negateValue.js +8 -8
- package/lib/util/normalizeConfig.js +63 -94
- package/lib/util/normalizeScreens.js +18 -18
- package/lib/util/parseAnimationValue.js +38 -38
- package/lib/util/parseBoxShadowValue.js +18 -18
- package/lib/util/parseDependency.js +4 -4
- package/lib/util/parseGlob.js +4 -4
- package/lib/util/parseObjectStyles.js +1 -1
- package/lib/util/pluginUtils.js +36 -21
- package/lib/util/prefixSelector.js +4 -4
- package/lib/util/pseudoElements.js +72 -69
- package/lib/util/removeAlphaVariables.js +1 -1
- package/lib/util/resolveConfig.js +11 -15
- package/lib/util/resolveConfigPath.js +6 -6
- package/lib/util/responsive.js +1 -1
- package/lib/util/splitAtTopLevelOnly.js +3 -3
- package/lib/util/toColorValue.js +1 -1
- package/lib/util/toPath.js +2 -2
- package/lib/util/transformThemeValue.js +24 -24
- package/lib/util/validateConfig.js +9 -20
- package/lib/util/validateFormalSyntax.js +5 -5
- package/lib/util/withAlphaVariable.js +5 -5
- package/lib/value-parser/index.js +5 -5
- package/lib/value-parser/parse.js +43 -43
- package/lib/value-parser/stringify.js +11 -11
- package/lib/value-parser/unit.js +5 -5
- package/lib/value-parser/walk.js +1 -1
- package/nesting/index.d.ts +4 -0
- package/package.json +41 -36
- package/peers/index.js +96503 -0
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +0 -4
- package/src/cli/build/plugin.js +53 -85
- package/src/cli/build/watching.js +1 -1
- package/src/cli/index.js +0 -1
- package/src/cli-peer-dependencies.js +15 -0
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +118 -31
- package/src/css/preflight.css +18 -12
- package/src/featureFlags.js +3 -5
- package/src/lib/content.js +39 -30
- package/src/lib/defaultExtractor.js +29 -6
- package/src/lib/expandApplyAtRules.js +24 -0
- package/src/lib/expandTailwindAtRules.js +19 -56
- package/src/lib/generateRules.js +39 -8
- package/src/lib/load-config.ts +13 -0
- package/src/lib/normalizeTailwindDirectives.js +27 -0
- package/src/lib/offsets.js +62 -3
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +79 -39
- package/src/plugin.js +0 -86
- package/src/processTailwindFeatures.js +0 -3
- package/src/util/cloneNodes.js +35 -14
- package/src/util/dataTypes.js +72 -6
- package/src/util/formatVariantSelector.js +7 -0
- package/src/util/isPlainObject.js +1 -1
- package/src/util/log.js +0 -24
- package/src/util/normalizeConfig.js +11 -38
- package/src/util/pluginUtils.js +20 -0
- package/src/util/pseudoElements.js +4 -0
- package/src/util/validateConfig.js +0 -10
- package/stubs/config.full.js +68 -8
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +1 -0
- package/stubs/postcss.config.js +1 -0
- package/types/config.d.ts +12 -5
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +28 -9
- package/types/index.d.ts +7 -3
- package/index.css +0 -5
- package/lib/lib/detectNesting.js +0 -45
- package/lib/lib/handleImportAtRules.js +0 -50
- package/src/lib/detectNesting.js +0 -47
- package/src/lib/handleImportAtRules.js +0 -34
package/stubs/postcss.config.cjs
CHANGED
package/stubs/postcss.config.js
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -60,11 +60,10 @@ type FutureConfigValues =
|
|
|
60
60
|
| 'respectDefaultRingColorOpacity'
|
|
61
61
|
| 'disableColorOpacityUtilitiesByDefault'
|
|
62
62
|
| 'relativeContentPathsByDefault'
|
|
63
|
-
| 'logicalSiblingUtilities'
|
|
64
63
|
type FutureConfig = Expand<'all' | Partial<Record<FutureConfigValues, boolean>>> | []
|
|
65
64
|
|
|
66
65
|
// Experimental related config
|
|
67
|
-
type ExperimentalConfigValues = 'optimizeUniversalDefaults' | '
|
|
66
|
+
type ExperimentalConfigValues = 'optimizeUniversalDefaults' | 'matchVariant'
|
|
68
67
|
type ExperimentalConfig = Expand<'all' | Partial<Record<ExperimentalConfigValues, boolean>>> | []
|
|
69
68
|
|
|
70
69
|
// DarkMode related config
|
|
@@ -75,12 +74,19 @@ type DarkModeConfig =
|
|
|
75
74
|
| 'class'
|
|
76
75
|
// Use the `class` strategy with a custom class instead of `.dark`.
|
|
77
76
|
| ['class', string]
|
|
77
|
+
// Use the `selector` strategy — same as `class` but uses `:where()` for more predicable behavior
|
|
78
|
+
| 'selector'
|
|
79
|
+
// Use the `selector` strategy with a custom selector instead of `.dark`.
|
|
80
|
+
| ['selector', string]
|
|
81
|
+
// Use the `variant` strategy, which allows you to completely customize the selector
|
|
82
|
+
// It takes a string or an array of strings, which are passed directly to `addVariant()`
|
|
83
|
+
| ['variant', string | string[]]
|
|
78
84
|
|
|
79
85
|
type Screen = { raw: string } | { min: string } | { max: string } | { min: string; max: string }
|
|
80
86
|
type ScreensConfig = string[] | KeyValuePair<string, string | Screen | Screen[]>
|
|
81
87
|
|
|
82
88
|
// Theme related config
|
|
83
|
-
interface ThemeConfig {
|
|
89
|
+
export interface ThemeConfig {
|
|
84
90
|
// Responsiveness
|
|
85
91
|
screens: ResolvableTo<ScreensConfig>
|
|
86
92
|
supports: ResolvableTo<Record<string, string>>
|
|
@@ -235,8 +241,9 @@ interface ThemeConfig {
|
|
|
235
241
|
transitionDuration: ResolvableTo<KeyValuePair>
|
|
236
242
|
willChange: ResolvableTo<KeyValuePair>
|
|
237
243
|
content: ResolvableTo<KeyValuePair>
|
|
244
|
+
}
|
|
238
245
|
|
|
239
|
-
|
|
246
|
+
interface CustomThemeConfig extends ThemeConfig {
|
|
240
247
|
[key: string]: any
|
|
241
248
|
}
|
|
242
249
|
|
|
@@ -359,7 +366,7 @@ interface OptionalConfig {
|
|
|
359
366
|
future: Partial<FutureConfig>
|
|
360
367
|
experimental: Partial<ExperimentalConfig>
|
|
361
368
|
darkMode: Partial<DarkModeConfig>
|
|
362
|
-
theme: Partial<
|
|
369
|
+
theme: Partial<CustomThemeConfig & { extend: Partial<CustomThemeConfig> }>
|
|
363
370
|
corePlugins: Partial<CorePluginsConfig>
|
|
364
371
|
plugins: Partial<PluginsConfig>
|
|
365
372
|
// Custom
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type CorePluginList = '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' | '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' | 'content'
|
|
1
|
+
export type CorePluginList = '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'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Config } from '../../types'
|
|
2
1
|
type CSSDeclarationList = Record<string, string>
|
|
3
|
-
export type DefaultTheme =
|
|
2
|
+
export type DefaultTheme = {
|
|
4
3
|
animation: Record<'none' | 'spin' | 'ping' | 'pulse' | 'bounce', string>
|
|
5
4
|
aria: Record<
|
|
6
5
|
| 'busy'
|
|
@@ -207,16 +206,38 @@ export type DefaultTheme = Config['theme'] & {
|
|
|
207
206
|
string
|
|
208
207
|
>
|
|
209
208
|
gridRow: Record<
|
|
210
|
-
|
|
209
|
+
| 'auto'
|
|
210
|
+
| 'span-1'
|
|
211
|
+
| 'span-2'
|
|
212
|
+
| 'span-3'
|
|
213
|
+
| 'span-4'
|
|
214
|
+
| 'span-5'
|
|
215
|
+
| 'span-6'
|
|
216
|
+
| 'span-7'
|
|
217
|
+
| 'span-8'
|
|
218
|
+
| 'span-9'
|
|
219
|
+
| 'span-10'
|
|
220
|
+
| 'span-11'
|
|
221
|
+
| 'span-12'
|
|
222
|
+
| 'span-full',
|
|
223
|
+
string
|
|
224
|
+
>
|
|
225
|
+
gridRowEnd: Record<
|
|
226
|
+
'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | 'auto',
|
|
227
|
+
string
|
|
228
|
+
>
|
|
229
|
+
gridRowStart: Record<
|
|
230
|
+
'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | 'auto',
|
|
211
231
|
string
|
|
212
232
|
>
|
|
213
|
-
gridRowEnd: Record<'1' | '2' | '3' | '4' | '5' | '6' | '7' | 'auto', string>
|
|
214
|
-
gridRowStart: Record<'1' | '2' | '3' | '4' | '5' | '6' | '7' | 'auto', string>
|
|
215
233
|
gridTemplateColumns: Record<
|
|
216
|
-
'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'none',
|
|
234
|
+
'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'none' | 'subgrid',
|
|
235
|
+
string
|
|
236
|
+
>
|
|
237
|
+
gridTemplateRows: Record<
|
|
238
|
+
'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 'none' | 'subgrid',
|
|
217
239
|
string
|
|
218
240
|
>
|
|
219
|
-
gridTemplateRows: Record<'1' | '2' | '3' | '4' | '5' | '6' | 'none', string>
|
|
220
241
|
hueRotate: Record<'0' | '15' | '30' | '60' | '90' | '180', string>
|
|
221
242
|
invert: Record<'0' | 'DEFAULT', string>
|
|
222
243
|
keyframes: Record<'spin' | 'ping' | 'pulse' | 'bounce', Record<string, CSSDeclarationList>>
|
|
@@ -241,8 +262,6 @@ export type DefaultTheme = Config['theme'] & {
|
|
|
241
262
|
listStyleType: Record<'none' | 'disc' | 'decimal', string>
|
|
242
263
|
listStyleImage: Record<'none', string>
|
|
243
264
|
lineClamp: Record<'1' | '2' | '3' | '4' | '5' | '6', string>
|
|
244
|
-
minHeight: Record<'0' | 'full' | 'screen' | 'svh' | 'lvh' | 'dvh' | 'min' | 'max' | 'fit', string>
|
|
245
|
-
minWidth: Record<'0' | 'full' | 'min' | 'max' | 'fit', string>
|
|
246
265
|
objectPosition: Record<
|
|
247
266
|
| 'bottom'
|
|
248
267
|
| 'center'
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { PluginCreator } from 'postcss'
|
|
1
|
+
import type { PluginCreator } from 'postcss'
|
|
2
2
|
import type { Config } from './config.d'
|
|
3
3
|
|
|
4
4
|
declare const plugin: PluginCreator<string | Config | { config: string | Config }>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare type _Config = Config
|
|
7
|
+
declare namespace plugin {
|
|
8
|
+
export type { _Config as Config }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export = plugin
|
package/index.css
DELETED
package/lib/lib/detectNesting.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function isRoot(node) {
|
|
12
|
-
return node.type === 'root';
|
|
13
|
-
}
|
|
14
|
-
function isAtLayer(node) {
|
|
15
|
-
return node.type === 'atrule' && node.name === 'layer';
|
|
16
|
-
}
|
|
17
|
-
function _default(_context) {
|
|
18
|
-
return (root, result)=>{
|
|
19
|
-
let found = false;
|
|
20
|
-
root.walkAtRules('tailwind', (node)=>{
|
|
21
|
-
if (found) return false;
|
|
22
|
-
if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
|
|
23
|
-
found = true;
|
|
24
|
-
node.warn(result, [
|
|
25
|
-
'Nested @tailwind rules were detected, but are not supported.',
|
|
26
|
-
"Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
|
|
27
|
-
'Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy'
|
|
28
|
-
].join('\n'));
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
root.walkRules((rule)=>{
|
|
33
|
-
if (found) return false;
|
|
34
|
-
rule.walkRules((nestedRule)=>{
|
|
35
|
-
found = true;
|
|
36
|
-
nestedRule.warn(result, [
|
|
37
|
-
'Nested CSS was detected, but CSS nesting has not been configured correctly.',
|
|
38
|
-
'Please enable a CSS nesting plugin *before* Tailwind in your configuration.',
|
|
39
|
-
'See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting'
|
|
40
|
-
].join('\n'));
|
|
41
|
-
return false;
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "handleImportAtRules", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return handleImportAtRules;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
12
|
-
const _postcssimport = /*#__PURE__*/ _interop_require_default(require("postcss-import"));
|
|
13
|
-
function _interop_require_default(obj) {
|
|
14
|
-
return obj && obj.__esModule ? obj : {
|
|
15
|
-
default: obj
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
const TAILWIND = Symbol();
|
|
19
|
-
function handleImportAtRules() {
|
|
20
|
-
let RESTORE_ATRULE_COMMENT = '__TAILWIND_RESTORE__';
|
|
21
|
-
let atRulesToRestore = [
|
|
22
|
-
'tailwind',
|
|
23
|
-
'config'
|
|
24
|
-
];
|
|
25
|
-
return [
|
|
26
|
-
(root)=>{
|
|
27
|
-
root.walkAtRules((rule)=>{
|
|
28
|
-
if (!atRulesToRestore.includes(rule.name)) return rule;
|
|
29
|
-
rule.after(_postcss.default.comment({
|
|
30
|
-
text: RESTORE_ATRULE_COMMENT,
|
|
31
|
-
raws: {
|
|
32
|
-
[TAILWIND]: {
|
|
33
|
-
rule
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
rule.remove();
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
(0, _postcssimport.default)(),
|
|
41
|
-
(root)=>{
|
|
42
|
-
root.walkComments((rule)=>{
|
|
43
|
-
if (rule.text === RESTORE_ATRULE_COMMENT) {
|
|
44
|
-
rule.after(rule.raws[TAILWIND].rule);
|
|
45
|
-
rule.remove();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
];
|
|
50
|
-
}
|
package/src/lib/detectNesting.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
function isRoot(node) {
|
|
2
|
-
return node.type === 'root'
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function isAtLayer(node) {
|
|
6
|
-
return node.type === 'atrule' && node.name === 'layer'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function (_context) {
|
|
10
|
-
return (root, result) => {
|
|
11
|
-
let found = false
|
|
12
|
-
|
|
13
|
-
root.walkAtRules('tailwind', (node) => {
|
|
14
|
-
if (found) return false
|
|
15
|
-
|
|
16
|
-
if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
|
|
17
|
-
found = true
|
|
18
|
-
node.warn(
|
|
19
|
-
result,
|
|
20
|
-
[
|
|
21
|
-
'Nested @tailwind rules were detected, but are not supported.',
|
|
22
|
-
"Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
|
|
23
|
-
'Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy',
|
|
24
|
-
].join('\n')
|
|
25
|
-
)
|
|
26
|
-
return false
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
root.walkRules((rule) => {
|
|
31
|
-
if (found) return false
|
|
32
|
-
|
|
33
|
-
rule.walkRules((nestedRule) => {
|
|
34
|
-
found = true
|
|
35
|
-
nestedRule.warn(
|
|
36
|
-
result,
|
|
37
|
-
[
|
|
38
|
-
'Nested CSS was detected, but CSS nesting has not been configured correctly.',
|
|
39
|
-
'Please enable a CSS nesting plugin *before* Tailwind in your configuration.',
|
|
40
|
-
'See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting',
|
|
41
|
-
].join('\n')
|
|
42
|
-
)
|
|
43
|
-
return false
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import postcss from 'postcss'
|
|
2
|
-
import postcssImport from 'postcss-import'
|
|
3
|
-
|
|
4
|
-
const TAILWIND = Symbol()
|
|
5
|
-
|
|
6
|
-
export function handleImportAtRules() {
|
|
7
|
-
let RESTORE_ATRULE_COMMENT = '__TAILWIND_RESTORE__'
|
|
8
|
-
let atRulesToRestore = ['tailwind', 'config']
|
|
9
|
-
|
|
10
|
-
return [
|
|
11
|
-
(root) => {
|
|
12
|
-
root.walkAtRules((rule) => {
|
|
13
|
-
if (!atRulesToRestore.includes(rule.name)) return rule
|
|
14
|
-
|
|
15
|
-
rule.after(
|
|
16
|
-
postcss.comment({
|
|
17
|
-
text: RESTORE_ATRULE_COMMENT,
|
|
18
|
-
raws: { [TAILWIND]: { rule } },
|
|
19
|
-
})
|
|
20
|
-
)
|
|
21
|
-
rule.remove()
|
|
22
|
-
})
|
|
23
|
-
},
|
|
24
|
-
postcssImport(),
|
|
25
|
-
(root) => {
|
|
26
|
-
root.walkComments((rule) => {
|
|
27
|
-
if (rule.text === RESTORE_ATRULE_COMMENT) {
|
|
28
|
-
rule.after(rule.raws[TAILWIND].rule)
|
|
29
|
-
rule.remove()
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
},
|
|
33
|
-
]
|
|
34
|
-
}
|