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
|
@@ -9,36 +9,49 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
INTERNAL_FEATURES: function() {
|
|
13
|
+
return INTERNAL_FEATURES;
|
|
14
|
+
},
|
|
15
|
+
isValidVariantFormatString: function() {
|
|
16
|
+
return isValidVariantFormatString;
|
|
17
|
+
},
|
|
18
|
+
parseVariant: function() {
|
|
19
|
+
return parseVariant;
|
|
20
|
+
},
|
|
21
|
+
getFileModifiedMap: function() {
|
|
22
|
+
return getFileModifiedMap;
|
|
23
|
+
},
|
|
24
|
+
createContext: function() {
|
|
25
|
+
return createContext;
|
|
26
|
+
},
|
|
27
|
+
getContext: function() {
|
|
28
|
+
return getContext;
|
|
29
|
+
}
|
|
17
30
|
});
|
|
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__*/
|
|
31
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
32
|
+
const _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
33
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
34
|
+
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
35
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
36
|
+
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
37
|
+
const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
|
|
38
|
+
const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
|
|
39
|
+
const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
|
|
40
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
|
|
41
|
+
const _nameClass = /*#__PURE__*/ _interop_require_wildcard(require("../util/nameClass"));
|
|
29
42
|
const _pluginUtils = require("../util/pluginUtils");
|
|
30
43
|
const _corePlugins = require("../corePlugins");
|
|
31
|
-
const _sharedState = /*#__PURE__*/
|
|
44
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
32
45
|
const _toPath = require("../util/toPath");
|
|
33
|
-
const _log = /*#__PURE__*/
|
|
34
|
-
const _negateValue = /*#__PURE__*/
|
|
35
|
-
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/
|
|
46
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
47
|
+
const _negateValue = /*#__PURE__*/ _interop_require_default(require("../util/negateValue"));
|
|
48
|
+
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
|
|
36
49
|
const _generateRules = require("./generateRules");
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
50
|
+
const _cacheInvalidation = require("./cacheInvalidation.js");
|
|
51
|
+
const _offsets = require("./offsets.js");
|
|
52
|
+
const _featureFlags = require("../featureFlags.js");
|
|
40
53
|
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
41
|
-
function
|
|
54
|
+
function _interop_require_default(obj) {
|
|
42
55
|
return obj && obj.__esModule ? obj : {
|
|
43
56
|
default: obj
|
|
44
57
|
};
|
|
@@ -51,7 +64,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
51
64
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
52
65
|
})(nodeInterop);
|
|
53
66
|
}
|
|
54
|
-
function
|
|
67
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
55
68
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
56
69
|
return obj;
|
|
57
70
|
}
|
|
@@ -82,6 +95,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
82
95
|
}
|
|
83
96
|
return newObj;
|
|
84
97
|
}
|
|
98
|
+
const INTERNAL_FEATURES = Symbol();
|
|
85
99
|
const VARIANT_TYPES = {
|
|
86
100
|
AddVariant: Symbol.for("ADD_VARIANT"),
|
|
87
101
|
MatchVariant: Symbol.for("MATCH_VARIANT")
|
|
@@ -175,7 +189,7 @@ function parseStyles(styles) {
|
|
|
175
189
|
});
|
|
176
190
|
}
|
|
177
191
|
function getClasses(selector, mutate) {
|
|
178
|
-
let parser = (0,
|
|
192
|
+
let parser = (0, _postcssselectorparser.default)((selectors)=>{
|
|
179
193
|
let allClasses = [];
|
|
180
194
|
if (mutate) {
|
|
181
195
|
mutate(selectors);
|
|
@@ -187,39 +201,41 @@ function getClasses(selector, mutate) {
|
|
|
187
201
|
});
|
|
188
202
|
return parser.transformSync(selector);
|
|
189
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Ignore everything inside a :not(...). This allows you to write code like
|
|
206
|
+
* `div:not(.foo)`. If `.foo` is never found in your code, then we used to
|
|
207
|
+
* not generated it. But now we will ignore everything inside a `:not`, so
|
|
208
|
+
* that it still gets generated.
|
|
209
|
+
*
|
|
210
|
+
* @param {selectorParser.Root} selectors
|
|
211
|
+
*/ function ignoreNot(selectors) {
|
|
212
|
+
selectors.walkPseudos((pseudo)=>{
|
|
213
|
+
if (pseudo.value === ":not") {
|
|
214
|
+
pseudo.remove();
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
190
218
|
function extractCandidates(node, state = {
|
|
191
219
|
containsNonOnDemandable: false
|
|
192
220
|
}, depth = 0) {
|
|
193
221
|
let classes = [];
|
|
194
|
-
|
|
222
|
+
let selectors = [];
|
|
195
223
|
if (node.type === "rule") {
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
224
|
+
// Handle normal rules
|
|
225
|
+
selectors.push(...node.selectors);
|
|
226
|
+
} else if (node.type === "atrule") {
|
|
227
|
+
// Handle at-rules (which contains nested rules)
|
|
228
|
+
node.walkRules((rule)=>selectors.push(...rule.selectors));
|
|
229
|
+
}
|
|
230
|
+
for (let selector of selectors){
|
|
231
|
+
let classCandidates = getClasses(selector, ignoreNot);
|
|
232
|
+
// At least one of the selectors contains non-"on-demandable" candidates.
|
|
233
|
+
if (classCandidates.length === 0) {
|
|
234
|
+
state.containsNonOnDemandable = true;
|
|
206
235
|
}
|
|
207
|
-
for (let
|
|
208
|
-
|
|
209
|
-
// At least one of the selectors contains non-"on-demandable" candidates.
|
|
210
|
-
if (classCandidates.length === 0) {
|
|
211
|
-
state.containsNonOnDemandable = true;
|
|
212
|
-
}
|
|
213
|
-
for (let classCandidate of classCandidates){
|
|
214
|
-
classes.push(classCandidate);
|
|
215
|
-
}
|
|
236
|
+
for (let classCandidate of classCandidates){
|
|
237
|
+
classes.push(classCandidate);
|
|
216
238
|
}
|
|
217
|
-
} else if (node.type === "atrule") {
|
|
218
|
-
node.walkRules((rule)=>{
|
|
219
|
-
for (let classCandidate of rule.selectors.flatMap((selector)=>getClasses(selector))){
|
|
220
|
-
classes.push(classCandidate);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
239
|
}
|
|
224
240
|
if (depth === 0) {
|
|
225
241
|
return [
|
|
@@ -260,11 +276,14 @@ function parseVariant(variant) {
|
|
|
260
276
|
if (!str.startsWith("@")) {
|
|
261
277
|
return ({ format })=>format(str);
|
|
262
278
|
}
|
|
263
|
-
let [, name, params] = /@(
|
|
264
|
-
|
|
279
|
+
let [, name, params] = /@(\S*)( .+|[({].*)?/g.exec(str);
|
|
280
|
+
var _params_trim;
|
|
281
|
+
return ({ wrap })=>{
|
|
282
|
+
return wrap(_postcss.default.atRule({
|
|
265
283
|
name,
|
|
266
|
-
params: params.trim()
|
|
284
|
+
params: (_params_trim = params === null || params === void 0 ? void 0 : params.trim()) !== null && _params_trim !== void 0 ? _params_trim : ""
|
|
267
285
|
}));
|
|
286
|
+
};
|
|
268
287
|
}).reverse();
|
|
269
288
|
return (api)=>{
|
|
270
289
|
for (let fn of fns){
|
|
@@ -451,7 +470,7 @@ function parseVariant(variant) {
|
|
|
451
470
|
return utilityModifier;
|
|
452
471
|
}
|
|
453
472
|
};
|
|
454
|
-
let modifiersEnabled = (0,
|
|
473
|
+
let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
455
474
|
let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
|
|
456
475
|
[(0, _nameClass.default)(identifier, modifier)]: declaration
|
|
457
476
|
}));
|
|
@@ -517,7 +536,7 @@ function parseVariant(variant) {
|
|
|
517
536
|
return utilityModifier;
|
|
518
537
|
}
|
|
519
538
|
};
|
|
520
|
-
let modifiersEnabled = (0,
|
|
539
|
+
let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
521
540
|
let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
|
|
522
541
|
[(0, _nameClass.default)(identifier, modifier)]: declaration
|
|
523
542
|
}));
|
|
@@ -578,7 +597,7 @@ function parseVariant(variant) {
|
|
|
578
597
|
// This is for internal use only which is why it is not present in the types
|
|
579
598
|
let id = (_options_id = options === null || options === void 0 ? void 0 : options.id) !== null && _options_id !== void 0 ? _options_id : ++variantIdentifier;
|
|
580
599
|
let isSpecial = variant === "@";
|
|
581
|
-
let modifiersEnabled = (0,
|
|
600
|
+
let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
582
601
|
var _options_values;
|
|
583
602
|
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 : {})){
|
|
584
603
|
if (key === "DEFAULT") continue;
|
|
@@ -689,9 +708,9 @@ function collectLayerPlugins(root) {
|
|
|
689
708
|
}
|
|
690
709
|
layerRule.remove();
|
|
691
710
|
} else if (layerRule.params === "components") {
|
|
692
|
-
for (let
|
|
711
|
+
for (let node of layerRule.nodes){
|
|
693
712
|
layerPlugins.push(function({ addComponents }) {
|
|
694
|
-
addComponents(
|
|
713
|
+
addComponents(node, {
|
|
695
714
|
respectPrefix: false,
|
|
696
715
|
preserveSource: true
|
|
697
716
|
});
|
|
@@ -699,9 +718,9 @@ function collectLayerPlugins(root) {
|
|
|
699
718
|
}
|
|
700
719
|
layerRule.remove();
|
|
701
720
|
} else if (layerRule.params === "utilities") {
|
|
702
|
-
for (let
|
|
721
|
+
for (let node of layerRule.nodes){
|
|
703
722
|
layerPlugins.push(function({ addUtilities }) {
|
|
704
|
-
addUtilities(
|
|
723
|
+
addUtilities(node, {
|
|
705
724
|
respectPrefix: false,
|
|
706
725
|
preserveSource: true
|
|
707
726
|
});
|
|
@@ -732,21 +751,40 @@ function resolvePlugins(context, root) {
|
|
|
732
751
|
// TODO: This is a workaround for backwards compatibility, since custom variants
|
|
733
752
|
// were historically sorted before screen/stackable variants.
|
|
734
753
|
let beforeVariants = [
|
|
754
|
+
_corePlugins.variantPlugins["childVariant"],
|
|
735
755
|
_corePlugins.variantPlugins["pseudoElementVariants"],
|
|
736
756
|
_corePlugins.variantPlugins["pseudoClassVariants"],
|
|
757
|
+
_corePlugins.variantPlugins["hasVariants"],
|
|
737
758
|
_corePlugins.variantPlugins["ariaVariants"],
|
|
738
759
|
_corePlugins.variantPlugins["dataVariants"]
|
|
739
760
|
];
|
|
740
761
|
let afterVariants = [
|
|
741
762
|
_corePlugins.variantPlugins["supportsVariants"],
|
|
742
|
-
_corePlugins.variantPlugins["directionVariants"],
|
|
743
763
|
_corePlugins.variantPlugins["reducedMotionVariants"],
|
|
744
764
|
_corePlugins.variantPlugins["prefersContrastVariants"],
|
|
745
|
-
_corePlugins.variantPlugins["darkVariants"],
|
|
746
|
-
_corePlugins.variantPlugins["printVariant"],
|
|
747
765
|
_corePlugins.variantPlugins["screenVariants"],
|
|
748
|
-
_corePlugins.variantPlugins["orientationVariants"]
|
|
766
|
+
_corePlugins.variantPlugins["orientationVariants"],
|
|
767
|
+
_corePlugins.variantPlugins["directionVariants"],
|
|
768
|
+
_corePlugins.variantPlugins["darkVariants"],
|
|
769
|
+
_corePlugins.variantPlugins["forcedColorsVariants"],
|
|
770
|
+
_corePlugins.variantPlugins["printVariant"]
|
|
749
771
|
];
|
|
772
|
+
// This is a compatibility fix for the pre 3.4 dark mode behavior
|
|
773
|
+
// `class` retains the old behavior, but `selector` keeps the new behavior
|
|
774
|
+
let isLegacyDarkMode = context.tailwindConfig.darkMode === "class" || Array.isArray(context.tailwindConfig.darkMode) && context.tailwindConfig.darkMode[0] === "class";
|
|
775
|
+
if (isLegacyDarkMode) {
|
|
776
|
+
afterVariants = [
|
|
777
|
+
_corePlugins.variantPlugins["supportsVariants"],
|
|
778
|
+
_corePlugins.variantPlugins["reducedMotionVariants"],
|
|
779
|
+
_corePlugins.variantPlugins["prefersContrastVariants"],
|
|
780
|
+
_corePlugins.variantPlugins["darkVariants"],
|
|
781
|
+
_corePlugins.variantPlugins["screenVariants"],
|
|
782
|
+
_corePlugins.variantPlugins["orientationVariants"],
|
|
783
|
+
_corePlugins.variantPlugins["directionVariants"],
|
|
784
|
+
_corePlugins.variantPlugins["forcedColorsVariants"],
|
|
785
|
+
_corePlugins.variantPlugins["printVariant"]
|
|
786
|
+
];
|
|
787
|
+
}
|
|
750
788
|
return [
|
|
751
789
|
...corePluginList,
|
|
752
790
|
...beforeVariants,
|
|
@@ -759,7 +797,7 @@ function registerPlugins(plugins, context) {
|
|
|
759
797
|
let variantList = [];
|
|
760
798
|
let variantMap = new Map();
|
|
761
799
|
context.variantMap = variantMap;
|
|
762
|
-
let offsets = new
|
|
800
|
+
let offsets = new _offsets.Offsets();
|
|
763
801
|
context.offsets = offsets;
|
|
764
802
|
let classList = new Set();
|
|
765
803
|
let pluginApi = buildPluginApi(context.tailwindConfig, context, {
|
|
@@ -850,7 +888,7 @@ function registerPlugins(plugins, context) {
|
|
|
850
888
|
})() : [
|
|
851
889
|
util
|
|
852
890
|
];
|
|
853
|
-
for (let
|
|
891
|
+
for (let util of utils){
|
|
854
892
|
for (let { pattern , variants =[] } of checks){
|
|
855
893
|
// RegExp with the /g flag are stateful, so let's reset the last
|
|
856
894
|
// index pointer to reset the state.
|
|
@@ -858,15 +896,15 @@ function registerPlugins(plugins, context) {
|
|
|
858
896
|
if (!patternMatchingCount.has(pattern)) {
|
|
859
897
|
patternMatchingCount.set(pattern, 0);
|
|
860
898
|
}
|
|
861
|
-
if (!pattern.test(
|
|
899
|
+
if (!pattern.test(util)) continue;
|
|
862
900
|
patternMatchingCount.set(pattern, patternMatchingCount.get(pattern) + 1);
|
|
863
901
|
context.changedContent.push({
|
|
864
|
-
content:
|
|
902
|
+
content: util,
|
|
865
903
|
extension: "html"
|
|
866
904
|
});
|
|
867
905
|
for (let variant of variants){
|
|
868
906
|
context.changedContent.push({
|
|
869
|
-
content: variant + context.tailwindConfig.separator +
|
|
907
|
+
content: variant + context.tailwindConfig.separator + util,
|
|
870
908
|
extension: "html"
|
|
871
909
|
});
|
|
872
910
|
}
|
|
@@ -910,11 +948,15 @@ function registerPlugins(plugins, context) {
|
|
|
910
948
|
]));
|
|
911
949
|
// Sort all classes in order
|
|
912
950
|
// Non-tailwind classes won't be generated and will be left as `null`
|
|
913
|
-
let rules = (0, _generateRules.generateRules)(new Set(sorted), context);
|
|
951
|
+
let rules = (0, _generateRules.generateRules)(new Set(sorted), context, true);
|
|
914
952
|
rules = context.offsets.sort(rules);
|
|
915
953
|
let idx = BigInt(parasiteUtilities.length);
|
|
916
954
|
for (const [, rule] of rules){
|
|
917
|
-
|
|
955
|
+
let candidate = rule.raws.tailwind.candidate;
|
|
956
|
+
var _sortedClassNames_get;
|
|
957
|
+
// When multiple rules match a candidate
|
|
958
|
+
// always take the position of the first one
|
|
959
|
+
sortedClassNames.set(candidate, (_sortedClassNames_get = sortedClassNames.get(candidate)) !== null && _sortedClassNames_get !== void 0 ? _sortedClassNames_get : idx++);
|
|
918
960
|
}
|
|
919
961
|
return classes.map((className)=>{
|
|
920
962
|
var _sortedClassNames_get;
|
|
@@ -963,11 +1005,11 @@ function registerPlugins(plugins, context) {
|
|
|
963
1005
|
metadata
|
|
964
1006
|
] : cls);
|
|
965
1007
|
if ((utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.supportsNegativeValues) && (0, _negateValue.default)(value)) {
|
|
966
|
-
let
|
|
1008
|
+
let cls = (0, _nameClass.formatClass)(utilName, `-${key}`);
|
|
967
1009
|
negativeClasses.push(includeMetadata ? [
|
|
968
|
-
|
|
1010
|
+
cls,
|
|
969
1011
|
metadata
|
|
970
|
-
] :
|
|
1012
|
+
] : cls);
|
|
971
1013
|
}
|
|
972
1014
|
}
|
|
973
1015
|
output.push(...negativeClasses);
|
|
@@ -1060,7 +1102,7 @@ function registerPlugins(plugins, context) {
|
|
|
1060
1102
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
1061
1103
|
// However, plugin authors probably also prepend or append certain
|
|
1062
1104
|
// classes, pseudos, ids, ...
|
|
1063
|
-
let rebuiltBase = (0,
|
|
1105
|
+
let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
|
|
1064
1106
|
selectors.walkClasses((classNode)=>{
|
|
1065
1107
|
classNode.value = `${name}${context.tailwindConfig.separator}${classNode.value}`;
|
|
1066
1108
|
});
|
|
@@ -1085,13 +1127,20 @@ function registerPlugins(plugins, context) {
|
|
|
1085
1127
|
}
|
|
1086
1128
|
var _options_values1;
|
|
1087
1129
|
let isArbitraryVariant = !(value in ((_options_values1 = options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {}));
|
|
1130
|
+
var _options_INTERNAL_FEATURES;
|
|
1131
|
+
let internalFeatures = (_options_INTERNAL_FEATURES = options[INTERNAL_FEATURES]) !== null && _options_INTERNAL_FEATURES !== void 0 ? _options_INTERNAL_FEATURES : {};
|
|
1132
|
+
let respectPrefix = (()=>{
|
|
1133
|
+
if (isArbitraryVariant) return false;
|
|
1134
|
+
if (internalFeatures.respectPrefix === false) return false;
|
|
1135
|
+
return true;
|
|
1136
|
+
})();
|
|
1088
1137
|
formatStrings = formatStrings.map((format)=>format.map((str)=>({
|
|
1089
1138
|
format: str,
|
|
1090
|
-
|
|
1139
|
+
respectPrefix
|
|
1091
1140
|
})));
|
|
1092
1141
|
manualFormatStrings = manualFormatStrings.map((format)=>({
|
|
1093
1142
|
format,
|
|
1094
|
-
|
|
1143
|
+
respectPrefix
|
|
1095
1144
|
}));
|
|
1096
1145
|
let opts = {
|
|
1097
1146
|
candidate,
|
|
@@ -1184,7 +1233,7 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1184
1233
|
contextMap.set(sourcePath, context);
|
|
1185
1234
|
existingContext = context;
|
|
1186
1235
|
}
|
|
1187
|
-
let cssDidChange = (0,
|
|
1236
|
+
let cssDidChange = (0, _cacheInvalidation.hasContentChanged)(sourcePath, root);
|
|
1188
1237
|
// If there's already a context in the cache and we don't need to
|
|
1189
1238
|
// reset the context, return the cached context.
|
|
1190
1239
|
if (existingContext) {
|
|
@@ -1210,9 +1259,9 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1210
1259
|
contextSourcesMap.get(oldContext).delete(sourcePath);
|
|
1211
1260
|
if (contextSourcesMap.get(oldContext).size === 0) {
|
|
1212
1261
|
contextSourcesMap.delete(oldContext);
|
|
1213
|
-
for (let [
|
|
1214
|
-
if (
|
|
1215
|
-
configContextMap.delete(
|
|
1262
|
+
for (let [tailwindConfigHash, context] of configContextMap){
|
|
1263
|
+
if (context === oldContext) {
|
|
1264
|
+
configContextMap.delete(tailwindConfigHash);
|
|
1216
1265
|
}
|
|
1217
1266
|
}
|
|
1218
1267
|
for (let disposable of oldContext.disposables.splice(0)){
|
|
@@ -1222,24 +1271,24 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1222
1271
|
}
|
|
1223
1272
|
}
|
|
1224
1273
|
_sharedState.env.DEBUG && console.log("Setting up new context...");
|
|
1225
|
-
let
|
|
1226
|
-
Object.assign(
|
|
1274
|
+
let context = createContext(tailwindConfig, [], root);
|
|
1275
|
+
Object.assign(context, {
|
|
1227
1276
|
userConfigPath
|
|
1228
1277
|
});
|
|
1229
|
-
let [,
|
|
1278
|
+
let [, mtimesToCommit] = trackModified([
|
|
1230
1279
|
...contextDependencies
|
|
1231
|
-
], getFileModifiedMap(
|
|
1280
|
+
], getFileModifiedMap(context));
|
|
1232
1281
|
// ---
|
|
1233
1282
|
// Update all context tracking state
|
|
1234
|
-
configContextMap.set(tailwindConfigHash,
|
|
1235
|
-
contextMap.set(sourcePath,
|
|
1236
|
-
if (!contextSourcesMap.has(
|
|
1237
|
-
contextSourcesMap.set(
|
|
1283
|
+
configContextMap.set(tailwindConfigHash, context);
|
|
1284
|
+
contextMap.set(sourcePath, context);
|
|
1285
|
+
if (!contextSourcesMap.has(context)) {
|
|
1286
|
+
contextSourcesMap.set(context, new Set());
|
|
1238
1287
|
}
|
|
1239
|
-
contextSourcesMap.get(
|
|
1288
|
+
contextSourcesMap.get(context).add(sourcePath);
|
|
1240
1289
|
return [
|
|
1241
|
-
|
|
1290
|
+
context,
|
|
1242
1291
|
true,
|
|
1243
|
-
|
|
1292
|
+
mtimesToCommit
|
|
1244
1293
|
];
|
|
1245
1294
|
}
|
|
@@ -9,25 +9,27 @@ Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
|
|
|
9
9
|
// plugins) then return it
|
|
10
10
|
"default", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: ()
|
|
12
|
+
get: function() {
|
|
13
|
+
return setupTrackingContext;
|
|
14
|
+
}
|
|
13
15
|
});
|
|
14
|
-
const _fs = /*#__PURE__*/
|
|
15
|
-
const
|
|
16
|
-
const _hashConfig = /*#__PURE__*/
|
|
17
|
-
const
|
|
18
|
-
const _resolveConfigPath = /*#__PURE__*/
|
|
16
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
17
|
+
const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
|
|
18
|
+
const _hashConfig = /*#__PURE__*/ _interop_require_default(require("../util/hashConfig"));
|
|
19
|
+
const _resolveconfig = /*#__PURE__*/ _interop_require_default(require("../public/resolve-config"));
|
|
20
|
+
const _resolveConfigPath = /*#__PURE__*/ _interop_require_default(require("../util/resolveConfigPath"));
|
|
19
21
|
const _setupContextUtils = require("./setupContextUtils");
|
|
20
|
-
const _parseDependency = /*#__PURE__*/
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const _getModuleDependencies = /*#__PURE__*/
|
|
25
|
-
function
|
|
22
|
+
const _parseDependency = /*#__PURE__*/ _interop_require_default(require("../util/parseDependency"));
|
|
23
|
+
const _validateConfig = require("../util/validateConfig.js");
|
|
24
|
+
const _content = require("./content.js");
|
|
25
|
+
const _loadconfig = require("../lib/load-config");
|
|
26
|
+
const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("./getModuleDependencies"));
|
|
27
|
+
function _interop_require_default(obj) {
|
|
26
28
|
return obj && obj.__esModule ? obj : {
|
|
27
29
|
default: obj
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
|
-
let configPathCache = new
|
|
32
|
+
let configPathCache = new _quicklru.default({
|
|
31
33
|
maxSize: 100
|
|
32
34
|
});
|
|
33
35
|
let candidateFilesCache = new WeakMap();
|
|
@@ -35,7 +37,7 @@ function getCandidateFiles(context, tailwindConfig) {
|
|
|
35
37
|
if (candidateFilesCache.has(context)) {
|
|
36
38
|
return candidateFilesCache.get(context);
|
|
37
39
|
}
|
|
38
|
-
let candidateFiles = (0,
|
|
40
|
+
let candidateFiles = (0, _content.parseCandidateFiles)(context, tailwindConfig);
|
|
39
41
|
return candidateFilesCache.set(context, candidateFiles).get(context);
|
|
40
42
|
}
|
|
41
43
|
// Get the config object based on a path
|
|
@@ -63,10 +65,10 @@ function getTailwindConfig(configOrPath) {
|
|
|
63
65
|
];
|
|
64
66
|
}
|
|
65
67
|
// It has changed (based on timestamps), or first run
|
|
66
|
-
for (let
|
|
67
|
-
delete require.cache[
|
|
68
|
+
for (let file of newDeps){
|
|
69
|
+
delete require.cache[file];
|
|
68
70
|
}
|
|
69
|
-
let newConfig = (0,
|
|
71
|
+
let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
|
|
70
72
|
let newHash = (0, _hashConfig.default)(newConfig);
|
|
71
73
|
configPathCache.set(userConfigPath, [
|
|
72
74
|
newConfig,
|
|
@@ -81,13 +83,14 @@ function getTailwindConfig(configOrPath) {
|
|
|
81
83
|
newDeps
|
|
82
84
|
];
|
|
83
85
|
}
|
|
86
|
+
var _configOrPath_config, _ref;
|
|
84
87
|
// It's a plain object, not a path
|
|
85
|
-
let
|
|
86
|
-
|
|
88
|
+
let newConfig = (0, _resolveconfig.default)((_ref = (_configOrPath_config = configOrPath === null || configOrPath === void 0 ? void 0 : configOrPath.config) !== null && _configOrPath_config !== void 0 ? _configOrPath_config : configOrPath) !== null && _ref !== void 0 ? _ref : {});
|
|
89
|
+
newConfig = (0, _validateConfig.validateConfig)(newConfig);
|
|
87
90
|
return [
|
|
88
|
-
|
|
91
|
+
newConfig,
|
|
89
92
|
null,
|
|
90
|
-
(0, _hashConfig.default)(
|
|
93
|
+
(0, _hashConfig.default)(newConfig),
|
|
91
94
|
[]
|
|
92
95
|
];
|
|
93
96
|
}
|
|
@@ -127,7 +130,7 @@ function setupTrackingContext(configOrPath) {
|
|
|
127
130
|
registerDependency(dependency);
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
let [changedContent, contentMTimesToCommit] = (0,
|
|
133
|
+
let [changedContent, contentMTimesToCommit] = (0, _content.resolvedChangedContent)(context, candidateFiles, fileModifiedMap);
|
|
131
134
|
for (let content of changedContent){
|
|
132
135
|
context.changedContent.push(content);
|
|
133
136
|
}
|
|
@@ -154,8 +157,8 @@ function setupTrackingContext(configOrPath) {
|
|
|
154
157
|
// "commit" the new modified time for all context deps
|
|
155
158
|
// We do this here because we want content tracking to
|
|
156
159
|
// read the "old" mtime even when it's a context dependency.
|
|
157
|
-
for (let [
|
|
158
|
-
fileModifiedMap.set(
|
|
160
|
+
for (let [path, mtime] of mTimesToCommit.entries()){
|
|
161
|
+
fileModifiedMap.set(path, mtime);
|
|
159
162
|
}
|
|
160
163
|
return context;
|
|
161
164
|
};
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -9,32 +9,45 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
env: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
env: function() {
|
|
13
|
+
return env;
|
|
14
|
+
},
|
|
15
|
+
contextMap: function() {
|
|
16
|
+
return contextMap;
|
|
17
|
+
},
|
|
18
|
+
configContextMap: function() {
|
|
19
|
+
return configContextMap;
|
|
20
|
+
},
|
|
21
|
+
contextSourcesMap: function() {
|
|
22
|
+
return contextSourcesMap;
|
|
23
|
+
},
|
|
24
|
+
sourceHashMap: function() {
|
|
25
|
+
return sourceHashMap;
|
|
26
|
+
},
|
|
27
|
+
NOT_ON_DEMAND: function() {
|
|
28
|
+
return NOT_ON_DEMAND;
|
|
29
|
+
},
|
|
30
|
+
NONE: function() {
|
|
31
|
+
return NONE;
|
|
32
|
+
},
|
|
33
|
+
resolveDebug: function() {
|
|
34
|
+
return resolveDebug;
|
|
35
|
+
}
|
|
20
36
|
});
|
|
21
|
-
const
|
|
22
|
-
function
|
|
37
|
+
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
|
|
38
|
+
function _interop_require_default(obj) {
|
|
23
39
|
return obj && obj.__esModule ? obj : {
|
|
24
40
|
default: obj
|
|
25
41
|
};
|
|
26
42
|
}
|
|
27
|
-
let OXIDE_DEFAULT_ENABLED = _packageJson.default.tailwindcss.engine === "oxide";
|
|
28
43
|
const env = typeof process !== "undefined" ? {
|
|
29
44
|
NODE_ENV: process.env.NODE_ENV,
|
|
30
45
|
DEBUG: resolveDebug(process.env.DEBUG),
|
|
31
|
-
ENGINE:
|
|
32
|
-
OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED)
|
|
46
|
+
ENGINE: _packagejson.default.tailwindcss.engine
|
|
33
47
|
} : {
|
|
34
48
|
NODE_ENV: "production",
|
|
35
49
|
DEBUG: false,
|
|
36
|
-
ENGINE:
|
|
37
|
-
OXIDE: OXIDE_DEFAULT_ENABLED
|
|
50
|
+
ENGINE: _packagejson.default.tailwindcss.engine
|
|
38
51
|
};
|
|
39
52
|
const contextMap = new Map();
|
|
40
53
|
const configContextMap = new Map();
|
|
@@ -42,15 +55,6 @@ const contextSourcesMap = new Map();
|
|
|
42
55
|
const sourceHashMap = new Map();
|
|
43
56
|
const NOT_ON_DEMAND = new String("*");
|
|
44
57
|
const NONE = Symbol("__NONE__");
|
|
45
|
-
function resolveBoolean(value, defaultValue) {
|
|
46
|
-
if (value === undefined) {
|
|
47
|
-
return defaultValue;
|
|
48
|
-
}
|
|
49
|
-
if (value === "0" || value === "false") {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
58
|
function resolveDebug(debug) {
|
|
55
59
|
if (debug === undefined) {
|
|
56
60
|
return false;
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
10
|
-
const _buildMediaQuery = /*#__PURE__*/
|
|
11
|
-
function
|
|
12
|
+
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|