tailwindcss 0.0.0-insiders.f4635e0 → 0.0.0-insiders.f4a2ccd

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 (238) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +15 -7
  3. package/colors.d.ts +3 -0
  4. package/colors.js +2 -304
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -4
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -4
  9. package/lib/cli/build/deps.js +54 -0
  10. package/lib/cli/build/index.js +52 -0
  11. package/lib/cli/build/plugin.js +376 -0
  12. package/lib/cli/build/utils.js +78 -0
  13. package/lib/cli/build/watching.js +180 -0
  14. package/lib/cli/help/index.js +71 -0
  15. package/lib/cli/index.js +230 -0
  16. package/lib/cli/init/index.js +61 -0
  17. package/lib/cli-peer-dependencies.js +22 -14
  18. package/lib/cli.js +4 -762
  19. package/lib/corePluginList.js +182 -5
  20. package/lib/corePlugins.js +4109 -2952
  21. package/lib/css/preflight.css +24 -9
  22. package/lib/featureFlags.js +68 -50
  23. package/lib/index.js +5 -30
  24. package/lib/lib/cacheInvalidation.js +90 -0
  25. package/lib/lib/collapseAdjacentRules.js +52 -36
  26. package/lib/lib/collapseDuplicateDeclarations.js +83 -0
  27. package/lib/lib/content.js +177 -0
  28. package/lib/lib/defaultExtractor.js +241 -0
  29. package/lib/lib/detectNesting.js +39 -17
  30. package/lib/lib/evaluateTailwindFunctions.js +203 -161
  31. package/lib/lib/expandApplyAtRules.js +503 -221
  32. package/lib/lib/expandTailwindAtRules.js +255 -243
  33. package/lib/lib/findAtConfigPath.js +44 -0
  34. package/lib/lib/generateRules.js +831 -317
  35. package/lib/lib/getModuleDependencies.js +93 -49
  36. package/lib/lib/load-config.js +36 -0
  37. package/lib/lib/normalizeTailwindDirectives.js +79 -60
  38. package/lib/lib/offsets.js +304 -0
  39. package/lib/lib/partitionApplyAtRules.js +56 -0
  40. package/lib/lib/regex.js +60 -0
  41. package/lib/lib/remap-bitfield.js +87 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +150 -94
  43. package/lib/lib/setupContextUtils.js +1197 -685
  44. package/lib/lib/setupTrackingContext.js +150 -177
  45. package/lib/lib/sharedState.js +70 -21
  46. package/lib/lib/substituteScreenAtRules.js +26 -28
  47. package/lib/oxide/cli/build/deps.js +81 -0
  48. package/lib/oxide/cli/build/index.js +51 -0
  49. package/lib/oxide/cli/build/plugin.js +373 -0
  50. package/lib/oxide/cli/build/utils.js +77 -0
  51. package/lib/oxide/cli/build/watching.js +177 -0
  52. package/lib/oxide/cli/help/index.js +70 -0
  53. package/lib/oxide/cli/index.js +214 -0
  54. package/lib/oxide/cli/init/index.js +50 -0
  55. package/lib/oxide/cli.js +5 -0
  56. package/lib/oxide/postcss-plugin.js +2 -0
  57. package/lib/plugin.js +98 -0
  58. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  59. package/lib/postcss-plugins/nesting/index.js +19 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  61. package/lib/processTailwindFeatures.js +58 -56
  62. package/lib/public/colors.js +353 -0
  63. package/lib/public/create-plugin.js +15 -0
  64. package/lib/public/default-config.js +16 -0
  65. package/lib/public/default-theme.js +16 -0
  66. package/lib/public/load-config.js +10 -0
  67. package/lib/public/resolve-config.js +22 -0
  68. package/lib/util/applyImportantSelector.js +22 -0
  69. package/lib/util/bigSign.js +7 -6
  70. package/lib/util/buildMediaQuery.js +21 -32
  71. package/lib/util/cloneDeep.js +16 -14
  72. package/lib/util/cloneNodes.js +29 -15
  73. package/lib/util/color.js +104 -66
  74. package/lib/util/configurePlugins.js +17 -15
  75. package/lib/util/createPlugin.js +23 -26
  76. package/lib/util/createUtilityPlugin.js +46 -46
  77. package/lib/util/dataTypes.js +266 -0
  78. package/lib/util/defaults.js +20 -15
  79. package/lib/util/escapeClassName.js +18 -17
  80. package/lib/util/escapeCommas.js +7 -6
  81. package/lib/util/flattenColorPalette.js +13 -12
  82. package/lib/util/formatVariantSelector.js +341 -0
  83. package/lib/util/getAllConfigs.js +44 -18
  84. package/lib/util/hashConfig.js +15 -12
  85. package/lib/util/isKeyframeRule.js +7 -6
  86. package/lib/util/isPlainObject.js +11 -11
  87. package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
  88. package/lib/util/log.js +52 -33
  89. package/lib/util/nameClass.js +35 -29
  90. package/lib/util/negateValue.js +31 -17
  91. package/lib/util/normalizeConfig.js +294 -0
  92. package/lib/util/normalizeScreens.js +170 -0
  93. package/lib/util/parseAnimationValue.js +85 -54
  94. package/lib/util/parseBoxShadowValue.js +84 -0
  95. package/lib/util/parseDependency.js +41 -70
  96. package/lib/util/parseGlob.js +34 -0
  97. package/lib/util/parseObjectStyles.js +30 -24
  98. package/lib/util/pluginUtils.js +234 -288
  99. package/lib/util/prefixSelector.js +33 -19
  100. package/lib/util/removeAlphaVariables.js +29 -0
  101. package/lib/util/resolveConfig.js +221 -256
  102. package/lib/util/resolveConfigPath.js +55 -48
  103. package/lib/util/responsive.js +18 -14
  104. package/lib/util/splitAtTopLevelOnly.js +49 -0
  105. package/lib/util/tap.js +8 -7
  106. package/lib/util/toColorValue.js +7 -6
  107. package/lib/util/toPath.js +27 -8
  108. package/lib/util/transformThemeValue.js +67 -28
  109. package/lib/util/validateConfig.js +24 -0
  110. package/lib/util/validateFormalSyntax.js +24 -0
  111. package/lib/util/withAlphaVariable.js +67 -57
  112. package/loadConfig.d.ts +4 -0
  113. package/loadConfig.js +2 -0
  114. package/nesting/index.js +2 -12
  115. package/package.json +69 -66
  116. package/peers/index.js +76328 -84169
  117. package/plugin.d.ts +11 -0
  118. package/plugin.js +1 -2
  119. package/resolveConfig.d.ts +12 -0
  120. package/resolveConfig.js +2 -7
  121. package/scripts/create-plugin-list.js +2 -2
  122. package/scripts/generate-types.js +105 -0
  123. package/scripts/release-channel.js +18 -0
  124. package/scripts/release-notes.js +21 -0
  125. package/scripts/swap-engines.js +40 -0
  126. package/scripts/type-utils.js +27 -0
  127. package/src/cli/build/deps.js +56 -0
  128. package/src/cli/build/index.js +49 -0
  129. package/src/cli/build/plugin.js +444 -0
  130. package/src/cli/build/utils.js +76 -0
  131. package/src/cli/build/watching.js +229 -0
  132. package/src/cli/help/index.js +70 -0
  133. package/src/cli/index.js +216 -0
  134. package/src/cli/init/index.js +79 -0
  135. package/src/cli-peer-dependencies.js +7 -1
  136. package/src/cli.js +4 -756
  137. package/src/corePluginList.js +1 -1
  138. package/src/corePlugins.js +2526 -1956
  139. package/src/css/preflight.css +24 -9
  140. package/src/featureFlags.js +33 -10
  141. package/src/index.js +4 -33
  142. package/src/lib/cacheInvalidation.js +52 -0
  143. package/src/lib/collapseAdjacentRules.js +21 -2
  144. package/src/lib/collapseDuplicateDeclarations.js +93 -0
  145. package/src/lib/content.js +208 -0
  146. package/src/lib/defaultExtractor.js +217 -0
  147. package/src/lib/detectNesting.js +30 -3
  148. package/src/lib/evaluateTailwindFunctions.js +84 -10
  149. package/src/lib/expandApplyAtRules.js +509 -153
  150. package/src/lib/expandTailwindAtRules.js +125 -104
  151. package/src/lib/findAtConfigPath.js +48 -0
  152. package/src/lib/generateRules.js +678 -70
  153. package/src/lib/getModuleDependencies.js +70 -30
  154. package/src/lib/load-config.ts +27 -0
  155. package/src/lib/normalizeTailwindDirectives.js +10 -3
  156. package/src/lib/offsets.js +373 -0
  157. package/src/lib/partitionApplyAtRules.js +52 -0
  158. package/src/lib/regex.js +74 -0
  159. package/src/lib/remap-bitfield.js +82 -0
  160. package/src/lib/resolveDefaultsAtRules.js +105 -47
  161. package/src/lib/setupContextUtils.js +848 -247
  162. package/src/lib/setupTrackingContext.js +53 -64
  163. package/src/lib/sharedState.js +60 -6
  164. package/src/lib/substituteScreenAtRules.js +6 -3
  165. package/src/oxide/cli/build/deps.ts +91 -0
  166. package/src/oxide/cli/build/index.ts +47 -0
  167. package/src/oxide/cli/build/plugin.ts +442 -0
  168. package/src/oxide/cli/build/utils.ts +74 -0
  169. package/src/oxide/cli/build/watching.ts +225 -0
  170. package/src/oxide/cli/help/index.ts +69 -0
  171. package/src/oxide/cli/index.ts +204 -0
  172. package/src/oxide/cli/init/index.ts +59 -0
  173. package/src/oxide/cli.ts +1 -0
  174. package/src/oxide/postcss-plugin.ts +1 -0
  175. package/src/plugin.js +107 -0
  176. package/src/postcss-plugins/nesting/README.md +42 -0
  177. package/src/postcss-plugins/nesting/index.js +13 -0
  178. package/src/postcss-plugins/nesting/plugin.js +80 -0
  179. package/src/processTailwindFeatures.js +18 -3
  180. package/src/public/colors.js +322 -0
  181. package/src/public/create-plugin.js +2 -0
  182. package/src/public/default-config.js +4 -0
  183. package/src/public/default-theme.js +4 -0
  184. package/src/public/load-config.js +2 -0
  185. package/src/public/resolve-config.js +7 -0
  186. package/src/util/applyImportantSelector.js +19 -0
  187. package/src/util/buildMediaQuery.js +14 -16
  188. package/src/util/cloneNodes.js +19 -2
  189. package/src/util/color.js +43 -11
  190. package/src/util/createUtilityPlugin.js +2 -11
  191. package/src/util/dataTypes.js +281 -0
  192. package/src/util/defaults.js +6 -0
  193. package/src/util/formatVariantSelector.js +412 -0
  194. package/src/util/getAllConfigs.js +21 -2
  195. package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
  196. package/src/util/log.js +23 -22
  197. package/src/util/nameClass.js +6 -2
  198. package/src/util/negateValue.js +15 -5
  199. package/src/util/normalizeConfig.js +318 -0
  200. package/src/util/normalizeScreens.js +140 -0
  201. package/src/util/parseAnimationValue.js +7 -1
  202. package/src/util/parseBoxShadowValue.js +72 -0
  203. package/src/util/parseDependency.js +37 -38
  204. package/src/util/parseGlob.js +24 -0
  205. package/src/util/pluginUtils.js +219 -219
  206. package/src/util/prefixSelector.js +30 -13
  207. package/src/util/removeAlphaVariables.js +24 -0
  208. package/src/util/resolveConfig.js +86 -91
  209. package/src/util/resolveConfigPath.js +12 -1
  210. package/src/util/splitAtTopLevelOnly.js +52 -0
  211. package/src/util/toPath.js +23 -1
  212. package/src/util/transformThemeValue.js +33 -8
  213. package/src/util/validateConfig.js +13 -0
  214. package/src/util/validateFormalSyntax.js +34 -0
  215. package/src/util/withAlphaVariable.js +14 -9
  216. package/stubs/.gitignore +1 -0
  217. package/stubs/.prettierrc.json +6 -0
  218. package/stubs/{defaultConfig.stub.js → config.full.js} +332 -249
  219. package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
  220. package/stubs/postcss.config.js +6 -0
  221. package/stubs/tailwind.config.cjs +2 -0
  222. package/stubs/tailwind.config.js +2 -0
  223. package/stubs/tailwind.config.ts +3 -0
  224. package/types/config.d.ts +373 -0
  225. package/types/generated/.gitkeep +0 -0
  226. package/types/generated/colors.d.ts +298 -0
  227. package/types/generated/corePluginList.d.ts +1 -0
  228. package/types/generated/default-theme.d.ts +347 -0
  229. package/types/index.d.ts +7 -0
  230. package/CHANGELOG.md +0 -1742
  231. package/lib/constants.js +0 -37
  232. package/lib/lib/setupWatchingContext.js +0 -331
  233. package/nesting/plugin.js +0 -41
  234. package/scripts/install-integrations.js +0 -27
  235. package/scripts/rebuildFixtures.js +0 -68
  236. package/src/constants.js +0 -17
  237. package/src/lib/setupWatchingContext.js +0 -307
  238. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -1,37 +1,43 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.default = nameClass;
7
- exports.formatClass = formatClass;
8
-
9
- var _escapeClassName = _interopRequireDefault(require("./escapeClassName"));
10
-
11
- var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
12
-
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ asClass: ()=>asClass,
13
+ default: ()=>nameClass,
14
+ formatClass: ()=>formatClass
15
+ });
16
+ const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("./escapeClassName"));
17
+ const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
18
+ function _interopRequireDefault(obj) {
19
+ return obj && obj.__esModule ? obj : {
20
+ default: obj
21
+ };
22
+ }
15
23
  function asClass(name) {
16
- return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
24
+ return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
17
25
  }
18
-
19
26
  function nameClass(classPrefix, key) {
20
- return asClass(formatClass(classPrefix, key));
27
+ return asClass(formatClass(classPrefix, key));
21
28
  }
22
-
23
29
  function formatClass(classPrefix, key) {
24
- if (key === 'DEFAULT') {
25
- return classPrefix;
26
- }
27
-
28
- if (key === '-') {
29
- return `-${classPrefix}`;
30
- }
31
-
32
- if (key.startsWith('-')) {
33
- return `-${classPrefix}${key}`;
34
- }
35
-
36
- return `${classPrefix}-${key}`;
37
- }
30
+ if (key === "DEFAULT") {
31
+ return classPrefix;
32
+ }
33
+ if (key === "-" || key === "-DEFAULT") {
34
+ return `-${classPrefix}`;
35
+ }
36
+ if (key.startsWith("-")) {
37
+ return `-${classPrefix}${key}`;
38
+ }
39
+ if (key.startsWith("/")) {
40
+ return `${classPrefix}${key}`;
41
+ }
42
+ return `${classPrefix}-${key}`;
43
+ }
@@ -1,20 +1,34 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.default = _default;
7
-
8
- function _default(value) {
9
- value = `${value}`; // Flip sign of numbers
10
-
11
- if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
12
- return value.replace(/^[+-]?/, sign => sign === '-' ? '' : '-');
13
- }
14
-
15
- if (value.includes('var(') || value.includes('calc(')) {
16
- return `calc(${value} * -1)`;
17
- }
18
-
19
- return value;
20
- }
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>negateValue
8
+ });
9
+ function negateValue(value) {
10
+ value = `${value}`;
11
+ if (value === "0") {
12
+ return "0";
13
+ }
14
+ // Flip sign of numbers
15
+ if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
16
+ return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
17
+ }
18
+ // What functions we support negating numeric values for
19
+ // var() isn't inherently a numeric function but we support it anyway
20
+ // The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
21
+ // to produce generally useful results and that will be covered already
22
+ let numericFunctions = [
23
+ "var",
24
+ "calc",
25
+ "min",
26
+ "max",
27
+ "clamp"
28
+ ];
29
+ for (const fn of numericFunctions){
30
+ if (value.includes(`${fn}(`)) {
31
+ return `calc(${value} * -1)`;
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "normalizeConfig", {
6
+ enumerable: true,
7
+ get: ()=>normalizeConfig
8
+ });
9
+ const _featureFlags = require("../featureFlags");
10
+ const _log = /*#__PURE__*/ _interopRequireWildcard(require("./log"));
11
+ function _getRequireWildcardCache(nodeInterop) {
12
+ if (typeof WeakMap !== "function") return null;
13
+ var cacheBabelInterop = new WeakMap();
14
+ var cacheNodeInterop = new WeakMap();
15
+ return (_getRequireWildcardCache = function(nodeInterop) {
16
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
+ })(nodeInterop);
18
+ }
19
+ function _interopRequireWildcard(obj, nodeInterop) {
20
+ if (!nodeInterop && obj && obj.__esModule) {
21
+ return obj;
22
+ }
23
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
+ return {
25
+ default: obj
26
+ };
27
+ }
28
+ var cache = _getRequireWildcardCache(nodeInterop);
29
+ if (cache && cache.has(obj)) {
30
+ return cache.get(obj);
31
+ }
32
+ var newObj = {};
33
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
+ for(var key in obj){
35
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
+ if (desc && (desc.get || desc.set)) {
38
+ Object.defineProperty(newObj, key, desc);
39
+ } else {
40
+ newObj[key] = obj[key];
41
+ }
42
+ }
43
+ }
44
+ newObj.default = obj;
45
+ if (cache) {
46
+ cache.set(obj, newObj);
47
+ }
48
+ return newObj;
49
+ }
50
+ function normalizeConfig(config) {
51
+ // Quick structure validation
52
+ /**
53
+ * type FilePath = string
54
+ * type RawFile = { raw: string, extension?: string }
55
+ * type ExtractorFn = (content: string) => Array<string>
56
+ * type TransformerFn = (content: string) => string
57
+ *
58
+ * type Content =
59
+ * | Array<FilePath | RawFile>
60
+ * | {
61
+ * files: Array<FilePath | RawFile>,
62
+ * extract?: ExtractorFn | { [extension: string]: ExtractorFn }
63
+ * transform?: TransformerFn | { [extension: string]: TransformerFn }
64
+ * }
65
+ */ let valid = (()=>{
66
+ // `config.purge` should not exist anymore
67
+ if (config.purge) {
68
+ return false;
69
+ }
70
+ // `config.content` should exist
71
+ if (!config.content) {
72
+ return false;
73
+ }
74
+ // `config.content` should be an object or an array
75
+ if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
76
+ return false;
77
+ }
78
+ // When `config.content` is an array, it should consist of FilePaths or RawFiles
79
+ if (Array.isArray(config.content)) {
80
+ return config.content.every((path)=>{
81
+ // `path` can be a string
82
+ if (typeof path === "string") return true;
83
+ // `path` can be an object { raw: string, extension?: string }
84
+ // `raw` must be a string
85
+ if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
86
+ // `extension` (if provided) should also be a string
87
+ if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
88
+ return false;
89
+ }
90
+ return true;
91
+ });
92
+ }
93
+ // When `config.content` is an object
94
+ if (typeof config.content === "object" && config.content !== null) {
95
+ // Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
96
+ if (Object.keys(config.content).some((key)=>![
97
+ "files",
98
+ "relative",
99
+ "extract",
100
+ "transform"
101
+ ].includes(key))) {
102
+ return false;
103
+ }
104
+ // `config.content.files` should exist of FilePaths or RawFiles
105
+ if (Array.isArray(config.content.files)) {
106
+ if (!config.content.files.every((path)=>{
107
+ // `path` can be a string
108
+ if (typeof path === "string") return true;
109
+ // `path` can be an object { raw: string, extension?: string }
110
+ // `raw` must be a string
111
+ if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
112
+ // `extension` (if provided) should also be a string
113
+ if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
114
+ return false;
115
+ }
116
+ return true;
117
+ })) {
118
+ return false;
119
+ }
120
+ // `config.content.extract` is optional, and can be a Function or a Record<String, Function>
121
+ if (typeof config.content.extract === "object") {
122
+ for (let value of Object.values(config.content.extract)){
123
+ if (typeof value !== "function") {
124
+ return false;
125
+ }
126
+ }
127
+ } else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
128
+ return false;
129
+ }
130
+ // `config.content.transform` is optional, and can be a Function or a Record<String, Function>
131
+ if (typeof config.content.transform === "object") {
132
+ for (let value1 of Object.values(config.content.transform)){
133
+ if (typeof value1 !== "function") {
134
+ return false;
135
+ }
136
+ }
137
+ } else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
138
+ return false;
139
+ }
140
+ // `config.content.relative` is optional and can be a boolean
141
+ if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
142
+ return false;
143
+ }
144
+ }
145
+ return true;
146
+ }
147
+ return false;
148
+ })();
149
+ if (!valid) {
150
+ _log.default.warn("purge-deprecation", [
151
+ "The `purge`/`content` options have changed in Tailwind CSS v3.0.",
152
+ "Update your configuration file to eliminate this warning.",
153
+ "https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
154
+ ]);
155
+ }
156
+ // Normalize the `safelist`
157
+ config.safelist = (()=>{
158
+ var _purge_options;
159
+ let { content , purge , safelist } = config;
160
+ if (Array.isArray(safelist)) return safelist;
161
+ if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
162
+ if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
163
+ if (Array.isArray(purge === null || purge === void 0 ? void 0 : (_purge_options = purge.options) === null || _purge_options === void 0 ? void 0 : _purge_options.safelist)) return purge.options.safelist;
164
+ return [];
165
+ })();
166
+ // Normalize the `blocklist`
167
+ config.blocklist = (()=>{
168
+ let { blocklist } = config;
169
+ if (Array.isArray(blocklist)) {
170
+ if (blocklist.every((item)=>typeof item === "string")) {
171
+ return blocklist;
172
+ }
173
+ _log.default.warn("blocklist-invalid", [
174
+ "The `blocklist` option must be an array of strings.",
175
+ "https://tailwindcss.com/docs/content-configuration#discarding-classes"
176
+ ]);
177
+ }
178
+ return [];
179
+ })();
180
+ // Normalize prefix option
181
+ if (typeof config.prefix === "function") {
182
+ _log.default.warn("prefix-function", [
183
+ "As of Tailwind CSS v3.0, `prefix` cannot be a function.",
184
+ "Update `prefix` in your configuration to be a string to eliminate this warning.",
185
+ "https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
186
+ ]);
187
+ config.prefix = "";
188
+ } else {
189
+ var _config_prefix;
190
+ config.prefix = (_config_prefix = config.prefix) !== null && _config_prefix !== void 0 ? _config_prefix : "";
191
+ }
192
+ // Normalize the `content`
193
+ config.content = {
194
+ relative: (()=>{
195
+ let { content } = config;
196
+ if (content === null || content === void 0 ? void 0 : content.relative) {
197
+ return content.relative;
198
+ }
199
+ return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
200
+ })(),
201
+ files: (()=>{
202
+ let { content , purge } = config;
203
+ if (Array.isArray(purge)) return purge;
204
+ if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
205
+ if (Array.isArray(content)) return content;
206
+ if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
207
+ if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
208
+ return [];
209
+ })(),
210
+ extract: (()=>{
211
+ let extract = (()=>{
212
+ var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options;
213
+ if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
214
+ if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
215
+ if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_extract = _config_purge1.extract) === null || _config_purge_extract === void 0 ? void 0 : _config_purge_extract.DEFAULT) return config.purge.extract.DEFAULT;
216
+ if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_extract = _config_content1.extract) === null || _config_content_extract === void 0 ? void 0 : _config_content_extract.DEFAULT) return config.content.extract.DEFAULT;
217
+ if ((_config_purge2 = config.purge) === null || _config_purge2 === void 0 ? void 0 : (_config_purge_options = _config_purge2.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.extractors) return config.purge.options.extractors;
218
+ if ((_config_content2 = config.content) === null || _config_content2 === void 0 ? void 0 : (_config_content_options = _config_content2.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.extractors) return config.content.options.extractors;
219
+ return {};
220
+ })();
221
+ let extractors = {};
222
+ let defaultExtractor = (()=>{
223
+ var _config_purge, _config_purge_options, _config_content, _config_content_options;
224
+ if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : (_config_purge_options = _config_purge.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.defaultExtractor) {
225
+ return config.purge.options.defaultExtractor;
226
+ }
227
+ if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : (_config_content_options = _config_content.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.defaultExtractor) {
228
+ return config.content.options.defaultExtractor;
229
+ }
230
+ return undefined;
231
+ })();
232
+ if (defaultExtractor !== undefined) {
233
+ extractors.DEFAULT = defaultExtractor;
234
+ }
235
+ // Functions
236
+ if (typeof extract === "function") {
237
+ extractors.DEFAULT = extract;
238
+ } else if (Array.isArray(extract)) {
239
+ for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
240
+ for (let extension of extensions){
241
+ extractors[extension] = extractor;
242
+ }
243
+ }
244
+ } else if (typeof extract === "object" && extract !== null) {
245
+ Object.assign(extractors, extract);
246
+ }
247
+ return extractors;
248
+ })(),
249
+ transform: (()=>{
250
+ let transform = (()=>{
251
+ var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
252
+ if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
253
+ if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
254
+ if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_transform = _config_purge1.transform) === null || _config_purge_transform === void 0 ? void 0 : _config_purge_transform.DEFAULT) return config.purge.transform.DEFAULT;
255
+ if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_transform = _config_content1.transform) === null || _config_content_transform === void 0 ? void 0 : _config_content_transform.DEFAULT) return config.content.transform.DEFAULT;
256
+ return {};
257
+ })();
258
+ let transformers = {};
259
+ if (typeof transform === "function") {
260
+ transformers.DEFAULT = transform;
261
+ }
262
+ if (typeof transform === "object" && transform !== null) {
263
+ Object.assign(transformers, transform);
264
+ }
265
+ return transformers;
266
+ })()
267
+ };
268
+ // Validate globs to prevent bogus globs.
269
+ // E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
270
+ for (let file of config.content.files){
271
+ if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
272
+ _log.default.warn("invalid-glob-braces", [
273
+ `The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
274
+ `Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
275
+ ]);
276
+ break;
277
+ }
278
+ }
279
+ // Warn if the line-clamp plugin is installed
280
+ if (config.plugins.length > 0) {
281
+ let plugin;
282
+ try {
283
+ plugin = require("@tailwindcss/line-clamp");
284
+ } catch {}
285
+ if (plugin && config.plugins.includes(plugin)) {
286
+ _log.default.warn("line-clamp-in-core", [
287
+ "As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.",
288
+ "Remove it from the `plugins` array in your configuration to eliminate this warning."
289
+ ]);
290
+ config.plugins = config.plugins.filter((p)=>p !== plugin);
291
+ }
292
+ }
293
+ return config;
294
+ }
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @typedef {object} ScreenValue
3
+ * @property {number|undefined} min
4
+ * @property {number|undefined} max
5
+ * @property {string|undefined} raw
6
+ */ /**
7
+ * @typedef {object} Screen
8
+ * @property {string} name
9
+ * @property {boolean} not
10
+ * @property {ScreenValue[]} values
11
+ */ /**
12
+ * A function that normalizes the various forms that the screens object can be
13
+ * provided in.
14
+ *
15
+ * Input(s):
16
+ * - ['100px', '200px'] // Raw strings
17
+ * - { sm: '100px', md: '200px' } // Object with string values
18
+ * - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
19
+ * - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
20
+ *
21
+ * Output(s):
22
+ * - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
23
+ *
24
+ * @returns {Screen[]}
25
+ */ "use strict";
26
+ Object.defineProperty(exports, "__esModule", {
27
+ value: true
28
+ });
29
+ function _export(target, all) {
30
+ for(var name in all)Object.defineProperty(target, name, {
31
+ enumerable: true,
32
+ get: all[name]
33
+ });
34
+ }
35
+ _export(exports, {
36
+ normalizeScreens: ()=>normalizeScreens,
37
+ isScreenSortable: ()=>isScreenSortable,
38
+ compareScreens: ()=>compareScreens,
39
+ toScreen: ()=>toScreen
40
+ });
41
+ function normalizeScreens(screens, root = true) {
42
+ if (Array.isArray(screens)) {
43
+ return screens.map((screen)=>{
44
+ if (root && Array.isArray(screen)) {
45
+ throw new Error("The tuple syntax is not supported for `screens`.");
46
+ }
47
+ if (typeof screen === "string") {
48
+ return {
49
+ name: screen.toString(),
50
+ not: false,
51
+ values: [
52
+ {
53
+ min: screen,
54
+ max: undefined
55
+ }
56
+ ]
57
+ };
58
+ }
59
+ let [name, options] = screen;
60
+ name = name.toString();
61
+ if (typeof options === "string") {
62
+ return {
63
+ name,
64
+ not: false,
65
+ values: [
66
+ {
67
+ min: options,
68
+ max: undefined
69
+ }
70
+ ]
71
+ };
72
+ }
73
+ if (Array.isArray(options)) {
74
+ return {
75
+ name,
76
+ not: false,
77
+ values: options.map((option)=>resolveValue(option))
78
+ };
79
+ }
80
+ return {
81
+ name,
82
+ not: false,
83
+ values: [
84
+ resolveValue(options)
85
+ ]
86
+ };
87
+ });
88
+ }
89
+ return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
90
+ }
91
+ function isScreenSortable(screen) {
92
+ if (screen.values.length !== 1) {
93
+ return {
94
+ result: false,
95
+ reason: "multiple-values"
96
+ };
97
+ } else if (screen.values[0].raw !== undefined) {
98
+ return {
99
+ result: false,
100
+ reason: "raw-values"
101
+ };
102
+ } else if (screen.values[0].min !== undefined && screen.values[0].max !== undefined) {
103
+ return {
104
+ result: false,
105
+ reason: "min-and-max"
106
+ };
107
+ }
108
+ return {
109
+ result: true,
110
+ reason: null
111
+ };
112
+ }
113
+ function compareScreens(type, a, z) {
114
+ let aScreen = toScreen(a, type);
115
+ let zScreen = toScreen(z, type);
116
+ let aSorting = isScreenSortable(aScreen);
117
+ let bSorting = isScreenSortable(zScreen);
118
+ // These cases should never happen and indicate a bug in Tailwind CSS itself
119
+ if (aSorting.reason === "multiple-values" || bSorting.reason === "multiple-values") {
120
+ throw new Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
121
+ } else if (aSorting.reason === "raw-values" || bSorting.reason === "raw-values") {
122
+ throw new Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
123
+ } else if (aSorting.reason === "min-and-max" || bSorting.reason === "min-and-max") {
124
+ throw new Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
125
+ }
126
+ // Let the sorting begin
127
+ let { min: aMin , max: aMax } = aScreen.values[0];
128
+ let { min: zMin , max: zMax } = zScreen.values[0];
129
+ // Negating screens flip their behavior. Basically `not min-width` is `max-width`
130
+ if (a.not) [aMin, aMax] = [
131
+ aMax,
132
+ aMin
133
+ ];
134
+ if (z.not) [zMin, zMax] = [
135
+ zMax,
136
+ zMin
137
+ ];
138
+ aMin = aMin === undefined ? aMin : parseFloat(aMin);
139
+ aMax = aMax === undefined ? aMax : parseFloat(aMax);
140
+ zMin = zMin === undefined ? zMin : parseFloat(zMin);
141
+ zMax = zMax === undefined ? zMax : parseFloat(zMax);
142
+ let [aValue, zValue] = type === "min" ? [
143
+ aMin,
144
+ zMin
145
+ ] : [
146
+ zMax,
147
+ aMax
148
+ ];
149
+ return aValue - zValue;
150
+ }
151
+ function toScreen(value, type) {
152
+ if (typeof value === "object") {
153
+ return value;
154
+ }
155
+ return {
156
+ name: "arbitrary-screen",
157
+ values: [
158
+ {
159
+ [type]: value
160
+ }
161
+ ]
162
+ };
163
+ }
164
+ function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
165
+ return {
166
+ min,
167
+ max,
168
+ raw
169
+ };
170
+ }