tailwindcss 0.0.0-insiders.d6301bd → 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 (48) hide show
  1. package/CHANGELOG.md +39 -3
  2. package/lib/cli.js +60 -60
  3. package/lib/constants.js +1 -1
  4. package/lib/corePluginList.js +4 -0
  5. package/lib/corePlugins.js +157 -54
  6. package/lib/css/preflight.css +2 -1
  7. package/lib/featureFlags.js +3 -3
  8. package/lib/lib/collapseDuplicateDeclarations.js +2 -2
  9. package/lib/lib/detectNesting.js +17 -2
  10. package/lib/lib/evaluateTailwindFunctions.js +9 -5
  11. package/lib/lib/expandApplyAtRules.js +7 -7
  12. package/lib/lib/expandTailwindAtRules.js +2 -0
  13. package/lib/lib/generateRules.js +46 -10
  14. package/lib/lib/resolveDefaultsAtRules.js +2 -2
  15. package/lib/lib/setupContextUtils.js +15 -72
  16. package/lib/lib/sharedState.js +1 -1
  17. package/lib/lib/substituteScreenAtRules.js +7 -4
  18. package/lib/util/buildMediaQuery.js +13 -24
  19. package/lib/util/createUtilityPlugin.js +2 -2
  20. package/lib/util/dataTypes.js +23 -3
  21. package/lib/util/formatVariantSelector.js +93 -9
  22. package/lib/util/isValidArbitraryValue.js +64 -0
  23. package/lib/util/nameClass.js +1 -0
  24. package/lib/util/normalizeConfig.js +7 -7
  25. package/lib/util/normalizeScreens.js +58 -0
  26. package/lib/util/parseBoxShadowValue.js +77 -0
  27. package/lib/util/pluginUtils.js +12 -11
  28. package/lib/util/resolveConfig.js +8 -8
  29. package/package.json +10 -10
  30. package/peers/index.js +3772 -3072
  31. package/src/corePluginList.js +1 -1
  32. package/src/corePlugins.js +143 -61
  33. package/src/css/preflight.css +2 -1
  34. package/src/lib/detectNesting.js +22 -3
  35. package/src/lib/evaluateTailwindFunctions.js +5 -2
  36. package/src/lib/expandTailwindAtRules.js +2 -0
  37. package/src/lib/generateRules.js +34 -0
  38. package/src/lib/setupContextUtils.js +6 -58
  39. package/src/lib/substituteScreenAtRules.js +6 -3
  40. package/src/util/buildMediaQuery.js +14 -18
  41. package/src/util/dataTypes.js +19 -3
  42. package/src/util/formatVariantSelector.js +92 -1
  43. package/src/util/isValidArbitraryValue.js +61 -0
  44. package/src/util/nameClass.js +1 -1
  45. package/src/util/normalizeScreens.js +42 -0
  46. package/src/util/parseBoxShadowValue.js +71 -0
  47. package/src/util/pluginUtils.js +2 -0
  48. package/stubs/defaultConfig.stub.js +25 -9
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.parseBoxShadowValue = parseBoxShadowValue;
6
+ exports.formatBoxShadowValue = formatBoxShadowValue;
7
+ let KEYWORDS = new Set([
8
+ 'inset',
9
+ 'inherit',
10
+ 'initial',
11
+ 'revert',
12
+ 'unset'
13
+ ]);
14
+ let COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
15
+ ;
16
+ let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
17
+ ;
18
+ let LENGTH = /^-?(\d+)(.*?)$/g;
19
+ function parseBoxShadowValue(input) {
20
+ let shadows = input.split(COMMA);
21
+ return shadows.map((shadow)=>{
22
+ let value = shadow.trim();
23
+ let result = {
24
+ raw: value
25
+ };
26
+ let parts = value.split(SPACE);
27
+ let seen = new Set();
28
+ for (let part of parts){
29
+ // Reset index, since the regex is stateful.
30
+ LENGTH.lastIndex = 0;
31
+ // Keyword
32
+ if (!seen.has('KEYWORD') && KEYWORDS.has(part)) {
33
+ result.keyword = part;
34
+ seen.add('KEYWORD');
35
+ } else if (LENGTH.test(part)) {
36
+ if (!seen.has('X')) {
37
+ result.x = part;
38
+ seen.add('X');
39
+ } else if (!seen.has('Y')) {
40
+ result.y = part;
41
+ seen.add('Y');
42
+ } else if (!seen.has('BLUR')) {
43
+ result.blur = part;
44
+ seen.add('BLUR');
45
+ } else if (!seen.has('SPREAD')) {
46
+ result.spread = part;
47
+ seen.add('SPREAD');
48
+ }
49
+ } else {
50
+ if (!result.color) {
51
+ result.color = part;
52
+ } else {
53
+ if (!result.unknown) result.unknown = [];
54
+ result.unknown.push(part);
55
+ }
56
+ }
57
+ }
58
+ // Check if valid
59
+ result.valid = result.x !== undefined && result.y !== undefined;
60
+ return result;
61
+ });
62
+ }
63
+ function formatBoxShadowValue(shadows) {
64
+ return shadows.map((shadow)=>{
65
+ if (!shadow.valid) {
66
+ return shadow.raw;
67
+ }
68
+ return [
69
+ shadow.keyword,
70
+ shadow.x,
71
+ shadow.y,
72
+ shadow.blur,
73
+ shadow.spread,
74
+ shadow.color
75
+ ].filter(Boolean).join(' ');
76
+ }).join(', ');
77
+ }
@@ -17,7 +17,7 @@ function _interopRequireDefault(obj) {
17
17
  default: obj
18
18
  };
19
19
  }
20
- function updateAllClasses(selectors, updateClass) {
20
+ function updateAllClasses(selectors1, updateClass) {
21
21
  let parser = (0, _postcssSelectorParser).default((selectors)=>{
22
22
  selectors.walkClasses((sel)=>{
23
23
  let updatedClass = updateClass(sel.value);
@@ -27,7 +27,7 @@ function updateAllClasses(selectors, updateClass) {
27
27
  }
28
28
  });
29
29
  });
30
- let result = parser.processSync(selectors);
30
+ let result = parser.processSync(selectors1);
31
31
  return result;
32
32
  }
33
33
  function resolveArbitraryValue(modifier, validate) {
@@ -87,23 +87,23 @@ function asColor(modifier, options = {
87
87
  }, { tailwindConfig ={
88
88
  } } = {
89
89
  }) {
90
- var ref7;
91
- if (((ref7 = options.values) === null || ref7 === void 0 ? void 0 : ref7[modifier]) !== undefined) {
92
- var ref;
93
- return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
90
+ var ref;
91
+ if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
92
+ var ref1;
93
+ return (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier];
94
94
  }
95
95
  let [color, alpha] = splitAlpha(modifier);
96
96
  if (alpha !== undefined) {
97
- var ref, ref1, ref2;
98
- var ref3;
99
- let normalizedColor = (ref3 = (ref = options.values) === null || ref === void 0 ? void 0 : ref[color]) !== null && ref3 !== void 0 ? ref3 : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
97
+ var ref2, ref3, ref4;
98
+ var ref5;
99
+ let normalizedColor = (ref5 = (ref2 = options.values) === null || ref2 === void 0 ? void 0 : ref2[color]) !== null && ref5 !== void 0 ? ref5 : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
100
100
  if (normalizedColor === undefined) {
101
101
  return undefined;
102
102
  }
103
103
  if (isArbitraryValue(alpha)) {
104
104
  return (0, _withAlphaVariable).withAlphaValue(normalizedColor, alpha.slice(1, -1));
105
105
  }
106
- if (((ref1 = tailwindConfig.theme) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.opacity) === null || ref2 === void 0 ? void 0 : ref2[alpha]) === undefined) {
106
+ if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
107
107
  return undefined;
108
108
  }
109
109
  return (0, _withAlphaVariable).withAlphaValue(normalizedColor, tailwindConfig.theme.opacity[alpha]);
@@ -138,7 +138,8 @@ let typeMap = {
138
138
  number: guess(_dataTypes.number),
139
139
  'line-width': guess(_dataTypes.lineWidth),
140
140
  'absolute-size': guess(_dataTypes.absoluteSize),
141
- 'relative-size': guess(_dataTypes.relativeSize)
141
+ 'relative-size': guess(_dataTypes.relativeSize),
142
+ shadow: guess(_dataTypes.shadow)
142
143
  };
143
144
  let supportedTypes = Object.keys(typeMap);
144
145
  function splitAtFirst(input, delim) {
@@ -64,7 +64,7 @@ const configUtils = {
64
64
  });
65
65
  }
66
66
  };
67
- function value(valueToResolve, ...args) {
67
+ function value1(valueToResolve, ...args) {
68
68
  return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
69
69
  }
70
70
  function collectExtends(items) {
@@ -129,7 +129,7 @@ function mergeExtensions({ extend , ...theme }) {
129
129
  }, ...[
130
130
  themeValue,
131
131
  ...extensions
132
- ].map((e)=>value(e, resolveThemePath, utils)
132
+ ].map((e)=>value1(e, resolveThemePath, utils)
133
133
  ), mergeExtensionCustomizer)
134
134
  ;
135
135
  });
@@ -146,8 +146,8 @@ function resolveFunctionKeys(object) {
146
146
  return val === undefined ? defaultValue : val;
147
147
  };
148
148
  resolvePath.theme = resolvePath;
149
- for(let key in configUtils){
150
- resolvePath[key] = configUtils[key];
149
+ for(let key1 in configUtils){
150
+ resolvePath[key1] = configUtils[key1];
151
151
  }
152
152
  return Object.keys(object).reduce((resolved, key)=>{
153
153
  return {
@@ -164,8 +164,8 @@ function extractPluginConfigs(configs) {
164
164
  ...allConfigs,
165
165
  config
166
166
  ];
167
- var ref;
168
- const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
167
+ var ref1;
168
+ const plugins = (ref1 = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref1 !== void 0 ? ref1 : [];
169
169
  if (plugins.length === 0) {
170
170
  return;
171
171
  }
@@ -219,7 +219,7 @@ function resolveConfig(configs) {
219
219
  variantOrder: _defaultConfigStub.default.variantOrder
220
220
  },
221
221
  ];
222
- var ref, ref1;
222
+ var ref, ref2;
223
223
  return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
224
224
  theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
225
225
  return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
@@ -228,7 +228,7 @@ function resolveConfig(configs) {
228
228
  corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
229
229
  )),
230
230
  plugins: resolvePluginLists(configs.map((c)=>{
231
- return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
231
+ return (ref2 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref2 !== void 0 ? ref2 : [];
232
232
  }))
233
233
  }, ...allConfigs));
234
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "0.0.0-insiders.d6301bd",
3
+ "version": "0.0.0-insiders.e2d5f21",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -43,22 +43,22 @@
43
43
  "*.js"
44
44
  ],
45
45
  "devDependencies": {
46
- "@swc/cli": "^0.1.51",
47
- "@swc/core": "^1.2.92",
46
+ "@swc/cli": "^0.1.52",
47
+ "@swc/core": "^1.2.106",
48
48
  "@swc/jest": "^0.1.5",
49
49
  "@swc/register": "^0.1.7",
50
- "autoprefixer": "^10.3.7",
50
+ "autoprefixer": "^10.4.0",
51
51
  "cross-env": "^7.0.3",
52
- "cssnano": "^5.0.8",
53
- "esbuild": "^0.13.4",
54
- "eslint": "^8.0.1",
52
+ "cssnano": "^5.0.12",
53
+ "esbuild": "^0.13.12",
54
+ "eslint": "^8.2.0",
55
55
  "eslint-config-prettier": "^8.3.0",
56
56
  "eslint-plugin-prettier": "^4.0.0",
57
57
  "jest": "^27.3.1",
58
58
  "jest-diff": "^27.2.5",
59
- "postcss": "^8.3.11",
59
+ "postcss": "^8.4.4",
60
60
  "postcss-cli": "^8.3.1",
61
- "prettier": "^2.4.1",
61
+ "prettier": "^2.5.0",
62
62
  "rimraf": "^3.0.0"
63
63
  },
64
64
  "peerDependencies": {
@@ -83,7 +83,7 @@
83
83
  "postcss-load-config": "^3.1.0",
84
84
  "postcss-nested": "5.0.6",
85
85
  "postcss-selector-parser": "^6.0.6",
86
- "postcss-value-parser": "^4.1.0",
86
+ "postcss-value-parser": "^4.2.0",
87
87
  "quick-lru": "^5.1.1",
88
88
  "resolve": "^1.20.0",
89
89
  "tmp": "^0.2.1"