tailwindcss 0.0.0-insiders.eae2b7a → 0.0.0-insiders.eb2fe94

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 (114) hide show
  1. package/lib/cli/build/index.js +14 -14
  2. package/lib/cli/build/plugin.js +66 -64
  3. package/lib/cli/build/utils.js +20 -20
  4. package/lib/cli/build/watching.js +10 -10
  5. package/lib/cli/help/index.js +11 -11
  6. package/lib/cli/index.js +58 -58
  7. package/lib/cli/init/index.js +16 -16
  8. package/lib/cli.js +1 -1
  9. package/lib/corePluginList.js +3 -1
  10. package/lib/corePlugins.js +1934 -1906
  11. package/lib/css/preflight.css +17 -6
  12. package/lib/featureFlags.js +16 -16
  13. package/lib/index.js +1 -1
  14. package/lib/lib/cacheInvalidation.js +6 -4
  15. package/lib/lib/collapseAdjacentRules.js +9 -7
  16. package/lib/lib/collapseDuplicateDeclarations.js +1 -1
  17. package/lib/lib/content.js +10 -10
  18. package/lib/lib/defaultExtractor.js +29 -33
  19. package/lib/lib/detectNesting.js +10 -10
  20. package/lib/lib/evaluateTailwindFunctions.js +22 -22
  21. package/lib/lib/expandApplyAtRules.js +24 -18
  22. package/lib/lib/expandTailwindAtRules.js +61 -62
  23. package/lib/lib/findAtConfigPath.js +5 -5
  24. package/lib/lib/generateRules.js +87 -74
  25. package/lib/lib/getModuleDependencies.js +23 -23
  26. package/lib/lib/handleImportAtRules.js +3 -3
  27. package/lib/lib/load-config.js +3 -3
  28. package/lib/lib/normalizeTailwindDirectives.js +21 -21
  29. package/lib/lib/offsets.js +44 -44
  30. package/lib/lib/partitionApplyAtRules.js +2 -2
  31. package/lib/lib/regex.js +17 -17
  32. package/lib/lib/resolveDefaultsAtRules.js +28 -28
  33. package/lib/lib/setupContextUtils.js +177 -154
  34. package/lib/lib/setupTrackingContext.js +3 -3
  35. package/lib/lib/sharedState.js +22 -22
  36. package/lib/lib/substituteScreenAtRules.js +4 -4
  37. package/lib/plugin.js +32 -26
  38. package/lib/postcss-plugins/nesting/index.js +2 -2
  39. package/lib/postcss-plugins/nesting/plugin.js +10 -10
  40. package/lib/processTailwindFeatures.js +5 -5
  41. package/lib/public/colors.js +264 -264
  42. package/lib/util/applyImportantSelector.js +2 -2
  43. package/lib/util/buildMediaQuery.js +2 -2
  44. package/lib/util/cloneDeep.js +1 -1
  45. package/lib/util/cloneNodes.js +1 -1
  46. package/lib/util/color.js +23 -23
  47. package/lib/util/createUtilityPlugin.js +3 -3
  48. package/lib/util/dataTypes.js +233 -130
  49. package/lib/util/escapeCommas.js +1 -1
  50. package/lib/util/flattenColorPalette.js +2 -2
  51. package/lib/util/formatVariantSelector.js +29 -22
  52. package/lib/util/getAllConfigs.js +3 -3
  53. package/lib/util/isKeyframeRule.js +1 -1
  54. package/lib/util/isPlainObject.js +2 -2
  55. package/lib/util/isSyntacticallyValidPropertyValue.js +10 -10
  56. package/lib/util/log.js +14 -14
  57. package/lib/util/nameClass.js +4 -4
  58. package/lib/util/negateValue.js +8 -8
  59. package/lib/util/normalizeConfig.js +60 -58
  60. package/lib/util/normalizeScreens.js +22 -22
  61. package/lib/util/parseAnimationValue.js +38 -38
  62. package/lib/util/parseBoxShadowValue.js +21 -21
  63. package/lib/util/parseDependency.js +4 -4
  64. package/lib/util/parseGlob.js +4 -4
  65. package/lib/util/parseObjectStyles.js +1 -1
  66. package/lib/util/pluginUtils.js +32 -32
  67. package/lib/util/prefixSelector.js +4 -4
  68. package/lib/util/pseudoElements.js +69 -69
  69. package/lib/util/removeAlphaVariables.js +1 -1
  70. package/lib/util/resolveConfig.js +50 -43
  71. package/lib/util/resolveConfigPath.js +6 -6
  72. package/lib/util/responsive.js +1 -1
  73. package/lib/util/splitAtTopLevelOnly.js +3 -3
  74. package/lib/util/toColorValue.js +1 -1
  75. package/lib/util/toPath.js +2 -2
  76. package/lib/util/transformThemeValue.js +24 -24
  77. package/lib/util/validateConfig.js +13 -13
  78. package/lib/util/validateFormalSyntax.js +5 -5
  79. package/lib/util/withAlphaVariable.js +8 -8
  80. package/lib/value-parser/index.js +5 -5
  81. package/lib/value-parser/parse.js +43 -43
  82. package/lib/value-parser/stringify.js +11 -11
  83. package/lib/value-parser/unit.js +5 -5
  84. package/lib/value-parser/walk.js +1 -1
  85. package/nesting/index.d.ts +4 -0
  86. package/package.json +17 -16
  87. package/resolveConfig.d.ts +22 -3
  88. package/scripts/generate-types.js +1 -2
  89. package/scripts/release-notes.js +1 -1
  90. package/src/cli/build/plugin.js +13 -12
  91. package/src/cli/build/watching.js +1 -1
  92. package/src/corePluginList.js +1 -1
  93. package/src/corePlugins.js +29 -15
  94. package/src/css/preflight.css +17 -6
  95. package/src/featureFlags.js +1 -5
  96. package/src/lib/defaultExtractor.js +14 -16
  97. package/src/lib/expandApplyAtRules.js +7 -0
  98. package/src/lib/expandTailwindAtRules.js +39 -31
  99. package/src/lib/generateRules.js +30 -22
  100. package/src/lib/setupContextUtils.js +51 -35
  101. package/src/plugin.js +10 -5
  102. package/src/processTailwindFeatures.js +3 -2
  103. package/src/util/color.js +1 -1
  104. package/src/util/dataTypes.js +120 -20
  105. package/src/util/formatVariantSelector.js +11 -3
  106. package/src/util/isPlainObject.js +1 -1
  107. package/src/util/normalizeConfig.js +1 -1
  108. package/src/util/prefixSelector.js +1 -0
  109. package/src/util/resolveConfig.js +42 -24
  110. package/stubs/config.full.js +73 -14
  111. package/types/config.d.ts +12 -9
  112. package/types/generated/corePluginList.d.ts +1 -1
  113. package/types/generated/default-theme.d.ts +34 -9
  114. package/types/index.d.ts +7 -3
package/lib/cli/index.js CHANGED
@@ -22,7 +22,7 @@ function oneOf(...options) {
22
22
  return parsed;
23
23
  }
24
24
  }
25
- throw new Error("...");
25
+ throw new Error('...');
26
26
  }, {
27
27
  manualParsing: true
28
28
  });
@@ -31,93 +31,93 @@ let commands = {
31
31
  init: {
32
32
  run: _init.init,
33
33
  args: {
34
- "--esm": {
34
+ '--esm': {
35
35
  type: Boolean,
36
36
  description: `Initialize configuration file as ESM`
37
37
  },
38
- "--ts": {
38
+ '--ts': {
39
39
  type: Boolean,
40
40
  description: `Initialize configuration file as TypeScript`
41
41
  },
42
- "--postcss": {
42
+ '--postcss': {
43
43
  type: Boolean,
44
44
  description: `Initialize a \`postcss.config.js\` file`
45
45
  },
46
- "--full": {
46
+ '--full': {
47
47
  type: Boolean,
48
48
  description: `Include the default values for all options in the generated configuration file`
49
49
  },
50
- "-f": "--full",
51
- "-p": "--postcss"
50
+ '-f': '--full',
51
+ '-p': '--postcss'
52
52
  }
53
53
  },
54
54
  build: {
55
55
  run: _build.build,
56
56
  args: {
57
- "--input": {
57
+ '--input': {
58
58
  type: String,
59
- description: "Input file"
59
+ description: 'Input file'
60
60
  },
61
- "--output": {
61
+ '--output': {
62
62
  type: String,
63
- description: "Output file"
63
+ description: 'Output file'
64
64
  },
65
- "--watch": {
65
+ '--watch': {
66
66
  type: oneOf(String, Boolean),
67
- description: "Watch for changes and rebuild as needed"
67
+ description: 'Watch for changes and rebuild as needed'
68
68
  },
69
- "--poll": {
69
+ '--poll': {
70
70
  type: Boolean,
71
- description: "Use polling instead of filesystem events when watching"
71
+ description: 'Use polling instead of filesystem events when watching'
72
72
  },
73
- "--content": {
73
+ '--content': {
74
74
  type: String,
75
- description: "Content paths to use for removing unused classes"
75
+ description: 'Content paths to use for removing unused classes'
76
76
  },
77
- "--purge": {
77
+ '--purge': {
78
78
  type: String,
79
79
  deprecated: true
80
80
  },
81
- "--postcss": {
81
+ '--postcss': {
82
82
  type: oneOf(String, Boolean),
83
- description: "Load custom PostCSS configuration"
83
+ description: 'Load custom PostCSS configuration'
84
84
  },
85
- "--minify": {
85
+ '--minify': {
86
86
  type: Boolean,
87
- description: "Minify the output"
87
+ description: 'Minify the output'
88
88
  },
89
- "--config": {
89
+ '--config': {
90
90
  type: String,
91
- description: "Path to a custom config file"
91
+ description: 'Path to a custom config file'
92
92
  },
93
- "--no-autoprefixer": {
93
+ '--no-autoprefixer': {
94
94
  deprecated: true,
95
95
  type: Boolean,
96
- description: "Disable autoprefixer"
96
+ description: 'Disable autoprefixer'
97
97
  },
98
- "-c": "--config",
99
- "-i": "--input",
100
- "-o": "--output",
101
- "-m": "--minify",
102
- "-w": "--watch",
103
- "-p": "--poll"
98
+ '-c': '--config',
99
+ '-i': '--input',
100
+ '-o': '--output',
101
+ '-m': '--minify',
102
+ '-w': '--watch',
103
+ '-p': '--poll'
104
104
  }
105
105
  }
106
106
  };
107
107
  let sharedFlags = {
108
- "--help": {
108
+ '--help': {
109
109
  type: Boolean,
110
- description: "Display usage information"
110
+ description: 'Display usage information'
111
111
  },
112
- "-h": "--help"
112
+ '-h': '--help'
113
113
  };
114
114
  if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
115
115
  (0, _help.help)({
116
116
  usage: [
117
- "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
118
- "tailwindcss init [--full] [--postcss] [options...]"
117
+ 'tailwindcss [--input input.css] [--output output.css] [--watch] [options...]',
118
+ 'tailwindcss init [--full] [--postcss] [options...]'
119
119
  ],
120
- commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
120
+ commands: Object.keys(commands).filter((command)=>command !== 'build').map((command)=>`${command} [options]`),
121
121
  options: {
122
122
  ...commands.build.args,
123
123
  ...sharedFlags
@@ -125,26 +125,26 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
125
125
  });
126
126
  process.exit(0);
127
127
  }
128
- let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
128
+ let command = ((arg = '')=>arg.startsWith('-') ? undefined : arg)(process.argv[2]) || 'build';
129
129
  if (commands[command] === undefined) {
130
130
  if (_fs.default.existsSync(_path.default.resolve(command))) {
131
131
  // TODO: Deprecate this in future versions
132
132
  // Check if non-existing command, might be a file.
133
- command = "build";
133
+ command = 'build';
134
134
  } else {
135
135
  (0, _help.help)({
136
136
  message: `Invalid command: ${command}`,
137
137
  usage: [
138
- "tailwindcss <command> [options]"
138
+ 'tailwindcss <command> [options]'
139
139
  ],
140
- commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
140
+ commands: Object.keys(commands).filter((command)=>command !== 'build').map((command)=>`${command} [options]`),
141
141
  options: sharedFlags
142
142
  });
143
143
  process.exit(1);
144
144
  }
145
145
  }
146
146
  // Execute command
147
- let { args: flags , run } = commands[command];
147
+ let { args: flags, run } = commands[command];
148
148
  let args = (()=>{
149
149
  try {
150
150
  let result = (0, _arg.default)(Object.fromEntries(Object.entries({
@@ -155,18 +155,18 @@ let args = (()=>{
155
155
  return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
156
156
  }).map(([key, value])=>[
157
157
  key,
158
- typeof value === "object" ? value.type : value
158
+ typeof value === 'object' ? value.type : value
159
159
  ])), {
160
160
  permissive: true
161
161
  });
162
162
  // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
163
- for(let i = result["_"].length - 1; i >= 0; --i){
164
- let flag = result["_"][i];
165
- if (!flag.startsWith("-")) continue;
166
- let [flagName, flagValue] = flag.split("=");
163
+ for(let i = result['_'].length - 1; i >= 0; --i){
164
+ let flag = result['_'][i];
165
+ if (!flag.startsWith('-')) continue;
166
+ let [flagName, flagValue] = flag.split('=');
167
167
  let handler = flags[flagName];
168
168
  // Resolve flagName & handler
169
- while(typeof handler === "string"){
169
+ while(typeof handler === 'string'){
170
170
  flagName = handler;
171
171
  handler = flags[handler];
172
172
  }
@@ -176,18 +176,18 @@ let args = (()=>{
176
176
  // --flag value syntax was used so we need to pull `value` from `args`
177
177
  if (flagValue === undefined) {
178
178
  // Parse args for current flag
179
- while(result["_"][offset] && !result["_"][offset].startsWith("-")){
180
- args.push(result["_"][offset++]);
179
+ while(result['_'][offset] && !result['_'][offset].startsWith('-')){
180
+ args.push(result['_'][offset++]);
181
181
  }
182
182
  // Cleanup manually parsed flags + args
183
- result["_"].splice(i, 1 + args.length);
183
+ result['_'].splice(i, 1 + args.length);
184
184
  // No args were provided, use default value defined in handler
185
185
  // One arg was provided, use that directly
186
186
  // Multiple args were provided so pass them all in an array
187
187
  flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
188
188
  } else {
189
189
  // Remove the whole flag from the args array
190
- result["_"].splice(i, 1);
190
+ result['_'].splice(i, 1);
191
191
  }
192
192
  // Set the resolved value in the `result` object
193
193
  result[flagName] = handler.type(flagValue, flagName);
@@ -198,16 +198,16 @@ let args = (()=>{
198
198
  //
199
199
  // E.g.: tailwindcss input.css -> _: ['build', 'input.css']
200
200
  // E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
201
- if (result["_"][0] !== command) {
202
- result["_"].unshift(command);
201
+ if (result['_'][0] !== command) {
202
+ result['_'].unshift(command);
203
203
  }
204
204
  return result;
205
205
  } catch (err) {
206
- if (err.code === "ARG_UNKNOWN_OPTION") {
206
+ if (err.code === 'ARG_UNKNOWN_OPTION') {
207
207
  (0, _help.help)({
208
208
  message: err.message,
209
209
  usage: [
210
- "tailwindcss <command> [options]"
210
+ 'tailwindcss <command> [options]'
211
211
  ],
212
212
  options: sharedFlags
213
213
  });
@@ -216,7 +216,7 @@ let args = (()=>{
216
216
  throw err;
217
217
  }
218
218
  })();
219
- if (args["--help"]) {
219
+ if (args['--help']) {
220
220
  (0, _help.help)({
221
221
  options: {
222
222
  ...flags,
@@ -17,40 +17,40 @@ function _interop_require_default(obj) {
17
17
  };
18
18
  }
19
19
  function isESM() {
20
- const pkgPath = _path.default.resolve("./package.json");
20
+ const pkgPath = _path.default.resolve('./package.json');
21
21
  try {
22
- let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
23
- return pkg.type && pkg.type === "module";
22
+ let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, 'utf8'));
23
+ return pkg.type && pkg.type === 'module';
24
24
  } catch (err) {
25
25
  return false;
26
26
  }
27
27
  }
28
28
  function init(args) {
29
29
  let messages = [];
30
- let isProjectESM = args["--ts"] || args["--esm"] || isESM();
31
- let syntax = args["--ts"] ? "ts" : isProjectESM ? "js" : "cjs";
32
- let extension = args["--ts"] ? "ts" : "js";
30
+ let isProjectESM = args['--ts'] || args['--esm'] || isESM();
31
+ let syntax = args['--ts'] ? 'ts' : isProjectESM ? 'js' : 'cjs';
32
+ let extension = args['--ts'] ? 'ts' : 'js';
33
33
  var _args___;
34
- let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
34
+ let tailwindConfigLocation = _path.default.resolve((_args___ = args['_'][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
35
35
  if (_fs.default.existsSync(tailwindConfigLocation)) {
36
36
  messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
37
37
  } else {
38
- let stubContentsFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../stubs/config.full.js") : _path.default.resolve(__dirname, "../../../stubs/config.simple.js"), "utf8");
39
- let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../stubs/tailwind.config.${syntax}`), "utf8");
38
+ let stubContentsFile = _fs.default.readFileSync(args['--full'] ? _path.default.resolve(__dirname, '../../../stubs/config.full.js') : _path.default.resolve(__dirname, '../../../stubs/config.simple.js'), 'utf8');
39
+ let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../stubs/tailwind.config.${syntax}`), 'utf8');
40
40
  // Change colors import
41
- stubContentsFile = stubContentsFile.replace("../colors", "tailwindcss/colors");
41
+ stubContentsFile = stubContentsFile.replace('../colors', 'tailwindcss/colors');
42
42
  // Replace contents of {ts,js,cjs} file with the stub {simple,full}.
43
- stubFile = stubFile.replace("__CONFIG__", stubContentsFile.replace("module.exports =", "").trim()).trim() + "\n\n";
44
- _fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
43
+ stubFile = stubFile.replace('__CONFIG__', stubContentsFile.replace('module.exports =', '').trim()).trim() + '\n\n';
44
+ _fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
45
45
  messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
46
46
  }
47
- if (args["--postcss"]) {
48
- let postcssConfigLocation = _path.default.resolve("./postcss.config.js");
47
+ if (args['--postcss']) {
48
+ let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
49
49
  if (_fs.default.existsSync(postcssConfigLocation)) {
50
50
  messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
51
51
  } else {
52
- let stubFile = _fs.default.readFileSync(isProjectESM ? _path.default.resolve(__dirname, "../../../stubs/postcss.config.js") : _path.default.resolve(__dirname, "../../../stubs/postcss.config.cjs"), "utf8");
53
- _fs.default.writeFileSync(postcssConfigLocation, stubFile, "utf8");
52
+ let stubFile = _fs.default.readFileSync(isProjectESM ? _path.default.resolve(__dirname, '../../../stubs/postcss.config.js') : _path.default.resolve(__dirname, '../../../stubs/postcss.config.cjs'), 'utf8');
53
+ _fs.default.writeFileSync(postcssConfigLocation, stubFile, 'utf8');
54
54
  messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
55
55
  }
56
56
  }
package/lib/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- module.exports = require("./cli/index");
3
+ module.exports = require('./cli/index');
@@ -32,6 +32,7 @@ const _default = [
32
32
  "lineClamp",
33
33
  "display",
34
34
  "aspectRatio",
35
+ "size",
35
36
  "height",
36
37
  "maxHeight",
37
38
  "minHeight",
@@ -184,5 +185,6 @@ const _default = [
184
185
  "transitionDuration",
185
186
  "transitionTimingFunction",
186
187
  "willChange",
187
- "content"
188
+ "content",
189
+ "forcedColorAdjust"
188
190
  ];