tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea3d9cd
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 -1
- package/index.css +5 -0
- package/lib/cli/build/index.js +23 -10
- package/lib/cli/build/plugin.js +136 -117
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +16 -12
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +223 -10
- package/lib/cli/init/index.js +29 -12
- package/lib/cli.js +1 -227
- package/lib/corePluginList.js +8 -1
- package/lib/corePlugins.js +374 -77
- package/lib/css/preflight.css +9 -1
- package/lib/featureFlags.js +30 -17
- package/lib/index.js +1 -47
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +5 -3
- package/lib/lib/collapseDuplicateDeclarations.js +12 -10
- package/lib/lib/content.js +61 -31
- package/lib/lib/defaultExtractor.js +15 -8
- package/lib/lib/detectNesting.js +10 -2
- package/lib/lib/evaluateTailwindFunctions.js +24 -20
- package/lib/lib/expandApplyAtRules.js +43 -35
- package/lib/lib/expandTailwindAtRules.js +89 -22
- package/lib/lib/findAtConfigPath.js +9 -7
- package/lib/lib/generateRules.js +160 -98
- package/lib/lib/getModuleDependencies.js +85 -37
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +5 -18
- package/lib/lib/offsets.js +93 -4
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +28 -24
- package/lib/lib/setupContextUtils.js +191 -142
- package/lib/lib/setupTrackingContext.js +50 -26
- package/lib/lib/sharedState.js +28 -9
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/plugin.js +116 -0
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +10 -8
- package/lib/processTailwindFeatures.js +14 -12
- package/lib/public/colors.js +49 -25
- 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 +12 -0
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +36 -0
- 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 +5 -3
- package/lib/util/color.js +30 -12
- 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 +7 -5
- package/lib/util/dataTypes.js +88 -23
- package/lib/util/defaults.js +9 -7
- package/lib/util/escapeClassName.js +10 -8
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +138 -160
- package/lib/util/getAllConfigs.js +8 -6
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +3 -1
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +25 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +4 -2
- package/lib/util/normalizeConfig.js +63 -36
- 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 +53 -55
- package/lib/util/prefixSelector.js +27 -11
- package/lib/util/pseudoElements.js +209 -0
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +17 -15
- package/lib/util/resolveConfigPath.js +26 -10
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +10 -2
- 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 +27 -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/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +46 -45
- package/resolveConfig.d.ts +11 -2
- package/src/cli/build/index.js +17 -9
- package/src/cli/build/plugin.js +96 -73
- package/src/cli/build/watching.js +4 -2
- package/src/cli/index.js +217 -3
- package/src/cli/init/index.js +37 -8
- package/src/cli.js +1 -221
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +237 -34
- package/src/css/preflight.css +9 -1
- package/src/featureFlags.js +7 -3
- package/src/index.js +1 -47
- package/src/lib/content.js +45 -18
- package/src/lib/defaultExtractor.js +9 -3
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandApplyAtRules.js +8 -1
- package/src/lib/expandTailwindAtRules.js +73 -12
- package/src/lib/generateRules.js +127 -49
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/load-config.ts +31 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/offsets.js +104 -1
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +109 -69
- package/src/lib/setupTrackingContext.js +37 -14
- package/src/lib/sharedState.js +11 -4
- package/src/plugin.js +124 -0
- package/src/public/colors.js +22 -0
- package/src/public/default-config.js +1 -1
- package/src/public/default-theme.js +2 -2
- package/src/public/load-config.js +2 -0
- package/src/util/applyImportantSelector.js +27 -0
- package/src/util/color.js +18 -3
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +49 -9
- package/src/util/formatVariantSelector.js +160 -163
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/log.js +24 -0
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +39 -11
- package/src/util/pluginUtils.js +16 -35
- package/src/util/prefixSelector.js +28 -10
- package/src/util/pseudoElements.js +167 -0
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +23 -0
- 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/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +197 -147
- package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -2
- package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
- package/stubs/postcss.config.js +5 -0
- package/stubs/tailwind.config.cjs +2 -0
- package/stubs/tailwind.config.js +2 -0
- package/stubs/tailwind.config.ts +3 -0
- package/types/config.d.ts +17 -10
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +110 -80
- package/CHANGELOG.md +0 -2336
- package/lib/cli/build/deps.js +0 -54
- package/lib/cli/shared.js +0 -12
- package/lib/cli-peer-dependencies.js +0 -28
- package/lib/constants.js +0 -44
- package/peers/index.js +0 -79512
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/build/deps.js +0 -56
- package/src/cli/shared.js +0 -5
- package/src/cli-peer-dependencies.js +0 -15
- package/src/constants.js +0 -17
|
@@ -9,36 +9,45 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
isValidVariantFormatString: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
isValidVariantFormatString: function() {
|
|
13
|
+
return isValidVariantFormatString;
|
|
14
|
+
},
|
|
15
|
+
parseVariant: function() {
|
|
16
|
+
return parseVariant;
|
|
17
|
+
},
|
|
18
|
+
getFileModifiedMap: function() {
|
|
19
|
+
return getFileModifiedMap;
|
|
20
|
+
},
|
|
21
|
+
createContext: function() {
|
|
22
|
+
return createContext;
|
|
23
|
+
},
|
|
24
|
+
getContext: function() {
|
|
25
|
+
return getContext;
|
|
26
|
+
}
|
|
17
27
|
});
|
|
18
|
-
const _fs = /*#__PURE__*/
|
|
19
|
-
const _url = /*#__PURE__*/
|
|
20
|
-
const _postcss = /*#__PURE__*/
|
|
21
|
-
const _dlv = /*#__PURE__*/
|
|
22
|
-
const
|
|
23
|
-
const _transformThemeValue = /*#__PURE__*/
|
|
24
|
-
const _parseObjectStyles = /*#__PURE__*/
|
|
25
|
-
const _prefixSelector = /*#__PURE__*/
|
|
26
|
-
const _isPlainObject = /*#__PURE__*/
|
|
27
|
-
const _escapeClassName = /*#__PURE__*/
|
|
28
|
-
const _nameClass = /*#__PURE__*/
|
|
28
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
29
|
+
const _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
30
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
31
|
+
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
32
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
33
|
+
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
34
|
+
const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
|
|
35
|
+
const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
|
|
36
|
+
const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
|
|
37
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
|
|
38
|
+
const _nameClass = /*#__PURE__*/ _interop_require_wildcard(require("../util/nameClass"));
|
|
29
39
|
const _pluginUtils = require("../util/pluginUtils");
|
|
30
40
|
const _corePlugins = require("../corePlugins");
|
|
31
|
-
const _sharedState = /*#__PURE__*/
|
|
41
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
32
42
|
const _toPath = require("../util/toPath");
|
|
33
|
-
const _log = /*#__PURE__*/
|
|
34
|
-
const _negateValue = /*#__PURE__*/
|
|
35
|
-
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/
|
|
43
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
44
|
+
const _negateValue = /*#__PURE__*/ _interop_require_default(require("../util/negateValue"));
|
|
45
|
+
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
|
|
36
46
|
const _generateRules = require("./generateRules");
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const _featureFlagsJs = require("../featureFlags.js");
|
|
47
|
+
const _cacheInvalidation = require("./cacheInvalidation.js");
|
|
48
|
+
const _offsets = require("./offsets.js");
|
|
40
49
|
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
41
|
-
function
|
|
50
|
+
function _interop_require_default(obj) {
|
|
42
51
|
return obj && obj.__esModule ? obj : {
|
|
43
52
|
default: obj
|
|
44
53
|
};
|
|
@@ -51,7 +60,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
51
60
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
52
61
|
})(nodeInterop);
|
|
53
62
|
}
|
|
54
|
-
function
|
|
63
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
55
64
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
56
65
|
return obj;
|
|
57
66
|
}
|
|
@@ -113,27 +122,41 @@ function normalizeOptionTypes({ type ="any" , ...options }) {
|
|
|
113
122
|
};
|
|
114
123
|
}
|
|
115
124
|
function parseVariantFormatString(input) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
/** @type {string[]} */ let parts = [];
|
|
126
|
+
// When parsing whitespace around special characters are insignificant
|
|
127
|
+
// However, _inside_ of a variant they could be
|
|
128
|
+
// Because the selector could look like this
|
|
129
|
+
// @media { &[data-name="foo bar"] }
|
|
130
|
+
// This is why we do not skip whitespace
|
|
131
|
+
let current = "";
|
|
132
|
+
let depth = 0;
|
|
133
|
+
for(let idx = 0; idx < input.length; idx++){
|
|
134
|
+
let char = input[idx];
|
|
135
|
+
if (char === "\\") {
|
|
136
|
+
// Escaped characters are not special
|
|
137
|
+
current += "\\" + input[++idx];
|
|
138
|
+
} else if (char === "{") {
|
|
139
|
+
// Nested rule: start
|
|
140
|
+
++depth;
|
|
141
|
+
parts.push(current.trim());
|
|
142
|
+
current = "";
|
|
129
143
|
} else if (char === "}") {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
;
|
|
144
|
+
// Nested rule: end
|
|
145
|
+
if (--depth < 0) {
|
|
146
|
+
throw new Error(`Your { and } are unbalanced.`);
|
|
133
147
|
}
|
|
148
|
+
parts.push(current.trim());
|
|
149
|
+
current = "";
|
|
150
|
+
} else {
|
|
151
|
+
// Normal character
|
|
152
|
+
current += char;
|
|
134
153
|
}
|
|
135
154
|
}
|
|
136
|
-
|
|
155
|
+
if (current.length > 0) {
|
|
156
|
+
parts.push(current.trim());
|
|
157
|
+
}
|
|
158
|
+
parts = parts.filter((part)=>part !== "");
|
|
159
|
+
return parts;
|
|
137
160
|
}
|
|
138
161
|
function insertInto(list, value, { before =[] } = {}) {
|
|
139
162
|
before = [].concat(before);
|
|
@@ -161,7 +184,7 @@ function parseStyles(styles) {
|
|
|
161
184
|
});
|
|
162
185
|
}
|
|
163
186
|
function getClasses(selector, mutate) {
|
|
164
|
-
let parser = (0,
|
|
187
|
+
let parser = (0, _postcssselectorparser.default)((selectors)=>{
|
|
165
188
|
let allClasses = [];
|
|
166
189
|
if (mutate) {
|
|
167
190
|
mutate(selectors);
|
|
@@ -281,26 +304,20 @@ function parseVariant(variant) {
|
|
|
281
304
|
return context.tailwindConfig.prefix + identifier;
|
|
282
305
|
}
|
|
283
306
|
function resolveThemeValue(path, defaultValue, opts = {}) {
|
|
284
|
-
|
|
285
|
-
|
|
307
|
+
let parts = (0, _toPath.toPath)(path);
|
|
308
|
+
let value = getConfigValue([
|
|
286
309
|
"theme",
|
|
287
|
-
|
|
288
|
-
...subPaths
|
|
310
|
+
...parts
|
|
289
311
|
], defaultValue);
|
|
290
|
-
return (0, _transformThemeValue.default)(
|
|
312
|
+
return (0, _transformThemeValue.default)(parts[0])(value, opts);
|
|
291
313
|
}
|
|
292
|
-
const theme = Object.assign((path, defaultValue = undefined)=>resolveThemeValue(path, defaultValue), {
|
|
293
|
-
withAlpha: (path, opacityValue)=>resolveThemeValue(path, undefined, {
|
|
294
|
-
opacityValue
|
|
295
|
-
})
|
|
296
|
-
});
|
|
297
314
|
let variantIdentifier = 0;
|
|
298
315
|
let api = {
|
|
299
316
|
postcss: _postcss.default,
|
|
300
317
|
prefix: applyConfiguredPrefix,
|
|
301
318
|
e: _escapeClassName.default,
|
|
302
319
|
config: getConfigValue,
|
|
303
|
-
theme,
|
|
320
|
+
theme: resolveThemeValue,
|
|
304
321
|
corePlugins: (path)=>{
|
|
305
322
|
if (Array.isArray(tailwindConfig.corePlugins)) {
|
|
306
323
|
return tailwindConfig.corePlugins.includes(path);
|
|
@@ -443,8 +460,7 @@ function parseVariant(variant) {
|
|
|
443
460
|
return utilityModifier;
|
|
444
461
|
}
|
|
445
462
|
};
|
|
446
|
-
let
|
|
447
|
-
let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
|
|
463
|
+
let ruleSets = [].concat(rule(value, extras)).filter(Boolean).map((declaration)=>({
|
|
448
464
|
[(0, _nameClass.default)(identifier, modifier)]: declaration
|
|
449
465
|
}));
|
|
450
466
|
return ruleSets;
|
|
@@ -509,8 +525,7 @@ function parseVariant(variant) {
|
|
|
509
525
|
return utilityModifier;
|
|
510
526
|
}
|
|
511
527
|
};
|
|
512
|
-
let
|
|
513
|
-
let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
|
|
528
|
+
let ruleSets = [].concat(rule(value, extras)).filter(Boolean).map((declaration)=>({
|
|
514
529
|
[(0, _nameClass.default)(identifier, modifier)]: declaration
|
|
515
530
|
}));
|
|
516
531
|
return ruleSets;
|
|
@@ -565,21 +580,18 @@ function parseVariant(variant) {
|
|
|
565
580
|
context.variantOptions.set(variantName, options);
|
|
566
581
|
},
|
|
567
582
|
matchVariant (variant, variantFn, options) {
|
|
568
|
-
var
|
|
583
|
+
var _options_id;
|
|
569
584
|
// A unique identifier that "groups" these variants together.
|
|
570
585
|
// This is for internal use only which is why it is not present in the types
|
|
571
|
-
let id = (
|
|
586
|
+
let id = (_options_id = options === null || options === void 0 ? void 0 : options.id) !== null && _options_id !== void 0 ? _options_id : ++variantIdentifier;
|
|
572
587
|
let isSpecial = variant === "@";
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
for (let [key, value] of Object.entries((ref1 = options === null || options === void 0 ? void 0 : options.values) !== null && ref1 !== void 0 ? ref1 : {})){
|
|
588
|
+
var _options_values;
|
|
589
|
+
for (let [key, value] of Object.entries((_options_values = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values !== void 0 ? _options_values : {})){
|
|
576
590
|
if (key === "DEFAULT") continue;
|
|
577
591
|
api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>{
|
|
578
|
-
return variantFn(value,
|
|
592
|
+
return variantFn(value, {
|
|
579
593
|
modifier: args === null || args === void 0 ? void 0 : args.modifier,
|
|
580
594
|
container
|
|
581
|
-
} : {
|
|
582
|
-
container
|
|
583
595
|
});
|
|
584
596
|
}, {
|
|
585
597
|
...options,
|
|
@@ -589,19 +601,17 @@ function parseVariant(variant) {
|
|
|
589
601
|
variantInfo: VARIANT_INFO.Base
|
|
590
602
|
});
|
|
591
603
|
}
|
|
592
|
-
var
|
|
593
|
-
let hasDefault = "DEFAULT" in ((
|
|
604
|
+
var _options_values1;
|
|
605
|
+
let hasDefault = "DEFAULT" in ((_options_values1 = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {});
|
|
594
606
|
api.addVariant(variant, ({ args , container })=>{
|
|
595
607
|
if ((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE && !hasDefault) {
|
|
596
608
|
return null;
|
|
597
609
|
}
|
|
598
610
|
var // (JetBrains) plugins.
|
|
599
|
-
|
|
600
|
-
return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (
|
|
611
|
+
_args_value;
|
|
612
|
+
return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (_args_value = args === null || args === void 0 ? void 0 : args.value) !== null && _args_value !== void 0 ? _args_value : typeof args === "string" ? args : "", {
|
|
601
613
|
modifier: args === null || args === void 0 ? void 0 : args.modifier,
|
|
602
614
|
container
|
|
603
|
-
} : {
|
|
604
|
-
container
|
|
605
615
|
});
|
|
606
616
|
}, {
|
|
607
617
|
...options,
|
|
@@ -622,24 +632,28 @@ function getFileModifiedMap(context) {
|
|
|
622
632
|
}
|
|
623
633
|
function trackModified(files, fileModifiedMap) {
|
|
624
634
|
let changed = false;
|
|
635
|
+
let mtimesToCommit = new Map();
|
|
625
636
|
for (let file of files){
|
|
626
|
-
var
|
|
637
|
+
var _fs_statSync;
|
|
627
638
|
if (!file) continue;
|
|
628
639
|
let parsed = _url.default.parse(file);
|
|
629
640
|
let pathname = parsed.hash ? parsed.href.replace(parsed.hash, "") : parsed.href;
|
|
630
641
|
pathname = parsed.search ? pathname.replace(parsed.search, "") : pathname;
|
|
631
|
-
let newModified = (
|
|
642
|
+
let newModified = (_fs_statSync = _fs.default.statSync(decodeURIComponent(pathname), {
|
|
632
643
|
throwIfNoEntry: false
|
|
633
|
-
})) === null ||
|
|
644
|
+
})) === null || _fs_statSync === void 0 ? void 0 : _fs_statSync.mtimeMs;
|
|
634
645
|
if (!newModified) {
|
|
635
646
|
continue;
|
|
636
647
|
}
|
|
637
648
|
if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) {
|
|
638
649
|
changed = true;
|
|
639
650
|
}
|
|
640
|
-
|
|
651
|
+
mtimesToCommit.set(file, newModified);
|
|
641
652
|
}
|
|
642
|
-
return
|
|
653
|
+
return [
|
|
654
|
+
changed,
|
|
655
|
+
mtimesToCommit
|
|
656
|
+
];
|
|
643
657
|
}
|
|
644
658
|
function extractVariantAtRules(node) {
|
|
645
659
|
node.walkAtRules((atRule)=>{
|
|
@@ -677,9 +691,9 @@ function collectLayerPlugins(root) {
|
|
|
677
691
|
}
|
|
678
692
|
layerRule.remove();
|
|
679
693
|
} else if (layerRule.params === "components") {
|
|
680
|
-
for (let
|
|
694
|
+
for (let node of layerRule.nodes){
|
|
681
695
|
layerPlugins.push(function({ addComponents }) {
|
|
682
|
-
addComponents(
|
|
696
|
+
addComponents(node, {
|
|
683
697
|
respectPrefix: false,
|
|
684
698
|
preserveSource: true
|
|
685
699
|
});
|
|
@@ -687,9 +701,9 @@ function collectLayerPlugins(root) {
|
|
|
687
701
|
}
|
|
688
702
|
layerRule.remove();
|
|
689
703
|
} else if (layerRule.params === "utilities") {
|
|
690
|
-
for (let
|
|
704
|
+
for (let node of layerRule.nodes){
|
|
691
705
|
layerPlugins.push(function({ addUtilities }) {
|
|
692
|
-
addUtilities(
|
|
706
|
+
addUtilities(node, {
|
|
693
707
|
respectPrefix: false,
|
|
694
708
|
preserveSource: true
|
|
695
709
|
});
|
|
@@ -701,10 +715,7 @@ function collectLayerPlugins(root) {
|
|
|
701
715
|
return layerPlugins;
|
|
702
716
|
}
|
|
703
717
|
function resolvePlugins(context, root) {
|
|
704
|
-
let corePluginList = Object.entries({
|
|
705
|
-
..._corePlugins.variantPlugins,
|
|
706
|
-
..._corePlugins.corePlugins
|
|
707
|
-
}).map(([name, plugin])=>{
|
|
718
|
+
let corePluginList = Object.entries(_corePlugins.corePlugins).map(([name, plugin])=>{
|
|
708
719
|
if (!context.tailwindConfig.corePlugins.includes(name)) {
|
|
709
720
|
return null;
|
|
710
721
|
}
|
|
@@ -722,6 +733,7 @@ function resolvePlugins(context, root) {
|
|
|
722
733
|
let beforeVariants = [
|
|
723
734
|
_corePlugins.variantPlugins["pseudoElementVariants"],
|
|
724
735
|
_corePlugins.variantPlugins["pseudoClassVariants"],
|
|
736
|
+
_corePlugins.variantPlugins["hasVariants"],
|
|
725
737
|
_corePlugins.variantPlugins["ariaVariants"],
|
|
726
738
|
_corePlugins.variantPlugins["dataVariants"]
|
|
727
739
|
];
|
|
@@ -747,7 +759,7 @@ function registerPlugins(plugins, context) {
|
|
|
747
759
|
let variantList = [];
|
|
748
760
|
let variantMap = new Map();
|
|
749
761
|
context.variantMap = variantMap;
|
|
750
|
-
let offsets = new
|
|
762
|
+
let offsets = new _offsets.Offsets();
|
|
751
763
|
context.offsets = offsets;
|
|
752
764
|
let classList = new Set();
|
|
753
765
|
let pluginApi = buildPluginApi(context.tailwindConfig, context, {
|
|
@@ -774,8 +786,8 @@ function registerPlugins(plugins, context) {
|
|
|
774
786
|
variantFunction
|
|
775
787
|
]));
|
|
776
788
|
}
|
|
777
|
-
var
|
|
778
|
-
let safelist = ((
|
|
789
|
+
var _context_tailwindConfig_safelist;
|
|
790
|
+
let safelist = ((_context_tailwindConfig_safelist = context.tailwindConfig.safelist) !== null && _context_tailwindConfig_safelist !== void 0 ? _context_tailwindConfig_safelist : []).filter(Boolean);
|
|
779
791
|
if (safelist.length > 0) {
|
|
780
792
|
let checks = [];
|
|
781
793
|
for (let value of safelist){
|
|
@@ -803,8 +815,8 @@ function registerPlugins(plugins, context) {
|
|
|
803
815
|
for (let util of classList){
|
|
804
816
|
let utils = Array.isArray(util) ? (()=>{
|
|
805
817
|
let [utilName, options] = util;
|
|
806
|
-
var
|
|
807
|
-
let values = Object.keys((
|
|
818
|
+
var _options_values;
|
|
819
|
+
let values = Object.keys((_options_values = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values !== void 0 ? _options_values : {});
|
|
808
820
|
let classes = values.map((value)=>(0, _nameClass.formatClass)(utilName, value));
|
|
809
821
|
if (options === null || options === void 0 ? void 0 : options.supportsNegativeValues) {
|
|
810
822
|
// This is the normal negated version
|
|
@@ -838,7 +850,7 @@ function registerPlugins(plugins, context) {
|
|
|
838
850
|
})() : [
|
|
839
851
|
util
|
|
840
852
|
];
|
|
841
|
-
for (let
|
|
853
|
+
for (let util of utils){
|
|
842
854
|
for (let { pattern , variants =[] } of checks){
|
|
843
855
|
// RegExp with the /g flag are stateful, so let's reset the last
|
|
844
856
|
// index pointer to reset the state.
|
|
@@ -846,15 +858,15 @@ function registerPlugins(plugins, context) {
|
|
|
846
858
|
if (!patternMatchingCount.has(pattern)) {
|
|
847
859
|
patternMatchingCount.set(pattern, 0);
|
|
848
860
|
}
|
|
849
|
-
if (!pattern.test(
|
|
861
|
+
if (!pattern.test(util)) continue;
|
|
850
862
|
patternMatchingCount.set(pattern, patternMatchingCount.get(pattern) + 1);
|
|
851
863
|
context.changedContent.push({
|
|
852
|
-
content:
|
|
864
|
+
content: util,
|
|
853
865
|
extension: "html"
|
|
854
866
|
});
|
|
855
867
|
for (let variant of variants){
|
|
856
868
|
context.changedContent.push({
|
|
857
|
-
content: variant + context.tailwindConfig.separator +
|
|
869
|
+
content: variant + context.tailwindConfig.separator + util,
|
|
858
870
|
extension: "html"
|
|
859
871
|
});
|
|
860
872
|
}
|
|
@@ -871,8 +883,8 @@ function registerPlugins(plugins, context) {
|
|
|
871
883
|
}
|
|
872
884
|
}
|
|
873
885
|
}
|
|
874
|
-
var
|
|
875
|
-
let darkClassName = (
|
|
886
|
+
var _context_tailwindConfig_darkMode, _concat_;
|
|
887
|
+
let darkClassName = (_concat_ = [].concat((_context_tailwindConfig_darkMode = context.tailwindConfig.darkMode) !== null && _context_tailwindConfig_darkMode !== void 0 ? _context_tailwindConfig_darkMode : "media")[1]) !== null && _concat_ !== void 0 ? _concat_ : "dark";
|
|
876
888
|
// A list of utilities that are used by certain Tailwind CSS utilities but
|
|
877
889
|
// that don't exist on their own. This will result in them "not existing" and
|
|
878
890
|
// sorting could be weird since you still require them in order to make the
|
|
@@ -883,22 +895,30 @@ function registerPlugins(plugins, context) {
|
|
|
883
895
|
prefix(context, "peer")
|
|
884
896
|
];
|
|
885
897
|
context.getClassOrder = function getClassOrder(classes) {
|
|
898
|
+
// Sort classes so they're ordered in a deterministic manner
|
|
899
|
+
let sorted = [
|
|
900
|
+
...classes
|
|
901
|
+
].sort((a, z)=>{
|
|
902
|
+
if (a === z) return 0;
|
|
903
|
+
if (a < z) return -1;
|
|
904
|
+
return 1;
|
|
905
|
+
});
|
|
886
906
|
// Non-util classes won't be generated, so we default them to null
|
|
887
|
-
let sortedClassNames = new Map(
|
|
907
|
+
let sortedClassNames = new Map(sorted.map((className)=>[
|
|
888
908
|
className,
|
|
889
909
|
null
|
|
890
910
|
]));
|
|
891
911
|
// Sort all classes in order
|
|
892
912
|
// Non-tailwind classes won't be generated and will be left as `null`
|
|
893
|
-
let rules = (0, _generateRules.generateRules)(new Set(
|
|
913
|
+
let rules = (0, _generateRules.generateRules)(new Set(sorted), context);
|
|
894
914
|
rules = context.offsets.sort(rules);
|
|
895
915
|
let idx = BigInt(parasiteUtilities.length);
|
|
896
916
|
for (const [, rule] of rules){
|
|
897
917
|
sortedClassNames.set(rule.raws.tailwind.candidate, idx++);
|
|
898
918
|
}
|
|
899
919
|
return classes.map((className)=>{
|
|
900
|
-
var
|
|
901
|
-
let order = (
|
|
920
|
+
var _sortedClassNames_get;
|
|
921
|
+
let order = (_sortedClassNames_get = sortedClassNames.get(className)) !== null && _sortedClassNames_get !== void 0 ? _sortedClassNames_get : null;
|
|
902
922
|
let parasiteIndex = parasiteUtilities.indexOf(className);
|
|
903
923
|
if (order === null && parasiteIndex !== -1) {
|
|
904
924
|
// This will make sure that it is at the very beginning of the
|
|
@@ -914,21 +934,40 @@ function registerPlugins(plugins, context) {
|
|
|
914
934
|
};
|
|
915
935
|
// Generate a list of strings for autocompletion purposes, e.g.
|
|
916
936
|
// ['uppercase', 'lowercase', ...]
|
|
917
|
-
context.getClassList = function getClassList() {
|
|
937
|
+
context.getClassList = function getClassList(options = {}) {
|
|
918
938
|
let output = [];
|
|
919
939
|
for (let util of classList){
|
|
920
940
|
if (Array.isArray(util)) {
|
|
921
|
-
|
|
941
|
+
var _utilOptions_types;
|
|
942
|
+
let [utilName, utilOptions] = util;
|
|
922
943
|
let negativeClasses = [];
|
|
923
|
-
var
|
|
924
|
-
|
|
944
|
+
var _utilOptions_modifiers;
|
|
945
|
+
let modifiers = Object.keys((_utilOptions_modifiers = utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.modifiers) !== null && _utilOptions_modifiers !== void 0 ? _utilOptions_modifiers : {});
|
|
946
|
+
if (utilOptions === null || utilOptions === void 0 ? void 0 : (_utilOptions_types = utilOptions.types) === null || _utilOptions_types === void 0 ? void 0 : _utilOptions_types.some(({ type })=>type === "color")) {
|
|
947
|
+
var _context_tailwindConfig_theme_opacity;
|
|
948
|
+
modifiers.push(...Object.keys((_context_tailwindConfig_theme_opacity = context.tailwindConfig.theme.opacity) !== null && _context_tailwindConfig_theme_opacity !== void 0 ? _context_tailwindConfig_theme_opacity : {}));
|
|
949
|
+
}
|
|
950
|
+
let metadata = {
|
|
951
|
+
modifiers
|
|
952
|
+
};
|
|
953
|
+
let includeMetadata = options.includeMetadata && modifiers.length > 0;
|
|
954
|
+
var _utilOptions_values;
|
|
955
|
+
for (let [key, value] of Object.entries((_utilOptions_values = utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.values) !== null && _utilOptions_values !== void 0 ? _utilOptions_values : {})){
|
|
925
956
|
// Ignore undefined and null values
|
|
926
957
|
if (value == null) {
|
|
927
958
|
continue;
|
|
928
959
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
960
|
+
let cls = (0, _nameClass.formatClass)(utilName, key);
|
|
961
|
+
output.push(includeMetadata ? [
|
|
962
|
+
cls,
|
|
963
|
+
metadata
|
|
964
|
+
] : cls);
|
|
965
|
+
if ((utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.supportsNegativeValues) && (0, _negateValue.default)(value)) {
|
|
966
|
+
let cls = (0, _nameClass.formatClass)(utilName, `-${key}`);
|
|
967
|
+
negativeClasses.push(includeMetadata ? [
|
|
968
|
+
cls,
|
|
969
|
+
metadata
|
|
970
|
+
] : cls);
|
|
932
971
|
}
|
|
933
972
|
}
|
|
934
973
|
output.push(...negativeClasses);
|
|
@@ -943,11 +982,11 @@ function registerPlugins(plugins, context) {
|
|
|
943
982
|
let result = [];
|
|
944
983
|
for (let [name, options] of context.variantOptions.entries()){
|
|
945
984
|
if (options.variantInfo === VARIANT_INFO.Base) continue;
|
|
946
|
-
var
|
|
985
|
+
var _options_values;
|
|
947
986
|
result.push({
|
|
948
987
|
name,
|
|
949
988
|
isArbitrary: options.type === Symbol.for("MATCH_VARIANT"),
|
|
950
|
-
values: Object.keys((
|
|
989
|
+
values: Object.keys((_options_values = options.values) !== null && _options_values !== void 0 ? _options_values : {}),
|
|
951
990
|
hasDash: name !== "@",
|
|
952
991
|
selectors ({ modifier , value } = {}) {
|
|
953
992
|
let candidate = "__TAILWIND_PLACEHOLDER__";
|
|
@@ -960,17 +999,17 @@ function registerPlugins(plugins, context) {
|
|
|
960
999
|
]
|
|
961
1000
|
});
|
|
962
1001
|
let before = container.toString();
|
|
963
|
-
var
|
|
964
|
-
let fns = ((
|
|
1002
|
+
var _context_variantMap_get;
|
|
1003
|
+
let fns = ((_context_variantMap_get = context.variantMap.get(name)) !== null && _context_variantMap_get !== void 0 ? _context_variantMap_get : []).flatMap(([_, fn])=>fn);
|
|
965
1004
|
let formatStrings = [];
|
|
966
1005
|
for (let fn of fns){
|
|
967
|
-
var
|
|
1006
|
+
var _options_values;
|
|
968
1007
|
let localFormatStrings = [];
|
|
969
|
-
var
|
|
1008
|
+
var _options_values_value;
|
|
970
1009
|
let api = {
|
|
971
1010
|
args: {
|
|
972
1011
|
modifier,
|
|
973
|
-
value: (
|
|
1012
|
+
value: (_options_values_value = (_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[value]) !== null && _options_values_value !== void 0 ? _options_values_value : value
|
|
974
1013
|
},
|
|
975
1014
|
separator: context.tailwindConfig.separator,
|
|
976
1015
|
modifySelectors (modifierFunction) {
|
|
@@ -1021,7 +1060,7 @@ function registerPlugins(plugins, context) {
|
|
|
1021
1060
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
1022
1061
|
// However, plugin authors probably also prepend or append certain
|
|
1023
1062
|
// classes, pseudos, ids, ...
|
|
1024
|
-
let rebuiltBase = (0,
|
|
1063
|
+
let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
|
|
1025
1064
|
selectors.walkClasses((classNode)=>{
|
|
1026
1065
|
classNode.value = `${name}${context.tailwindConfig.separator}${classNode.value}`;
|
|
1027
1066
|
});
|
|
@@ -1044,15 +1083,23 @@ function registerPlugins(plugins, context) {
|
|
|
1044
1083
|
manualFormatStrings.push(`@${atrule.name} (${atrule.params}) { & }`);
|
|
1045
1084
|
});
|
|
1046
1085
|
}
|
|
1047
|
-
var
|
|
1048
|
-
let
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1086
|
+
var _options_values1;
|
|
1087
|
+
let isArbitraryVariant = !(value in ((_options_values1 = options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {}));
|
|
1088
|
+
formatStrings = formatStrings.map((format)=>format.map((str)=>({
|
|
1089
|
+
format: str,
|
|
1090
|
+
isArbitraryVariant
|
|
1091
|
+
})));
|
|
1092
|
+
manualFormatStrings = manualFormatStrings.map((format)=>({
|
|
1093
|
+
format,
|
|
1094
|
+
isArbitraryVariant
|
|
1095
|
+
}));
|
|
1096
|
+
let opts = {
|
|
1097
|
+
candidate,
|
|
1098
|
+
context
|
|
1099
|
+
};
|
|
1100
|
+
let result = formatStrings.map((formats)=>(0, _formatVariantSelector.finalizeSelector)(`.${candidate}`, (0, _formatVariantSelector.formatVariantSelector)(formats, opts), opts).replace(`.${candidate}`, "&").replace("{ & }", "").trim());
|
|
1054
1101
|
if (manualFormatStrings.length > 0) {
|
|
1055
|
-
result.push((0, _formatVariantSelector.formatVariantSelector)("&"
|
|
1102
|
+
result.push((0, _formatVariantSelector.formatVariantSelector)(manualFormatStrings, opts).toString().replace(`.${candidate}`, "&"));
|
|
1056
1103
|
}
|
|
1057
1104
|
return result;
|
|
1058
1105
|
}
|
|
@@ -1098,7 +1145,7 @@ function registerPlugins(plugins, context) {
|
|
|
1098
1145
|
markInvalidUtilityCandidate(context, candidate);
|
|
1099
1146
|
}
|
|
1100
1147
|
function createContext(tailwindConfig, changedContent = [], root = _postcss.default.root()) {
|
|
1101
|
-
var
|
|
1148
|
+
var _tailwindConfig_blocklist;
|
|
1102
1149
|
let context = {
|
|
1103
1150
|
disposables: [],
|
|
1104
1151
|
ruleCache: new Set(),
|
|
@@ -1106,7 +1153,7 @@ function createContext(tailwindConfig, changedContent = [], root = _postcss.defa
|
|
|
1106
1153
|
classCache: new Map(),
|
|
1107
1154
|
applyClassCache: new Map(),
|
|
1108
1155
|
// Seed the not class cache with the blocklist (which is only strings)
|
|
1109
|
-
notClassCache: new Set((
|
|
1156
|
+
notClassCache: new Set((_tailwindConfig_blocklist = tailwindConfig.blocklist) !== null && _tailwindConfig_blocklist !== void 0 ? _tailwindConfig_blocklist : []),
|
|
1110
1157
|
postCssNodeCache: new Map(),
|
|
1111
1158
|
candidateRuleMap: new Map(),
|
|
1112
1159
|
tailwindConfig,
|
|
@@ -1137,17 +1184,18 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1137
1184
|
contextMap.set(sourcePath, context);
|
|
1138
1185
|
existingContext = context;
|
|
1139
1186
|
}
|
|
1140
|
-
let cssDidChange = (0,
|
|
1187
|
+
let cssDidChange = (0, _cacheInvalidation.hasContentChanged)(sourcePath, root);
|
|
1141
1188
|
// If there's already a context in the cache and we don't need to
|
|
1142
1189
|
// reset the context, return the cached context.
|
|
1143
1190
|
if (existingContext) {
|
|
1144
|
-
let contextDependenciesChanged = trackModified([
|
|
1191
|
+
let [contextDependenciesChanged, mtimesToCommit] = trackModified([
|
|
1145
1192
|
...contextDependencies
|
|
1146
1193
|
], getFileModifiedMap(existingContext));
|
|
1147
1194
|
if (!contextDependenciesChanged && !cssDidChange) {
|
|
1148
1195
|
return [
|
|
1149
1196
|
existingContext,
|
|
1150
|
-
false
|
|
1197
|
+
false,
|
|
1198
|
+
mtimesToCommit
|
|
1151
1199
|
];
|
|
1152
1200
|
}
|
|
1153
1201
|
}
|
|
@@ -1162,9 +1210,9 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1162
1210
|
contextSourcesMap.get(oldContext).delete(sourcePath);
|
|
1163
1211
|
if (contextSourcesMap.get(oldContext).size === 0) {
|
|
1164
1212
|
contextSourcesMap.delete(oldContext);
|
|
1165
|
-
for (let [
|
|
1166
|
-
if (
|
|
1167
|
-
configContextMap.delete(
|
|
1213
|
+
for (let [tailwindConfigHash, context] of configContextMap){
|
|
1214
|
+
if (context === oldContext) {
|
|
1215
|
+
configContextMap.delete(tailwindConfigHash);
|
|
1168
1216
|
}
|
|
1169
1217
|
}
|
|
1170
1218
|
for (let disposable of oldContext.disposables.splice(0)){
|
|
@@ -1174,23 +1222,24 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1174
1222
|
}
|
|
1175
1223
|
}
|
|
1176
1224
|
_sharedState.env.DEBUG && console.log("Setting up new context...");
|
|
1177
|
-
let
|
|
1178
|
-
Object.assign(
|
|
1225
|
+
let context = createContext(tailwindConfig, [], root);
|
|
1226
|
+
Object.assign(context, {
|
|
1179
1227
|
userConfigPath
|
|
1180
1228
|
});
|
|
1181
|
-
trackModified([
|
|
1229
|
+
let [, mtimesToCommit] = trackModified([
|
|
1182
1230
|
...contextDependencies
|
|
1183
|
-
], getFileModifiedMap(
|
|
1231
|
+
], getFileModifiedMap(context));
|
|
1184
1232
|
// ---
|
|
1185
1233
|
// Update all context tracking state
|
|
1186
|
-
configContextMap.set(tailwindConfigHash,
|
|
1187
|
-
contextMap.set(sourcePath,
|
|
1188
|
-
if (!contextSourcesMap.has(
|
|
1189
|
-
contextSourcesMap.set(
|
|
1234
|
+
configContextMap.set(tailwindConfigHash, context);
|
|
1235
|
+
contextMap.set(sourcePath, context);
|
|
1236
|
+
if (!contextSourcesMap.has(context)) {
|
|
1237
|
+
contextSourcesMap.set(context, new Set());
|
|
1190
1238
|
}
|
|
1191
|
-
contextSourcesMap.get(
|
|
1239
|
+
contextSourcesMap.get(context).add(sourcePath);
|
|
1192
1240
|
return [
|
|
1193
|
-
|
|
1194
|
-
true
|
|
1241
|
+
context,
|
|
1242
|
+
true,
|
|
1243
|
+
mtimesToCommit
|
|
1195
1244
|
];
|
|
1196
1245
|
}
|