tailwindcss 0.0.0-insiders.ea139f2 → 0.0.0-insiders.ea4e1cd

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 (236) 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 -1
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -1
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -1
  9. package/lib/cli/build/deps.js +62 -0
  10. package/lib/cli/build/index.js +54 -0
  11. package/lib/cli/build/plugin.js +378 -0
  12. package/lib/cli/build/utils.js +88 -0
  13. package/lib/cli/build/watching.js +182 -0
  14. package/lib/cli/help/index.js +73 -0
  15. package/lib/cli/index.js +230 -0
  16. package/lib/cli/init/index.js +63 -0
  17. package/lib/cli-peer-dependencies.js +28 -7
  18. package/lib/cli.js +4 -703
  19. package/lib/corePluginList.js +12 -3
  20. package/lib/corePlugins.js +2373 -1863
  21. package/lib/css/preflight.css +10 -8
  22. package/lib/featureFlags.js +49 -26
  23. package/lib/index.js +1 -31
  24. package/lib/lib/cacheInvalidation.js +92 -0
  25. package/lib/lib/collapseAdjacentRules.js +30 -10
  26. package/lib/lib/collapseDuplicateDeclarations.js +60 -4
  27. package/lib/lib/content.js +181 -0
  28. package/lib/lib/defaultExtractor.js +243 -0
  29. package/lib/lib/detectNesting.js +21 -10
  30. package/lib/lib/evaluateTailwindFunctions.js +115 -50
  31. package/lib/lib/expandApplyAtRules.js +467 -161
  32. package/lib/lib/expandTailwindAtRules.js +160 -133
  33. package/lib/lib/findAtConfigPath.js +46 -0
  34. package/lib/lib/generateRules.js +553 -200
  35. package/lib/lib/getModuleDependencies.js +88 -37
  36. package/lib/lib/load-config.js +42 -0
  37. package/lib/lib/normalizeTailwindDirectives.js +46 -33
  38. package/lib/lib/offsets.js +306 -0
  39. package/lib/lib/partitionApplyAtRules.js +58 -0
  40. package/lib/lib/regex.js +74 -0
  41. package/lib/lib/remap-bitfield.js +89 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +98 -58
  43. package/lib/lib/setupContextUtils.js +773 -321
  44. package/lib/lib/setupTrackingContext.js +70 -75
  45. package/lib/lib/sharedState.js +78 -10
  46. package/lib/lib/substituteScreenAtRules.js +14 -10
  47. package/lib/oxide/cli/build/deps.js +89 -0
  48. package/lib/oxide/cli/build/index.js +53 -0
  49. package/lib/oxide/cli/build/plugin.js +375 -0
  50. package/lib/oxide/cli/build/utils.js +87 -0
  51. package/lib/oxide/cli/build/watching.js +179 -0
  52. package/lib/oxide/cli/help/index.js +72 -0
  53. package/lib/oxide/cli/index.js +214 -0
  54. package/lib/oxide/cli/init/index.js +52 -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 +21 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +89 -0
  61. package/lib/processTailwindFeatures.js +39 -26
  62. package/lib/public/colors.js +272 -246
  63. package/lib/public/create-plugin.js +9 -5
  64. package/lib/public/default-config.js +10 -6
  65. package/lib/public/default-theme.js +10 -6
  66. package/lib/public/load-config.js +12 -0
  67. package/lib/public/resolve-config.js +11 -6
  68. package/lib/util/applyImportantSelector.js +36 -0
  69. package/lib/util/bigSign.js +6 -1
  70. package/lib/util/buildMediaQuery.js +13 -6
  71. package/lib/util/cloneDeep.js +9 -6
  72. package/lib/util/cloneNodes.js +23 -3
  73. package/lib/util/color.js +70 -38
  74. package/lib/util/colorNames.js +752 -0
  75. package/lib/util/configurePlugins.js +7 -2
  76. package/lib/util/createPlugin.js +8 -6
  77. package/lib/util/createUtilityPlugin.js +16 -16
  78. package/lib/util/dataTypes.js +173 -108
  79. package/lib/util/defaults.js +14 -3
  80. package/lib/util/escapeClassName.js +13 -8
  81. package/lib/util/escapeCommas.js +7 -2
  82. package/lib/util/flattenColorPalette.js +11 -12
  83. package/lib/util/formatVariantSelector.js +228 -151
  84. package/lib/util/getAllConfigs.js +33 -12
  85. package/lib/util/hashConfig.js +9 -4
  86. package/lib/util/isKeyframeRule.js +7 -2
  87. package/lib/util/isPlainObject.js +7 -2
  88. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  89. package/lib/util/log.js +27 -13
  90. package/lib/util/nameClass.js +27 -10
  91. package/lib/util/negateValue.js +25 -8
  92. package/lib/util/normalizeConfig.js +139 -65
  93. package/lib/util/normalizeScreens.js +131 -11
  94. package/lib/util/parseAnimationValue.js +44 -40
  95. package/lib/util/parseBoxShadowValue.js +34 -23
  96. package/lib/util/parseDependency.js +39 -55
  97. package/lib/util/parseGlob.js +36 -0
  98. package/lib/util/parseObjectStyles.js +15 -10
  99. package/lib/util/pluginUtils.js +159 -69
  100. package/lib/util/prefixSelector.js +30 -12
  101. package/lib/util/pseudoElements.js +229 -0
  102. package/lib/util/removeAlphaVariables.js +31 -0
  103. package/lib/util/resolveConfig.js +97 -75
  104. package/lib/util/resolveConfigPath.js +30 -12
  105. package/lib/util/responsive.js +11 -6
  106. package/lib/util/splitAtTopLevelOnly.js +51 -0
  107. package/lib/util/tap.js +6 -1
  108. package/lib/util/toColorValue.js +7 -3
  109. package/lib/util/toPath.js +26 -3
  110. package/lib/util/transformThemeValue.js +40 -30
  111. package/lib/util/validateConfig.js +37 -0
  112. package/lib/util/validateFormalSyntax.js +26 -0
  113. package/lib/util/withAlphaVariable.js +27 -15
  114. package/loadConfig.d.ts +4 -0
  115. package/loadConfig.js +2 -0
  116. package/nesting/index.js +2 -12
  117. package/package.json +66 -57
  118. package/peers/index.js +75964 -55560
  119. package/plugin.d.ts +11 -0
  120. package/plugin.js +2 -1
  121. package/resolveConfig.d.ts +12 -0
  122. package/resolveConfig.js +2 -1
  123. package/scripts/generate-types.js +105 -0
  124. package/scripts/release-channel.js +18 -0
  125. package/scripts/release-notes.js +21 -0
  126. package/scripts/swap-engines.js +40 -0
  127. package/scripts/type-utils.js +27 -0
  128. package/src/cli/build/deps.js +56 -0
  129. package/src/cli/build/index.js +49 -0
  130. package/src/cli/build/plugin.js +444 -0
  131. package/src/cli/build/utils.js +76 -0
  132. package/src/cli/build/watching.js +229 -0
  133. package/src/cli/help/index.js +70 -0
  134. package/src/cli/index.js +216 -0
  135. package/src/cli/init/index.js +79 -0
  136. package/src/cli-peer-dependencies.js +7 -1
  137. package/src/cli.js +4 -765
  138. package/src/corePluginList.js +1 -1
  139. package/src/corePlugins.js +786 -306
  140. package/src/css/preflight.css +10 -8
  141. package/src/featureFlags.js +21 -5
  142. package/src/index.js +1 -34
  143. package/src/lib/cacheInvalidation.js +52 -0
  144. package/src/lib/collapseAdjacentRules.js +21 -2
  145. package/src/lib/collapseDuplicateDeclarations.js +66 -1
  146. package/src/lib/content.js +208 -0
  147. package/src/lib/defaultExtractor.js +217 -0
  148. package/src/lib/detectNesting.js +9 -1
  149. package/src/lib/evaluateTailwindFunctions.js +79 -8
  150. package/src/lib/expandApplyAtRules.js +515 -153
  151. package/src/lib/expandTailwindAtRules.js +115 -86
  152. package/src/lib/findAtConfigPath.js +48 -0
  153. package/src/lib/generateRules.js +545 -147
  154. package/src/lib/getModuleDependencies.js +70 -30
  155. package/src/lib/load-config.ts +31 -0
  156. package/src/lib/normalizeTailwindDirectives.js +7 -1
  157. package/src/lib/offsets.js +373 -0
  158. package/src/lib/partitionApplyAtRules.js +52 -0
  159. package/src/lib/regex.js +74 -0
  160. package/src/lib/remap-bitfield.js +82 -0
  161. package/src/lib/resolveDefaultsAtRules.js +59 -17
  162. package/src/lib/setupContextUtils.js +701 -175
  163. package/src/lib/setupTrackingContext.js +51 -62
  164. package/src/lib/sharedState.js +58 -7
  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 +12 -2
  180. package/src/public/colors.js +22 -0
  181. package/src/public/default-config.js +1 -1
  182. package/src/public/default-theme.js +2 -2
  183. package/src/public/load-config.js +2 -0
  184. package/src/util/applyImportantSelector.js +27 -0
  185. package/src/util/buildMediaQuery.js +5 -3
  186. package/src/util/cloneNodes.js +19 -2
  187. package/src/util/color.js +44 -12
  188. package/src/util/colorNames.js +150 -0
  189. package/src/util/dataTypes.js +51 -16
  190. package/src/util/defaults.js +6 -0
  191. package/src/util/formatVariantSelector.js +264 -144
  192. package/src/util/getAllConfigs.js +21 -2
  193. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  194. package/src/util/log.js +11 -7
  195. package/src/util/nameClass.js +4 -0
  196. package/src/util/negateValue.js +11 -3
  197. package/src/util/normalizeConfig.js +57 -5
  198. package/src/util/normalizeScreens.js +105 -7
  199. package/src/util/parseBoxShadowValue.js +4 -3
  200. package/src/util/parseDependency.js +37 -42
  201. package/src/util/parseGlob.js +24 -0
  202. package/src/util/pluginUtils.js +123 -24
  203. package/src/util/prefixSelector.js +30 -10
  204. package/src/util/pseudoElements.js +170 -0
  205. package/src/util/removeAlphaVariables.js +24 -0
  206. package/src/util/resolveConfig.js +74 -26
  207. package/src/util/resolveConfigPath.js +12 -1
  208. package/src/util/splitAtTopLevelOnly.js +52 -0
  209. package/src/util/toPath.js +23 -1
  210. package/src/util/transformThemeValue.js +13 -3
  211. package/src/util/validateConfig.js +26 -0
  212. package/src/util/validateFormalSyntax.js +34 -0
  213. package/src/util/withAlphaVariable.js +1 -1
  214. package/stubs/.gitignore +1 -0
  215. package/stubs/.prettierrc.json +6 -0
  216. package/stubs/{defaultConfig.stub.js → config.full.js} +206 -166
  217. package/stubs/postcss.config.js +6 -0
  218. package/stubs/tailwind.config.cjs +2 -0
  219. package/stubs/tailwind.config.js +2 -0
  220. package/stubs/tailwind.config.ts +3 -0
  221. package/types/config.d.ts +368 -0
  222. package/types/generated/.gitkeep +0 -0
  223. package/types/generated/colors.d.ts +298 -0
  224. package/types/generated/corePluginList.d.ts +1 -0
  225. package/types/generated/default-theme.d.ts +371 -0
  226. package/types/index.d.ts +7 -0
  227. package/CHANGELOG.md +0 -1843
  228. package/lib/constants.js +0 -37
  229. package/lib/lib/setupWatchingContext.js +0 -288
  230. package/nesting/plugin.js +0 -41
  231. package/scripts/install-integrations.js +0 -27
  232. package/scripts/rebuildFixtures.js +0 -68
  233. package/src/constants.js +0 -17
  234. package/src/lib/setupWatchingContext.js +0 -311
  235. /package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -0
  236. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -2,25 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = resolveConfig;
6
- var _negateValue = _interopRequireDefault(require("./negateValue"));
7
- var _corePluginList = _interopRequireDefault(require("../corePluginList"));
8
- var _configurePlugins = _interopRequireDefault(require("./configurePlugins"));
9
- var _defaultConfigStub = _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
10
- var _colors = _interopRequireDefault(require("../public/colors"));
11
- var _defaults = require("./defaults");
12
- var _toPath = require("./toPath");
13
- var _normalizeConfig = require("./normalizeConfig");
14
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return resolveConfig;
9
+ }
10
+ });
11
+ const _negateValue = /*#__PURE__*/ _interop_require_default(require("./negateValue"));
12
+ const _corePluginList = /*#__PURE__*/ _interop_require_default(require("../corePluginList"));
13
+ const _configurePlugins = /*#__PURE__*/ _interop_require_default(require("./configurePlugins"));
14
+ const _colors = /*#__PURE__*/ _interop_require_default(require("../public/colors"));
15
+ const _defaults = require("./defaults");
16
+ const _toPath = require("./toPath");
17
+ const _normalizeConfig = require("./normalizeConfig");
18
+ const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("./isPlainObject"));
19
+ const _cloneDeep = require("./cloneDeep");
20
+ const _pluginUtils = require("./pluginUtils");
21
+ const _withAlphaVariable = require("./withAlphaVariable");
22
+ const _toColorValue = /*#__PURE__*/ _interop_require_default(require("./toColorValue"));
23
+ function _interop_require_default(obj) {
15
24
  return obj && obj.__esModule ? obj : {
16
25
  default: obj
17
26
  };
18
27
  }
19
28
  function isFunction(input) {
20
- return typeof input === 'function';
21
- }
22
- function isObject(input) {
23
- return typeof input === 'object' && input !== null;
29
+ return typeof input === "function";
24
30
  }
25
31
  function mergeWith(target, ...sources) {
26
32
  let customizer = sources.pop();
@@ -28,8 +34,8 @@ function mergeWith(target, ...sources) {
28
34
  for(let k in source){
29
35
  let merged = customizer(target[k], source[k]);
30
36
  if (merged === undefined) {
31
- if (isObject(target[k]) && isObject(source[k])) {
32
- target[k] = mergeWith(target[k], source[k], customizer);
37
+ if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
38
+ target[k] = mergeWith({}, target[k], source[k], customizer);
33
39
  } else {
34
40
  target[k] = source[k];
35
41
  }
@@ -44,27 +50,22 @@ const configUtils = {
44
50
  colors: _colors.default,
45
51
  negative (scale) {
46
52
  // TODO: Log that this function isn't really needed anymore?
47
- return Object.keys(scale).filter((key)=>scale[key] !== '0'
48
- ).reduce((negativeScale, key)=>{
49
- let negativeValue = (0, _negateValue).default(scale[key]);
53
+ return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
54
+ let negativeValue = (0, _negateValue.default)(scale[key]);
50
55
  if (negativeValue !== undefined) {
51
56
  negativeScale[`-${key}`] = negativeValue;
52
57
  }
53
58
  return negativeScale;
54
- }, {
55
- });
59
+ }, {});
56
60
  },
57
61
  breakpoints (screens) {
58
- return Object.keys(screens).filter((key)=>typeof screens[key] === 'string'
59
- ).reduce((breakpoints, key)=>({
62
+ return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
60
63
  ...breakpoints,
61
64
  [`screen-${key}`]: screens[key]
62
- })
63
- , {
64
- });
65
+ }), {});
65
66
  }
66
67
  };
67
- function value1(valueToResolve, ...args) {
68
+ function value(valueToResolve, ...args) {
68
69
  return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
69
70
  }
70
71
  function collectExtends(items) {
@@ -86,14 +87,11 @@ function collectExtends(items) {
86
87
  mergedValue
87
88
  ];
88
89
  });
89
- }, {
90
- });
90
+ }, {});
91
91
  }
92
92
  function mergeThemes(themes) {
93
93
  return {
94
- ...themes.reduce((merged, theme)=>(0, _defaults).defaults(merged, theme)
95
- , {
96
- }),
94
+ ...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
97
95
  // In order to resolve n config objects, we combine all of their `extend` properties
98
96
  // into arrays instead of objects so they aren't overridden.
99
97
  extend: collectExtends(themes)
@@ -101,11 +99,11 @@ function mergeThemes(themes) {
101
99
  }
102
100
  function mergeExtensionCustomizer(merged, value) {
103
101
  // When we have an array of objects, we do want to merge it
104
- if (Array.isArray(merged) && isObject(merged[0])) {
102
+ if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
105
103
  return merged.concat(value);
106
104
  }
107
105
  // When the incoming value is an array, and the existing config is an object, prepend the existing object
108
- if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
106
+ if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
109
107
  return [
110
108
  merged,
111
109
  ...value
@@ -122,40 +120,68 @@ function mergeExtensions({ extend , ...theme }) {
122
120
  return mergeWith(theme, extend, (themeValue, extensions)=>{
123
121
  // The `extend` property is an array, so we need to check if it contains any functions
124
122
  if (!isFunction(themeValue) && !extensions.some(isFunction)) {
125
- return mergeWith({
126
- }, themeValue, ...extensions, mergeExtensionCustomizer);
123
+ return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
127
124
  }
128
- return (resolveThemePath, utils)=>mergeWith({
129
- }, ...[
125
+ return (resolveThemePath, utils)=>mergeWith({}, ...[
130
126
  themeValue,
131
127
  ...extensions
132
- ].map((e)=>value1(e, resolveThemePath, utils)
133
- ), mergeExtensionCustomizer)
134
- ;
128
+ ].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
135
129
  });
136
130
  }
131
+ /**
132
+ *
133
+ * @param {string} key
134
+ * @return {Iterable<string[] & {alpha: string | undefined}>}
135
+ */ function* toPaths(key) {
136
+ let path = (0, _toPath.toPath)(key);
137
+ if (path.length === 0) {
138
+ return;
139
+ }
140
+ yield path;
141
+ if (Array.isArray(key)) {
142
+ return;
143
+ }
144
+ let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
145
+ let matches = key.match(pattern);
146
+ if (matches !== null) {
147
+ let [, prefix, alpha] = matches;
148
+ let newPath = (0, _toPath.toPath)(prefix);
149
+ newPath.alpha = alpha;
150
+ yield newPath;
151
+ }
152
+ }
137
153
  function resolveFunctionKeys(object) {
154
+ // theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
138
155
  const resolvePath = (key, defaultValue)=>{
139
- const path = (0, _toPath).toPath(key);
140
- let index = 0;
141
- let val = object;
142
- while(val !== undefined && val !== null && index < path.length){
143
- val = val[path[index++]];
144
- val = isFunction(val) ? val(resolvePath, configUtils) : val;
156
+ for (const path of toPaths(key)){
157
+ let index = 0;
158
+ let val = object;
159
+ while(val !== undefined && val !== null && index < path.length){
160
+ val = val[path[index++]];
161
+ let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
162
+ val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
163
+ }
164
+ if (val !== undefined) {
165
+ if (path.alpha !== undefined) {
166
+ let normalized = (0, _pluginUtils.parseColorFormat)(val);
167
+ return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
168
+ }
169
+ if ((0, _isPlainObject.default)(val)) {
170
+ return (0, _cloneDeep.cloneDeep)(val);
171
+ }
172
+ return val;
173
+ }
145
174
  }
146
- return val === undefined ? defaultValue : val;
175
+ return defaultValue;
147
176
  };
148
- resolvePath.theme = resolvePath;
149
- for(let key1 in configUtils){
150
- resolvePath[key1] = configUtils[key1];
151
- }
152
- return Object.keys(object).reduce((resolved, key)=>{
153
- return {
154
- ...resolved,
155
- [key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
156
- };
157
- }, {
177
+ Object.assign(resolvePath, {
178
+ theme: resolvePath,
179
+ ...configUtils
158
180
  });
181
+ return Object.keys(object).reduce((resolved, key)=>{
182
+ resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
183
+ return resolved;
184
+ }, {});
159
185
  }
160
186
  function extractPluginConfigs(configs) {
161
187
  let allConfigs = [];
@@ -164,8 +190,8 @@ function extractPluginConfigs(configs) {
164
190
  ...allConfigs,
165
191
  config
166
192
  ];
167
- var ref1;
168
- const plugins = (ref1 = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref1 !== void 0 ? ref1 : [];
193
+ var _config_plugins;
194
+ const plugins = (_config_plugins = config === null || config === void 0 ? void 0 : config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [];
169
195
  if (plugins.length === 0) {
170
196
  return;
171
197
  }
@@ -173,12 +199,11 @@ function extractPluginConfigs(configs) {
173
199
  if (plugin.__isOptionsFunction) {
174
200
  plugin = plugin();
175
201
  }
176
- var ref;
202
+ var _plugin_config;
177
203
  allConfigs = [
178
204
  ...allConfigs,
179
205
  ...extractPluginConfigs([
180
- (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
181
- }
206
+ (_plugin_config = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && _plugin_config !== void 0 ? _plugin_config : {}
182
207
  ])
183
208
  ];
184
209
  });
@@ -194,7 +219,7 @@ function resolveCorePlugins(corePluginConfigs) {
194
219
  corePlugins: resolved
195
220
  });
196
221
  }
197
- return (0, _configurePlugins).default(corePluginConfig, resolved);
222
+ return (0, _configurePlugins.default)(corePluginConfig, resolved);
198
223
  }, _corePluginList.default);
199
224
  return result;
200
225
  }
@@ -213,22 +238,19 @@ function resolveConfig(configs) {
213
238
  let allConfigs = [
214
239
  ...extractPluginConfigs(configs),
215
240
  {
216
- prefix: '',
241
+ prefix: "",
217
242
  important: false,
218
- separator: ':',
219
- variantOrder: _defaultConfigStub.default.variantOrder
220
- },
243
+ separator: ":"
244
+ }
221
245
  ];
222
- var ref, ref2;
223
- return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
246
+ var _t_theme, _c_plugins;
247
+ return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
224
248
  theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
225
- return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
226
- };
249
+ return (_t_theme = t === null || t === void 0 ? void 0 : t.theme) !== null && _t_theme !== void 0 ? _t_theme : {};
227
250
  })))),
228
- corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
229
- )),
251
+ corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
230
252
  plugins: resolvePluginLists(configs.map((c)=>{
231
- return (ref2 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref2 !== void 0 ? ref2 : [];
253
+ return (_c_plugins = c === null || c === void 0 ? void 0 : c.plugins) !== null && _c_plugins !== void 0 ? _c_plugins : [];
232
254
  }))
233
255
  }, ...allConfigs));
234
256
  }
@@ -2,22 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = resolveConfigPath;
6
- var _fs = _interopRequireDefault(require("fs"));
7
- var _path = _interopRequireDefault(require("path"));
8
- function _interopRequireDefault(obj) {
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
+ default: function() {
13
+ return resolveConfigPath;
14
+ },
15
+ resolveDefaultConfigPath: function() {
16
+ return resolveDefaultConfigPath;
17
+ }
18
+ });
19
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
20
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
21
+ function _interop_require_default(obj) {
9
22
  return obj && obj.__esModule ? obj : {
10
23
  default: obj
11
24
  };
12
25
  }
26
+ const defaultConfigFiles = [
27
+ "./tailwind.config.js",
28
+ "./tailwind.config.cjs",
29
+ "./tailwind.config.mjs",
30
+ "./tailwind.config.ts"
31
+ ];
13
32
  function isObject(value) {
14
- return typeof value === 'object' && value !== null;
33
+ return typeof value === "object" && value !== null;
15
34
  }
16
35
  function isEmpty(obj) {
17
36
  return Object.keys(obj).length === 0;
18
37
  }
19
38
  function isString(value) {
20
- return typeof value === 'string' || value instanceof String;
39
+ return typeof value === "string" || value instanceof String;
21
40
  }
22
41
  function resolveConfigPath(pathOrConfig) {
23
42
  // require('tailwindcss')({ theme: ..., variants: ... })
@@ -37,16 +56,15 @@ function resolveConfigPath(pathOrConfig) {
37
56
  return _path.default.resolve(pathOrConfig);
38
57
  }
39
58
  // require('tailwindcss')
40
- for (const configFile of [
41
- './tailwind.config.js',
42
- './tailwind.config.cjs'
43
- ]){
59
+ return resolveDefaultConfigPath();
60
+ }
61
+ function resolveDefaultConfigPath() {
62
+ for (const configFile of defaultConfigFiles){
44
63
  try {
45
64
  const configPath = _path.default.resolve(configFile);
46
65
  _fs.default.accessSync(configPath);
47
66
  return configPath;
48
- } catch (err) {
49
- }
67
+ } catch (err) {}
50
68
  }
51
69
  return null;
52
70
  }
@@ -2,18 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = responsive;
6
- var _postcss = _interopRequireDefault(require("postcss"));
7
- var _cloneNodes = _interopRequireDefault(require("./cloneNodes"));
8
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return responsive;
9
+ }
10
+ });
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("./cloneNodes"));
13
+ function _interop_require_default(obj) {
9
14
  return obj && obj.__esModule ? obj : {
10
15
  default: obj
11
16
  };
12
17
  }
13
18
  function responsive(rules) {
14
19
  return _postcss.default.atRule({
15
- name: 'responsive'
16
- }).append((0, _cloneNodes).default(Array.isArray(rules) ? rules : [
20
+ name: "responsive"
21
+ }).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [
17
22
  rules
18
23
  ]));
19
24
  }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This splits a string on a top-level character.
3
+ *
4
+ * Regex doesn't support recursion (at least not the JS-flavored version).
5
+ * So we have to use a tiny state machine to keep track of paren placement.
6
+ *
7
+ * Expected behavior using commas:
8
+ * var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
9
+ * ─┬─ ┬ ┬ ┬
10
+ * x x x ╰──────── Split because top-level
11
+ * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
12
+ *
13
+ * @param {string} input
14
+ * @param {string} separator
15
+ */ "use strict";
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ Object.defineProperty(exports, "splitAtTopLevelOnly", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return splitAtTopLevelOnly;
23
+ }
24
+ });
25
+ function splitAtTopLevelOnly(input, separator) {
26
+ let stack = [];
27
+ let parts = [];
28
+ let lastPos = 0;
29
+ let isEscaped = false;
30
+ for(let idx = 0; idx < input.length; idx++){
31
+ let char = input[idx];
32
+ if (stack.length === 0 && char === separator[0] && !isEscaped) {
33
+ if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
34
+ parts.push(input.slice(lastPos, idx));
35
+ lastPos = idx + separator.length;
36
+ }
37
+ }
38
+ if (isEscaped) {
39
+ isEscaped = false;
40
+ } else if (char === "\\") {
41
+ isEscaped = true;
42
+ }
43
+ if (char === "(" || char === "[" || char === "{") {
44
+ stack.push(char);
45
+ } else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
46
+ stack.pop();
47
+ }
48
+ }
49
+ parts.push(input.slice(lastPos));
50
+ return parts;
51
+ }
package/lib/util/tap.js CHANGED
@@ -2,7 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.tap = tap;
5
+ Object.defineProperty(exports, "tap", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return tap;
9
+ }
10
+ });
6
11
  function tap(value, mutator) {
7
12
  mutator(value);
8
13
  return value;
@@ -2,8 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = toColorValue;
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return toColorValue;
9
+ }
10
+ });
6
11
  function toColorValue(maybeFunction) {
7
- return typeof maybeFunction === 'function' ? maybeFunction({
8
- }) : maybeFunction;
12
+ return typeof maybeFunction === "function" ? maybeFunction({}) : maybeFunction;
9
13
  }
@@ -1,9 +1,32 @@
1
- "use strict";
1
+ /**
2
+ * Parse a path string into an array of path segments.
3
+ *
4
+ * Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
5
+ *
6
+ * Example:
7
+ * a -> ['a']
8
+ * a.b.c -> ['a', 'b', 'c']
9
+ * a[b].c -> ['a', 'b', 'c']
10
+ * a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
11
+ * a[b][c][d] -> ['a', 'b', 'c', 'd']
12
+ *
13
+ * @param {string|string[]} path
14
+ **/ "use strict";
2
15
  Object.defineProperty(exports, "__esModule", {
3
16
  value: true
4
17
  });
5
- exports.toPath = toPath;
18
+ Object.defineProperty(exports, "toPath", {
19
+ enumerable: true,
20
+ get: function() {
21
+ return toPath;
22
+ }
23
+ });
6
24
  function toPath(path) {
7
25
  if (Array.isArray(path)) return path;
8
- return path.split(/[\.\]\[]+/g);
26
+ let openBrackets = path.split("[").length - 1;
27
+ let closedBrackets = path.split("]").length - 1;
28
+ if (openBrackets !== closedBrackets) {
29
+ throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
30
+ }
31
+ return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
9
32
  }
@@ -2,62 +2,72 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = transformThemeValue;
6
- var _postcss = _interopRequireDefault(require("postcss"));
7
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return transformThemeValue;
9
+ }
10
+ });
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("./isPlainObject"));
13
+ function _interop_require_default(obj) {
8
14
  return obj && obj.__esModule ? obj : {
9
15
  default: obj
10
16
  };
11
17
  }
12
18
  function transformThemeValue(themeSection) {
13
19
  if ([
14
- 'fontSize',
15
- 'outline'
20
+ "fontSize",
21
+ "outline"
16
22
  ].includes(themeSection)) {
17
23
  return (value)=>{
18
- if (typeof value === 'function') value = value({
19
- });
24
+ if (typeof value === "function") value = value({});
20
25
  if (Array.isArray(value)) value = value[0];
21
26
  return value;
22
27
  };
23
28
  }
29
+ if (themeSection === "fontFamily") {
30
+ return (value)=>{
31
+ if (typeof value === "function") value = value({});
32
+ let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
33
+ return Array.isArray(families) ? families.join(", ") : families;
34
+ };
35
+ }
24
36
  if ([
25
- 'fontFamily',
26
- 'boxShadow',
27
- 'transitionProperty',
28
- 'transitionDuration',
29
- 'transitionDelay',
30
- 'transitionTimingFunction',
31
- 'backgroundImage',
32
- 'backgroundSize',
33
- 'backgroundColor',
34
- 'cursor',
35
- 'animation',
37
+ "boxShadow",
38
+ "transitionProperty",
39
+ "transitionDuration",
40
+ "transitionDelay",
41
+ "transitionTimingFunction",
42
+ "backgroundImage",
43
+ "backgroundSize",
44
+ "backgroundColor",
45
+ "cursor",
46
+ "animation"
36
47
  ].includes(themeSection)) {
37
48
  return (value)=>{
38
- if (typeof value === 'function') value = value({
39
- });
40
- if (Array.isArray(value)) value = value.join(', ');
49
+ if (typeof value === "function") value = value({});
50
+ if (Array.isArray(value)) value = value.join(", ");
41
51
  return value;
42
52
  };
43
53
  }
44
54
  // For backwards compatibility reasons, before we switched to underscores
45
55
  // instead of commas for arbitrary values.
46
56
  if ([
47
- 'gridTemplateColumns',
48
- 'gridTemplateRows',
49
- 'objectPosition'
57
+ "gridTemplateColumns",
58
+ "gridTemplateRows",
59
+ "objectPosition"
50
60
  ].includes(themeSection)) {
51
61
  return (value)=>{
52
- if (typeof value === 'function') value = value({
53
- });
54
- if (typeof value === 'string') value = _postcss.default.list.comma(value).join(' ');
62
+ if (typeof value === "function") value = value({});
63
+ if (typeof value === "string") value = _postcss.default.list.comma(value).join(" ");
55
64
  return value;
56
65
  };
57
66
  }
58
- return (value)=>{
59
- if (typeof value === 'function') value = value({
60
- });
67
+ return (value, opts = {})=>{
68
+ if (typeof value === "function") {
69
+ value = value(opts);
70
+ }
61
71
  return value;
62
72
  };
63
73
  }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "validateConfig", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return validateConfig;
9
+ }
10
+ });
11
+ const _log = /*#__PURE__*/ _interop_require_default(require("./log"));
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function validateConfig(config) {
18
+ if (config.content.files.length === 0) {
19
+ _log.default.warn("content-problems", [
20
+ "The `content` option in your Tailwind CSS configuration is missing or empty.",
21
+ "Configure your content sources or your generated CSS will be missing styles.",
22
+ "https://tailwindcss.com/docs/content-configuration"
23
+ ]);
24
+ }
25
+ // Warn if the line-clamp plugin is installed
26
+ try {
27
+ let plugin = require("@tailwindcss/line-clamp");
28
+ if (config.plugins.includes(plugin)) {
29
+ _log.default.warn("line-clamp-in-core", [
30
+ "As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.",
31
+ "Remove it from the `plugins` array in your configuration to eliminate this warning."
32
+ ]);
33
+ config.plugins = config.plugins.filter((p)=>p !== plugin);
34
+ }
35
+ } catch {}
36
+ return config;
37
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "backgroundSize", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return backgroundSize;
9
+ }
10
+ });
11
+ const _dataTypes = require("./dataTypes");
12
+ const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
13
+ function backgroundSize(value) {
14
+ let keywordValues = [
15
+ "cover",
16
+ "contain"
17
+ ];
18
+ // the <length-percentage> type will probably be a css function
19
+ // so we have to use `splitAtTopLevelOnly`
20
+ return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
21
+ let sizes = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(part, "_").filter(Boolean);
22
+ if (sizes.length === 1 && keywordValues.includes(sizes[0])) return true;
23
+ if (sizes.length !== 1 && sizes.length !== 2) return false;
24
+ return sizes.every((size)=>(0, _dataTypes.length)(size) || (0, _dataTypes.percentage)(size) || size === "auto");
25
+ });
26
+ }