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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +1 -1
  3. package/colors.js +1 -304
  4. package/defaultConfig.js +1 -4
  5. package/defaultTheme.js +1 -4
  6. package/lib/cli-peer-dependencies.js +4 -9
  7. package/lib/cli.js +646 -705
  8. package/lib/constants.js +15 -15
  9. package/lib/corePluginList.js +174 -4
  10. package/lib/corePlugins.js +3637 -2934
  11. package/lib/css/preflight.css +14 -1
  12. package/lib/featureFlags.js +44 -44
  13. package/lib/index.js +25 -24
  14. package/lib/lib/collapseAdjacentRules.js +33 -35
  15. package/lib/lib/collapseDuplicateDeclarations.js +29 -0
  16. package/lib/lib/detectNesting.js +34 -0
  17. package/lib/lib/evaluateTailwindFunctions.js +134 -155
  18. package/lib/lib/expandApplyAtRules.js +183 -200
  19. package/lib/lib/expandTailwindAtRules.js +219 -232
  20. package/lib/lib/generateRules.js +478 -311
  21. package/lib/lib/getModuleDependencies.js +36 -41
  22. package/lib/lib/normalizeTailwindDirectives.js +66 -58
  23. package/lib/lib/resolveDefaultsAtRules.js +110 -90
  24. package/lib/lib/setupContextUtils.js +740 -580
  25. package/lib/lib/setupTrackingContext.js +142 -162
  26. package/lib/lib/setupWatchingContext.js +235 -278
  27. package/lib/lib/sharedState.js +7 -17
  28. package/lib/lib/substituteScreenAtRules.js +22 -26
  29. package/lib/processTailwindFeatures.js +38 -44
  30. package/lib/public/colors.js +329 -0
  31. package/lib/public/create-plugin.js +13 -0
  32. package/lib/public/default-config.js +14 -0
  33. package/lib/public/default-theme.js +14 -0
  34. package/lib/public/resolve-config.js +19 -0
  35. package/lib/util/bigSign.js +3 -5
  36. package/lib/util/buildMediaQuery.js +15 -31
  37. package/lib/util/cloneDeep.js +14 -13
  38. package/lib/util/cloneNodes.js +9 -13
  39. package/lib/util/color.js +69 -59
  40. package/lib/util/configurePlugins.js +13 -14
  41. package/lib/util/createPlugin.js +21 -24
  42. package/lib/util/createUtilityPlugin.js +47 -45
  43. package/lib/util/dataTypes.js +231 -0
  44. package/lib/util/defaults.js +10 -14
  45. package/lib/util/escapeClassName.js +12 -14
  46. package/lib/util/escapeCommas.js +3 -5
  47. package/lib/util/flattenColorPalette.js +14 -10
  48. package/lib/util/formatVariantSelector.js +186 -0
  49. package/lib/util/getAllConfigs.js +23 -16
  50. package/lib/util/hashConfig.js +10 -10
  51. package/lib/util/isKeyframeRule.js +3 -5
  52. package/lib/util/isPlainObject.js +7 -10
  53. package/lib/util/isValidArbitraryValue.js +64 -0
  54. package/lib/util/log.js +39 -30
  55. package/lib/util/nameClass.js +23 -23
  56. package/lib/util/negateValue.js +14 -15
  57. package/lib/util/normalizeConfig.js +208 -0
  58. package/lib/util/normalizeScreens.js +58 -0
  59. package/lib/util/parseAnimationValue.js +82 -53
  60. package/lib/util/parseBoxShadowValue.js +77 -0
  61. package/lib/util/parseDependency.js +49 -60
  62. package/lib/util/parseObjectStyles.js +23 -20
  63. package/lib/util/pluginUtils.js +153 -285
  64. package/lib/util/prefixSelector.js +14 -16
  65. package/lib/util/resolveConfig.js +194 -249
  66. package/lib/util/resolveConfigPath.js +38 -45
  67. package/lib/util/responsive.js +12 -11
  68. package/lib/util/tap.js +4 -6
  69. package/lib/util/toColorValue.js +4 -5
  70. package/lib/util/toPath.js +4 -6
  71. package/lib/util/transformThemeValue.js +57 -26
  72. package/lib/util/withAlphaVariable.js +56 -54
  73. package/package.json +27 -37
  74. package/peers/index.js +73099 -84294
  75. package/plugin.js +1 -3
  76. package/resolveConfig.js +1 -7
  77. package/scripts/create-plugin-list.js +2 -2
  78. package/src/cli.js +27 -18
  79. package/src/corePluginList.js +1 -1
  80. package/src/corePlugins.js +2124 -1968
  81. package/src/css/preflight.css +14 -1
  82. package/src/featureFlags.js +12 -6
  83. package/src/lib/collapseDuplicateDeclarations.js +28 -0
  84. package/src/lib/detectNesting.js +39 -0
  85. package/src/lib/evaluateTailwindFunctions.js +5 -2
  86. package/src/lib/expandTailwindAtRules.js +24 -32
  87. package/src/lib/generateRules.js +230 -20
  88. package/src/lib/normalizeTailwindDirectives.js +3 -2
  89. package/src/lib/resolveDefaultsAtRules.js +46 -30
  90. package/src/lib/setupContextUtils.js +275 -113
  91. package/src/lib/setupTrackingContext.js +9 -8
  92. package/src/lib/setupWatchingContext.js +12 -7
  93. package/src/lib/sharedState.js +1 -4
  94. package/src/lib/substituteScreenAtRules.js +6 -3
  95. package/src/processTailwindFeatures.js +8 -1
  96. package/src/public/colors.js +300 -0
  97. package/src/public/create-plugin.js +2 -0
  98. package/src/public/default-config.js +4 -0
  99. package/src/public/default-theme.js +4 -0
  100. package/src/public/resolve-config.js +7 -0
  101. package/src/util/buildMediaQuery.js +14 -18
  102. package/src/util/createUtilityPlugin.js +2 -11
  103. package/src/util/dataTypes.js +246 -0
  104. package/src/util/formatVariantSelector.js +196 -0
  105. package/src/util/isValidArbitraryValue.js +61 -0
  106. package/src/util/log.js +18 -21
  107. package/src/util/nameClass.js +10 -6
  108. package/src/util/negateValue.js +4 -2
  109. package/src/util/normalizeConfig.js +249 -0
  110. package/src/util/normalizeScreens.js +42 -0
  111. package/src/util/parseAnimationValue.js +7 -1
  112. package/src/util/parseBoxShadowValue.js +71 -0
  113. package/src/util/parseDependency.js +4 -0
  114. package/src/util/pluginUtils.js +101 -204
  115. package/src/util/prefixSelector.js +1 -4
  116. package/src/util/resolveConfig.js +12 -65
  117. package/src/util/transformThemeValue.js +22 -7
  118. package/src/util/withAlphaVariable.js +13 -8
  119. package/stubs/defaultConfig.stub.js +163 -97
  120. package/stubs/simpleConfig.stub.js +0 -1
@@ -1,32 +1,63 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = transformThemeValue;
7
-
8
6
  var _postcss = _interopRequireDefault(require("postcss"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
7
+ function _interopRequireDefault(obj) {
8
+ return obj && obj.__esModule ? obj : {
9
+ default: obj
10
+ };
11
+ }
12
12
  function transformThemeValue(themeSection) {
13
- if (['fontSize', 'outline'].includes(themeSection)) {
14
- return value => Array.isArray(value) ? value[0] : value;
15
- }
16
-
17
- if (['fontFamily', 'boxShadow', 'transitionProperty', 'transitionDuration', 'transitionDelay', 'transitionTimingFunction', 'backgroundImage', 'backgroundSize', 'backgroundColor', 'cursor', 'animation'].includes(themeSection)) {
18
- return value => Array.isArray(value) ? value.join(', ') : value;
19
- } // For backwards compatibility reasons, before we switched to underscores
20
- // instead of commas for arbitrary values.
21
-
22
-
23
- if (['gridTemplateColumns', 'gridTemplateRows', 'objectPosition'].includes(themeSection)) {
24
- return value => typeof value === 'string' ? _postcss.default.list.comma(value).join(' ') : value;
25
- }
26
-
27
- if (themeSection === 'colors') {
28
- return value => typeof value === 'function' ? value({}) : value;
29
- }
30
-
31
- return value => value;
32
- }
13
+ if ([
14
+ 'fontSize',
15
+ 'outline'
16
+ ].includes(themeSection)) {
17
+ return (value)=>{
18
+ if (typeof value === 'function') value = value({
19
+ });
20
+ if (Array.isArray(value)) value = value[0];
21
+ return value;
22
+ };
23
+ }
24
+ if ([
25
+ 'fontFamily',
26
+ 'boxShadow',
27
+ 'transitionProperty',
28
+ 'transitionDuration',
29
+ 'transitionDelay',
30
+ 'transitionTimingFunction',
31
+ 'backgroundImage',
32
+ 'backgroundSize',
33
+ 'backgroundColor',
34
+ 'cursor',
35
+ 'animation',
36
+ ].includes(themeSection)) {
37
+ return (value)=>{
38
+ if (typeof value === 'function') value = value({
39
+ });
40
+ if (Array.isArray(value)) value = value.join(', ');
41
+ return value;
42
+ };
43
+ }
44
+ // For backwards compatibility reasons, before we switched to underscores
45
+ // instead of commas for arbitrary values.
46
+ if ([
47
+ 'gridTemplateColumns',
48
+ 'gridTemplateRows',
49
+ 'objectPosition'
50
+ ].includes(themeSection)) {
51
+ return (value)=>{
52
+ if (typeof value === 'function') value = value({
53
+ });
54
+ if (typeof value === 'string') value = _postcss.default.list.comma(value).join(' ');
55
+ return value;
56
+ };
57
+ }
58
+ return (value)=>{
59
+ if (typeof value === 'function') value = value({
60
+ });
61
+ return value;
62
+ };
63
+ }
@@ -1,65 +1,67 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.withAlphaValue = withAlphaValue;
7
6
  exports.default = withAlphaVariable;
8
-
9
7
  var _color = require("./color");
10
-
11
8
  function withAlphaValue(color, alphaValue, defaultValue) {
12
- if (typeof color === 'function') {
13
- return color({
14
- opacityValue: alphaValue
9
+ if (typeof color === 'function') {
10
+ return color({
11
+ opacityValue: alphaValue
12
+ });
13
+ }
14
+ let parsed = (0, _color).parseColor(color);
15
+ if (parsed === null) {
16
+ return defaultValue;
17
+ }
18
+ return (0, _color).formatColor({
19
+ ...parsed,
20
+ alpha: alphaValue
15
21
  });
16
- }
17
-
18
- let parsed = (0, _color.parseColor)(color);
19
-
20
- if (parsed === null) {
21
- return defaultValue;
22
- }
23
-
24
- return (0, _color.formatColor)({ ...parsed,
25
- alpha: alphaValue
26
- });
27
22
  }
28
-
29
- function withAlphaVariable({
30
- color,
31
- property,
32
- variable
33
- }) {
34
- if (typeof color === 'function') {
23
+ function withAlphaVariable({ color , property , variable }) {
24
+ let properties = [].concat(property);
25
+ if (typeof color === 'function') {
26
+ return {
27
+ [variable]: '1',
28
+ ...Object.fromEntries(properties.map((p)=>{
29
+ return [
30
+ p,
31
+ color({
32
+ opacityVariable: variable,
33
+ opacityValue: `var(${variable})`
34
+ })
35
+ ];
36
+ }))
37
+ };
38
+ }
39
+ const parsed = (0, _color).parseColor(color);
40
+ if (parsed === null) {
41
+ return Object.fromEntries(properties.map((p)=>[
42
+ p,
43
+ color
44
+ ]
45
+ ));
46
+ }
47
+ if (parsed.alpha !== undefined) {
48
+ // Has an alpha value, return color as-is
49
+ return Object.fromEntries(properties.map((p)=>[
50
+ p,
51
+ color
52
+ ]
53
+ ));
54
+ }
35
55
  return {
36
- [variable]: '1',
37
- [property]: color({
38
- opacityVariable: variable,
39
- opacityValue: `var(${variable})`
40
- })
56
+ [variable]: '1',
57
+ ...Object.fromEntries(properties.map((p)=>{
58
+ return [
59
+ p,
60
+ (0, _color).formatColor({
61
+ ...parsed,
62
+ alpha: `var(${variable})`
63
+ })
64
+ ];
65
+ }))
41
66
  };
42
- }
43
-
44
- const parsed = (0, _color.parseColor)(color);
45
-
46
- if (parsed === null) {
47
- return {
48
- [property]: color
49
- };
50
- }
51
-
52
- if (parsed.alpha !== undefined) {
53
- // Has an alpha value, return color as-is
54
- return {
55
- [property]: color
56
- };
57
- }
58
-
59
- return {
60
- [variable]: '1',
61
- [property]: (0, _color.formatColor)({ ...parsed,
62
- alpha: `var(${variable})`
63
- })
64
- };
65
- }
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "0.0.0-insiders.df011dc",
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",
@@ -18,17 +18,18 @@
18
18
  "David Hemphill <davidlee.hemphill@gmail.com>"
19
19
  ],
20
20
  "scripts": {
21
- "prebabelify": "npm run generate:plugin-list && rimraf lib",
22
- "babelify": "babel src --out-dir lib --copy-files",
23
- "postbabelify": "ncc build lib/cli-peer-dependencies.js -o peers",
24
- "rebuild-fixtures": "npm run babelify && babel-node scripts/rebuildFixtures.js",
25
- "prepublishOnly": "npm install --force && npm run babelify",
21
+ "preswcify": "npm run generate:plugin-list && rimraf lib",
22
+ "swcify": "swc src --out-dir lib --copy-files",
23
+ "postswcify": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js",
24
+ "rebuild-fixtures": "npm run swcify && node -r @swc/register scripts/rebuildFixtures.js",
25
+ "prepublishOnly": "npm install --force && npm run swcify",
26
26
  "style": "eslint .",
27
+ "pretest": "npm run generate:plugin-list",
27
28
  "test": "cross-env TAILWIND_MODE=build jest",
28
29
  "test:integrations": "npm run test --prefix ./integrations",
29
30
  "install:integrations": "node scripts/install-integrations.js",
30
31
  "posttest": "npm run style",
31
- "generate:plugin-list": "babel-node scripts/create-plugin-list.js"
32
+ "generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js"
32
33
  },
33
34
  "files": [
34
35
  "src/*",
@@ -42,24 +43,22 @@
42
43
  "*.js"
43
44
  ],
44
45
  "devDependencies": {
45
- "@babel/cli": "^7.14.8",
46
- "@babel/core": "^7.15.5",
47
- "@babel/node": "^7.12.13",
48
- "@babel/preset-env": "^7.15.0",
49
- "@tailwindcss/aspect-ratio": "^0.2.1",
50
- "@vercel/ncc": "^0.29.2",
51
- "autoprefixer": "^10.3.3",
52
- "babel-jest": "^27.1.0",
46
+ "@swc/cli": "^0.1.52",
47
+ "@swc/core": "^1.2.106",
48
+ "@swc/jest": "^0.1.5",
49
+ "@swc/register": "^0.1.7",
50
+ "autoprefixer": "^10.4.0",
53
51
  "cross-env": "^7.0.3",
54
- "cssnano": "^5.0.8",
55
- "eslint": "^7.32.0",
52
+ "cssnano": "^5.0.12",
53
+ "esbuild": "^0.13.12",
54
+ "eslint": "^8.2.0",
56
55
  "eslint-config-prettier": "^8.3.0",
57
56
  "eslint-plugin-prettier": "^4.0.0",
58
- "jest": "^27.1.0",
59
- "jest-diff": "^27.1.0",
60
- "postcss": "^8.3.6",
57
+ "jest": "^27.3.1",
58
+ "jest-diff": "^27.2.5",
59
+ "postcss": "^8.4.4",
61
60
  "postcss-cli": "^8.3.1",
62
- "prettier": "^2.3.2",
61
+ "prettier": "^2.5.0",
63
62
  "rimraf": "^3.0.0"
64
63
  },
65
64
  "peerDependencies": {
@@ -76,15 +75,15 @@
76
75
  "didyoumean": "^1.2.2",
77
76
  "dlv": "^1.1.3",
78
77
  "fast-glob": "^3.2.7",
79
- "glob-parent": "^6.0.1",
80
- "is-glob": "^4.0.1",
78
+ "glob-parent": "^6.0.2",
79
+ "is-glob": "^4.0.3",
81
80
  "normalize-path": "^3.0.0",
82
81
  "object-hash": "^2.2.0",
83
82
  "postcss-js": "^3.0.3",
84
83
  "postcss-load-config": "^3.1.0",
85
84
  "postcss-nested": "5.0.6",
86
85
  "postcss-selector-parser": "^6.0.6",
87
- "postcss-value-parser": "^4.1.0",
86
+ "postcss-value-parser": "^4.2.0",
88
87
  "quick-lru": "^5.1.1",
89
88
  "resolve": "^1.20.0",
90
89
  "tmp": "^0.2.1"
@@ -95,18 +94,6 @@
95
94
  "not ie 11",
96
95
  "not op_mini all"
97
96
  ],
98
- "babel": {
99
- "presets": [
100
- [
101
- "@babel/preset-env",
102
- {
103
- "targets": {
104
- "node": "12.13.0"
105
- }
106
- }
107
- ]
108
- ]
109
- },
110
97
  "jest": {
111
98
  "testTimeout": 30000,
112
99
  "setupFilesAfterEnv": [
@@ -115,7 +102,10 @@
115
102
  "testPathIgnorePatterns": [
116
103
  "/node_modules/",
117
104
  "/integrations/"
118
- ]
105
+ ],
106
+ "transform": {
107
+ "\\.js$": "@swc/jest"
108
+ }
119
109
  },
120
110
  "engines": {
121
111
  "node": ">=12.13.0"