tailwindcss 0.0.0-insiders.df011dc → 0.0.0-insiders.e2d5f21

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +1 -1
  3. package/colors.js +1 -304
  4. package/defaultConfig.js +1 -4
  5. package/defaultTheme.js +1 -4
  6. package/lib/cli-peer-dependencies.js +4 -9
  7. package/lib/cli.js +646 -705
  8. package/lib/constants.js +15 -15
  9. package/lib/corePluginList.js +174 -4
  10. package/lib/corePlugins.js +3637 -2934
  11. package/lib/css/preflight.css +14 -1
  12. package/lib/featureFlags.js +44 -44
  13. package/lib/index.js +25 -24
  14. package/lib/lib/collapseAdjacentRules.js +33 -35
  15. package/lib/lib/collapseDuplicateDeclarations.js +29 -0
  16. package/lib/lib/detectNesting.js +34 -0
  17. package/lib/lib/evaluateTailwindFunctions.js +134 -155
  18. package/lib/lib/expandApplyAtRules.js +183 -200
  19. package/lib/lib/expandTailwindAtRules.js +219 -232
  20. package/lib/lib/generateRules.js +478 -311
  21. package/lib/lib/getModuleDependencies.js +36 -41
  22. package/lib/lib/normalizeTailwindDirectives.js +66 -58
  23. package/lib/lib/resolveDefaultsAtRules.js +110 -90
  24. package/lib/lib/setupContextUtils.js +740 -580
  25. package/lib/lib/setupTrackingContext.js +142 -162
  26. package/lib/lib/setupWatchingContext.js +235 -278
  27. package/lib/lib/sharedState.js +7 -17
  28. package/lib/lib/substituteScreenAtRules.js +22 -26
  29. package/lib/processTailwindFeatures.js +38 -44
  30. package/lib/public/colors.js +329 -0
  31. package/lib/public/create-plugin.js +13 -0
  32. package/lib/public/default-config.js +14 -0
  33. package/lib/public/default-theme.js +14 -0
  34. package/lib/public/resolve-config.js +19 -0
  35. package/lib/util/bigSign.js +3 -5
  36. package/lib/util/buildMediaQuery.js +15 -31
  37. package/lib/util/cloneDeep.js +14 -13
  38. package/lib/util/cloneNodes.js +9 -13
  39. package/lib/util/color.js +69 -59
  40. package/lib/util/configurePlugins.js +13 -14
  41. package/lib/util/createPlugin.js +21 -24
  42. package/lib/util/createUtilityPlugin.js +47 -45
  43. package/lib/util/dataTypes.js +231 -0
  44. package/lib/util/defaults.js +10 -14
  45. package/lib/util/escapeClassName.js +12 -14
  46. package/lib/util/escapeCommas.js +3 -5
  47. package/lib/util/flattenColorPalette.js +14 -10
  48. package/lib/util/formatVariantSelector.js +186 -0
  49. package/lib/util/getAllConfigs.js +23 -16
  50. package/lib/util/hashConfig.js +10 -10
  51. package/lib/util/isKeyframeRule.js +3 -5
  52. package/lib/util/isPlainObject.js +7 -10
  53. package/lib/util/isValidArbitraryValue.js +64 -0
  54. package/lib/util/log.js +39 -30
  55. package/lib/util/nameClass.js +23 -23
  56. package/lib/util/negateValue.js +14 -15
  57. package/lib/util/normalizeConfig.js +208 -0
  58. package/lib/util/normalizeScreens.js +58 -0
  59. package/lib/util/parseAnimationValue.js +82 -53
  60. package/lib/util/parseBoxShadowValue.js +77 -0
  61. package/lib/util/parseDependency.js +49 -60
  62. package/lib/util/parseObjectStyles.js +23 -20
  63. package/lib/util/pluginUtils.js +153 -285
  64. package/lib/util/prefixSelector.js +14 -16
  65. package/lib/util/resolveConfig.js +194 -249
  66. package/lib/util/resolveConfigPath.js +38 -45
  67. package/lib/util/responsive.js +12 -11
  68. package/lib/util/tap.js +4 -6
  69. package/lib/util/toColorValue.js +4 -5
  70. package/lib/util/toPath.js +4 -6
  71. package/lib/util/transformThemeValue.js +57 -26
  72. package/lib/util/withAlphaVariable.js +56 -54
  73. package/package.json +27 -37
  74. package/peers/index.js +73099 -84294
  75. package/plugin.js +1 -3
  76. package/resolveConfig.js +1 -7
  77. package/scripts/create-plugin-list.js +2 -2
  78. package/src/cli.js +27 -18
  79. package/src/corePluginList.js +1 -1
  80. package/src/corePlugins.js +2124 -1968
  81. package/src/css/preflight.css +14 -1
  82. package/src/featureFlags.js +12 -6
  83. package/src/lib/collapseDuplicateDeclarations.js +28 -0
  84. package/src/lib/detectNesting.js +39 -0
  85. package/src/lib/evaluateTailwindFunctions.js +5 -2
  86. package/src/lib/expandTailwindAtRules.js +24 -32
  87. package/src/lib/generateRules.js +230 -20
  88. package/src/lib/normalizeTailwindDirectives.js +3 -2
  89. package/src/lib/resolveDefaultsAtRules.js +46 -30
  90. package/src/lib/setupContextUtils.js +275 -113
  91. package/src/lib/setupTrackingContext.js +9 -8
  92. package/src/lib/setupWatchingContext.js +12 -7
  93. package/src/lib/sharedState.js +1 -4
  94. package/src/lib/substituteScreenAtRules.js +6 -3
  95. package/src/processTailwindFeatures.js +8 -1
  96. package/src/public/colors.js +300 -0
  97. package/src/public/create-plugin.js +2 -0
  98. package/src/public/default-config.js +4 -0
  99. package/src/public/default-theme.js +4 -0
  100. package/src/public/resolve-config.js +7 -0
  101. package/src/util/buildMediaQuery.js +14 -18
  102. package/src/util/createUtilityPlugin.js +2 -11
  103. package/src/util/dataTypes.js +246 -0
  104. package/src/util/formatVariantSelector.js +196 -0
  105. package/src/util/isValidArbitraryValue.js +61 -0
  106. package/src/util/log.js +18 -21
  107. package/src/util/nameClass.js +10 -6
  108. package/src/util/negateValue.js +4 -2
  109. package/src/util/normalizeConfig.js +249 -0
  110. package/src/util/normalizeScreens.js +42 -0
  111. package/src/util/parseAnimationValue.js +7 -1
  112. package/src/util/parseBoxShadowValue.js +71 -0
  113. package/src/util/parseDependency.js +4 -0
  114. package/src/util/pluginUtils.js +101 -204
  115. package/src/util/prefixSelector.js +1 -4
  116. package/src/util/resolveConfig.js +12 -65
  117. package/src/util/transformThemeValue.js +22 -7
  118. package/src/util/withAlphaVariable.js +13 -8
  119. package/stubs/defaultConfig.stub.js +163 -97
  120. package/stubs/simpleConfig.stub.js +0 -1
@@ -12,6 +12,11 @@
12
12
  border-color: currentColor; /* 2 */
13
13
  }
14
14
 
15
+ ::before,
16
+ ::after {
17
+ --tw-content: '';
18
+ }
19
+
15
20
  /*
16
21
  1. Use a consistent sensible line-height in all browsers.
17
22
  2. Prevent adjustments of font size after orientation changes in iOS.
@@ -283,7 +288,8 @@ legend {
283
288
  }
284
289
 
285
290
  ol,
286
- ul {
291
+ ul,
292
+ menu {
287
293
  list-style: none;
288
294
  margin: 0;
289
295
  padding: 0;
@@ -317,6 +323,13 @@ button,
317
323
  cursor: pointer;
318
324
  }
319
325
 
326
+ /*
327
+ Make sure disabled buttons don't get the pointer cursor.
328
+ */
329
+ :disabled {
330
+ cursor: default;
331
+ }
332
+
320
333
  /*
321
334
  1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
322
335
  2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
@@ -1,60 +1,60 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.flagEnabled = flagEnabled;
7
6
  exports.issueFlagNotices = issueFlagNotices;
8
7
  exports.default = void 0;
9
-
10
8
  var _chalk = _interopRequireDefault(require("chalk"));
11
-
12
9
  var _log = _interopRequireDefault(require("./util/log"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- const featureFlags = {
17
- future: [],
18
- experimental: ['optimizeUniversalDefaults']
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : {
12
+ default: obj
13
+ };
14
+ }
15
+ let defaults = {
16
+ optimizeUniversalDefaults: true
17
+ };
18
+ let featureFlags = {
19
+ future: [],
20
+ experimental: [
21
+ 'optimizeUniversalDefaults'
22
+ ]
19
23
  };
20
-
21
24
  function flagEnabled(config, flag) {
22
- if (featureFlags.future.includes(flag)) {
23
- var _config$future$flag, _config$future;
24
-
25
- return config.future === 'all' || ((_config$future$flag = config === null || config === void 0 ? void 0 : (_config$future = config.future) === null || _config$future === void 0 ? void 0 : _config$future[flag]) !== null && _config$future$flag !== void 0 ? _config$future$flag : false);
26
- }
27
-
28
- if (featureFlags.experimental.includes(flag)) {
29
- var _config$experimental$, _config$experimental;
30
-
31
- return config.experimental === 'all' || ((_config$experimental$ = config === null || config === void 0 ? void 0 : (_config$experimental = config.experimental) === null || _config$experimental === void 0 ? void 0 : _config$experimental[flag]) !== null && _config$experimental$ !== void 0 ? _config$experimental$ : false);
32
- }
33
-
34
- return false;
25
+ if (featureFlags.future.includes(flag)) {
26
+ var ref;
27
+ var ref1, ref2;
28
+ return config.future === 'all' || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
29
+ }
30
+ if (featureFlags.experimental.includes(flag)) {
31
+ var ref3;
32
+ var ref4, ref5;
33
+ return config.experimental === 'all' || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : false);
34
+ }
35
+ return false;
35
36
  }
36
-
37
37
  function experimentalFlagsEnabled(config) {
38
- var _config$experimental2;
39
-
40
- if (config.experimental === 'all') {
41
- return featureFlags.experimental;
42
- }
43
-
44
- return Object.keys((_config$experimental2 = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config$experimental2 !== void 0 ? _config$experimental2 : {}).filter(flag => featureFlags.experimental.includes(flag) && config.experimental[flag]);
38
+ if (config.experimental === 'all') {
39
+ return featureFlags.experimental;
40
+ }
41
+ var ref;
42
+ return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {
43
+ }).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]
44
+ );
45
45
  }
46
-
47
46
  function issueFlagNotices(config) {
48
- if (process.env.JEST_WORKER_ID !== undefined) {
49
- return;
50
- }
51
-
52
- if (experimentalFlagsEnabled(config).length > 0) {
53
- const changes = experimentalFlagsEnabled(config).map(s => _chalk.default.yellow(s)).join(', ');
54
-
55
- _log.default.warn([`You have enabled experimental features: ${changes}`, 'Experimental features are not covered by semver, may introduce breaking changes, and can change at any time.']);
56
- }
47
+ if (process.env.JEST_WORKER_ID !== undefined) {
48
+ return;
49
+ }
50
+ if (experimentalFlagsEnabled(config).length > 0) {
51
+ let changes = experimentalFlagsEnabled(config).map((s)=>_chalk.default.yellow(s)
52
+ ).join(', ');
53
+ _log.default.warn('experimental-flags-enabled', [
54
+ `You have enabled experimental features: ${changes}`,
55
+ 'Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.',
56
+ ]);
57
+ }
57
58
  }
58
-
59
59
  var _default = featureFlags;
60
- exports.default = _default;
60
+ exports.default = _default;
package/lib/index.js CHANGED
@@ -1,31 +1,32 @@
1
1
  "use strict";
2
-
3
2
  var _setupTrackingContext = _interopRequireDefault(require("./lib/setupTrackingContext"));
4
-
5
3
  var _setupWatchingContext = _interopRequireDefault(require("./lib/setupWatchingContext"));
6
-
7
4
  var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
8
-
9
5
  var _sharedState = require("./lib/sharedState");
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ }
13
11
  module.exports = function tailwindcss(configOrPath) {
14
- return {
15
- postcssPlugin: 'tailwindcss',
16
- plugins: [_sharedState.env.DEBUG && function (root) {
17
- console.log('\n');
18
- console.time('JIT TOTAL');
19
- return root;
20
- }, function (root, result) {
21
- let setupContext = _sharedState.env.TAILWIND_MODE === 'watch' ? (0, _setupWatchingContext.default)(configOrPath) : (0, _setupTrackingContext.default)(configOrPath);
22
- (0, _processTailwindFeatures.default)(setupContext)(root, result);
23
- }, _sharedState.env.DEBUG && function (root) {
24
- console.timeEnd('JIT TOTAL');
25
- console.log('\n');
26
- return root;
27
- }].filter(Boolean)
28
- };
12
+ return {
13
+ postcssPlugin: 'tailwindcss',
14
+ plugins: [
15
+ _sharedState.env.DEBUG && function(root) {
16
+ console.log('\n');
17
+ console.time('JIT TOTAL');
18
+ return root;
19
+ },
20
+ function(root, result) {
21
+ let setupContext = _sharedState.env.TAILWIND_MODE === 'watch' ? (0, _setupWatchingContext).default(configOrPath) : (0, _setupTrackingContext).default(configOrPath);
22
+ (0, _processTailwindFeatures).default(setupContext)(root, result);
23
+ },
24
+ _sharedState.env.DEBUG && function(root) {
25
+ console.timeEnd('JIT TOTAL');
26
+ console.log('\n');
27
+ return root;
28
+ },
29
+ ].filter(Boolean)
30
+ };
29
31
  };
30
-
31
- module.exports.postcss = true;
32
+ module.exports.postcss = true;
@@ -1,43 +1,41 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = collapseAdjacentRules;
7
6
  let comparisonMap = {
8
- atrule: ['name', 'params'],
9
- rule: ['selector']
7
+ atrule: [
8
+ 'name',
9
+ 'params'
10
+ ],
11
+ rule: [
12
+ 'selector'
13
+ ]
10
14
  };
11
15
  let types = new Set(Object.keys(comparisonMap));
12
-
13
16
  function collapseAdjacentRules() {
14
- return root => {
15
- let currentRule = null;
16
- root.each(node => {
17
- if (!types.has(node.type)) {
18
- currentRule = null;
19
- return;
20
- }
21
-
22
- if (currentRule === null) {
23
- currentRule = node;
24
- return;
25
- }
26
-
27
- let properties = comparisonMap[node.type];
28
-
29
- if (node.type === 'atrule' && node.name === 'font-face') {
30
- currentRule = node;
31
- } else if (properties.every(property => {
32
- var _node$property, _currentRule$property;
33
-
34
- return ((_node$property = node[property]) !== null && _node$property !== void 0 ? _node$property : '').replace(/\s+/g, ' ') === ((_currentRule$property = currentRule[property]) !== null && _currentRule$property !== void 0 ? _currentRule$property : '').replace(/\s+/g, ' ');
35
- })) {
36
- currentRule.append(node.nodes);
37
- node.remove();
38
- } else {
39
- currentRule = node;
40
- }
41
- });
42
- };
43
- }
17
+ return (root)=>{
18
+ let currentRule = null;
19
+ root.each((node)=>{
20
+ if (!types.has(node.type)) {
21
+ currentRule = null;
22
+ return;
23
+ }
24
+ if (currentRule === null) {
25
+ currentRule = node;
26
+ return;
27
+ }
28
+ let properties = comparisonMap[node.type];
29
+ var _property, _property1;
30
+ if (node.type === 'atrule' && node.name === 'font-face') {
31
+ currentRule = node;
32
+ } else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : '').replace(/\s+/g, ' ') === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : '').replace(/\s+/g, ' ')
33
+ )) {
34
+ currentRule.append(node.nodes);
35
+ node.remove();
36
+ } else {
37
+ currentRule = node;
38
+ }
39
+ });
40
+ };
41
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = collapseDuplicateDeclarations;
6
+ function collapseDuplicateDeclarations() {
7
+ return (root)=>{
8
+ root.walkRules((node)=>{
9
+ let seen = new Map();
10
+ let droppable = new Set([]);
11
+ node.walkDecls((decl)=>{
12
+ // This could happen if we have nested selectors. In that case the
13
+ // parent will loop over all its declarations but also the declarations
14
+ // of nested rules. With this we ensure that we are shallowly checking
15
+ // declarations.
16
+ if (decl.parent !== node) {
17
+ return;
18
+ }
19
+ if (seen.has(decl.prop)) {
20
+ droppable.add(seen.get(decl.prop));
21
+ }
22
+ seen.set(decl.prop, decl);
23
+ });
24
+ for (let decl1 of droppable){
25
+ decl1.remove();
26
+ }
27
+ });
28
+ };
29
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = _default;
6
+ function _default(_context) {
7
+ return (root, result)=>{
8
+ let found = false;
9
+ root.walkAtRules('tailwind', (node)=>{
10
+ if (found) return false;
11
+ if (node.parent && node.parent.type !== 'root') {
12
+ found = true;
13
+ node.warn(result, [
14
+ 'Nested @tailwind rules were detected, but are not supported.',
15
+ "Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
16
+ 'Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy',
17
+ ].join('\n'));
18
+ return false;
19
+ }
20
+ });
21
+ root.walkRules((rule)=>{
22
+ if (found) return false;
23
+ rule.walkRules((nestedRule)=>{
24
+ found = true;
25
+ nestedRule.warn(result, [
26
+ 'Nested CSS was detected, but CSS nesting has not been configured correctly.',
27
+ 'Please enable a CSS nesting plugin *before* Tailwind in your configuration.',
28
+ 'See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting',
29
+ ].join('\n'));
30
+ return false;
31
+ });
32
+ });
33
+ };
34
+ }