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
@@ -0,0 +1,42 @@
1
+ # tailwindcss/nesting
2
+
3
+ This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
4
+
5
+ Add it to your PostCSS configuration, somewhere before Tailwind itself:
6
+
7
+ ```js
8
+ // postcss.config.js
9
+ module.exports = {
10
+ plugins: [
11
+ require('postcss-import'),
12
+ require('tailwindcss/nesting'),
13
+ require('tailwindcss'),
14
+ require('autoprefixer'),
15
+ ]
16
+ }
17
+ ```
18
+
19
+ By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
20
+
21
+ If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
22
+
23
+ ```shell
24
+ npm install postcss-nesting
25
+ ```
26
+
27
+ Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
28
+
29
+ ```js
30
+ // postcss.config.js
31
+ module.exports = {
32
+ plugins: [
33
+ require('postcss-import'),
34
+ require('tailwindcss/nesting')(require('postcss-nesting')),
35
+ require('tailwindcss'),
36
+ require('autoprefixer'),
37
+ ]
38
+ }
39
+ ```
40
+
41
+ This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `tailwindcss/nesting` itself.
42
+
@@ -0,0 +1,13 @@
1
+ import { nesting } from './plugin'
2
+
3
+ export default Object.assign(
4
+ function (opts) {
5
+ return {
6
+ postcssPlugin: 'tailwindcss/nesting',
7
+ Once(root, { result }) {
8
+ return nesting(opts)(root, result)
9
+ },
10
+ }
11
+ },
12
+ { postcss: true }
13
+ )
@@ -0,0 +1,80 @@
1
+ import postcss from 'postcss'
2
+ import postcssNested from 'postcss-nested'
3
+
4
+ export function nesting(opts = postcssNested) {
5
+ return (root, result) => {
6
+ root.walkAtRules('screen', (rule) => {
7
+ rule.name = 'media'
8
+ rule.params = `screen(${rule.params})`
9
+ })
10
+
11
+ root.walkAtRules('apply', (rule) => {
12
+ rule.before(postcss.decl({ prop: '__apply', value: rule.params, source: rule.source }))
13
+ rule.remove()
14
+ })
15
+
16
+ let plugin = (() => {
17
+ if (
18
+ typeof opts === 'function' ||
19
+ (typeof opts === 'object' && opts?.hasOwnProperty?.('postcssPlugin'))
20
+ ) {
21
+ return opts
22
+ }
23
+
24
+ if (typeof opts === 'string') {
25
+ return require(opts)
26
+ }
27
+
28
+ if (Object.keys(opts).length <= 0) {
29
+ return postcssNested
30
+ }
31
+
32
+ throw new Error('tailwindcss/nesting should be loaded with a nesting plugin.')
33
+ })()
34
+
35
+ postcss([plugin]).process(root, result.opts).sync()
36
+
37
+ root.walkDecls('__apply', (decl) => {
38
+ decl.before(postcss.atRule({ name: 'apply', params: decl.value, source: decl.source }))
39
+ decl.remove()
40
+ })
41
+
42
+ /**
43
+ * Use a private PostCSS API to remove the "clean" flag from the entire AST.
44
+ * This is done because running process() on the AST will set the "clean"
45
+ * flag on all nodes, which we don't want.
46
+ *
47
+ * This causes downstream plugins using the visitor API to be skipped.
48
+ *
49
+ * This is guarded because the PostCSS API is not public
50
+ * and may change in future versions of PostCSS.
51
+ *
52
+ * See https://github.com/postcss/postcss/issues/1712 for more details
53
+ *
54
+ * @param {import('postcss').Node} node
55
+ */
56
+ function markDirty(node) {
57
+ if (!('markDirty' in node)) {
58
+ return
59
+ }
60
+
61
+ // Traverse the tree down to the leaf nodes
62
+ if (node.nodes) {
63
+ node.nodes.forEach((n) => markDirty(n))
64
+ }
65
+
66
+ // If it's a leaf node mark it as dirty
67
+ // We do this here because marking a node as dirty
68
+ // will walk up the tree and mark all parents as dirty
69
+ // resulting in a lot of unnecessary work if we did this
70
+ // for every single node
71
+ if (!node.nodes) {
72
+ node.markDirty()
73
+ }
74
+ }
75
+
76
+ markDirty(root)
77
+
78
+ return root
79
+ }
80
+ }
@@ -6,16 +6,24 @@ import substituteScreenAtRules from './lib/substituteScreenAtRules'
6
6
  import resolveDefaultsAtRules from './lib/resolveDefaultsAtRules'
7
7
  import collapseAdjacentRules from './lib/collapseAdjacentRules'
8
8
  import collapseDuplicateDeclarations from './lib/collapseDuplicateDeclarations'
9
+ import partitionApplyAtRules from './lib/partitionApplyAtRules'
9
10
  import detectNesting from './lib/detectNesting'
10
11
  import { createContext } from './lib/setupContextUtils'
11
12
  import { issueFlagNotices } from './featureFlags'
12
13
 
13
14
  export default function processTailwindFeatures(setupContext) {
14
15
  return function (root, result) {
15
- let tailwindDirectives = normalizeTailwindDirectives(root)
16
+ let { tailwindDirectives, applyDirectives } = normalizeTailwindDirectives(root)
17
+
18
+ detectNesting()(root, result)
19
+
20
+ // Partition apply rules that are found in the css
21
+ // itself.
22
+ partitionApplyAtRules()(root, result)
16
23
 
17
24
  let context = setupContext({
18
25
  tailwindDirectives,
26
+ applyDirectives,
19
27
  registerDependency(dependency) {
20
28
  result.messages.push({
21
29
  plugin: 'tailwindcss',
@@ -36,8 +44,10 @@ export default function processTailwindFeatures(setupContext) {
36
44
 
37
45
  issueFlagNotices(context.tailwindConfig)
38
46
 
39
- detectNesting(context)(root, result)
40
47
  expandTailwindAtRules(context)(root, result)
48
+ // Partition apply rules that are generated by
49
+ // addComponents, addUtilities and so on.
50
+ partitionApplyAtRules()(root, result)
41
51
  expandApplyAtRules(context)(root, result)
42
52
  evaluateTailwindFunctions(context)(root, result)
43
53
  substituteScreenAtRules(context)(root, result)
@@ -24,6 +24,7 @@ export default {
24
24
  700: '#334155',
25
25
  800: '#1e293b',
26
26
  900: '#0f172a',
27
+ 950: '#020617',
27
28
  },
28
29
  gray: {
29
30
  50: '#f9fafb',
@@ -36,6 +37,7 @@ export default {
36
37
  700: '#374151',
37
38
  800: '#1f2937',
38
39
  900: '#111827',
40
+ 950: '#030712',
39
41
  },
40
42
  zinc: {
41
43
  50: '#fafafa',
@@ -48,6 +50,7 @@ export default {
48
50
  700: '#3f3f46',
49
51
  800: '#27272a',
50
52
  900: '#18181b',
53
+ 950: '#09090b',
51
54
  },
52
55
  neutral: {
53
56
  50: '#fafafa',
@@ -60,6 +63,7 @@ export default {
60
63
  700: '#404040',
61
64
  800: '#262626',
62
65
  900: '#171717',
66
+ 950: '#0a0a0a',
63
67
  },
64
68
  stone: {
65
69
  50: '#fafaf9',
@@ -72,6 +76,7 @@ export default {
72
76
  700: '#44403c',
73
77
  800: '#292524',
74
78
  900: '#1c1917',
79
+ 950: '#0c0a09',
75
80
  },
76
81
  red: {
77
82
  50: '#fef2f2',
@@ -84,6 +89,7 @@ export default {
84
89
  700: '#b91c1c',
85
90
  800: '#991b1b',
86
91
  900: '#7f1d1d',
92
+ 950: '#450a0a',
87
93
  },
88
94
  orange: {
89
95
  50: '#fff7ed',
@@ -96,6 +102,7 @@ export default {
96
102
  700: '#c2410c',
97
103
  800: '#9a3412',
98
104
  900: '#7c2d12',
105
+ 950: '#431407',
99
106
  },
100
107
  amber: {
101
108
  50: '#fffbeb',
@@ -108,6 +115,7 @@ export default {
108
115
  700: '#b45309',
109
116
  800: '#92400e',
110
117
  900: '#78350f',
118
+ 950: '#451a03',
111
119
  },
112
120
  yellow: {
113
121
  50: '#fefce8',
@@ -120,6 +128,7 @@ export default {
120
128
  700: '#a16207',
121
129
  800: '#854d0e',
122
130
  900: '#713f12',
131
+ 950: '#422006',
123
132
  },
124
133
  lime: {
125
134
  50: '#f7fee7',
@@ -132,6 +141,7 @@ export default {
132
141
  700: '#4d7c0f',
133
142
  800: '#3f6212',
134
143
  900: '#365314',
144
+ 950: '#1a2e05',
135
145
  },
136
146
  green: {
137
147
  50: '#f0fdf4',
@@ -144,6 +154,7 @@ export default {
144
154
  700: '#15803d',
145
155
  800: '#166534',
146
156
  900: '#14532d',
157
+ 950: '#052e16',
147
158
  },
148
159
  emerald: {
149
160
  50: '#ecfdf5',
@@ -156,6 +167,7 @@ export default {
156
167
  700: '#047857',
157
168
  800: '#065f46',
158
169
  900: '#064e3b',
170
+ 950: '#022c22',
159
171
  },
160
172
  teal: {
161
173
  50: '#f0fdfa',
@@ -168,6 +180,7 @@ export default {
168
180
  700: '#0f766e',
169
181
  800: '#115e59',
170
182
  900: '#134e4a',
183
+ 950: '#042f2e',
171
184
  },
172
185
  cyan: {
173
186
  50: '#ecfeff',
@@ -180,6 +193,7 @@ export default {
180
193
  700: '#0e7490',
181
194
  800: '#155e75',
182
195
  900: '#164e63',
196
+ 950: '#083344',
183
197
  },
184
198
  sky: {
185
199
  50: '#f0f9ff',
@@ -192,6 +206,7 @@ export default {
192
206
  700: '#0369a1',
193
207
  800: '#075985',
194
208
  900: '#0c4a6e',
209
+ 950: '#082f49',
195
210
  },
196
211
  blue: {
197
212
  50: '#eff6ff',
@@ -204,6 +219,7 @@ export default {
204
219
  700: '#1d4ed8',
205
220
  800: '#1e40af',
206
221
  900: '#1e3a8a',
222
+ 950: '#172554',
207
223
  },
208
224
  indigo: {
209
225
  50: '#eef2ff',
@@ -216,6 +232,7 @@ export default {
216
232
  700: '#4338ca',
217
233
  800: '#3730a3',
218
234
  900: '#312e81',
235
+ 950: '#1e1b4b',
219
236
  },
220
237
  violet: {
221
238
  50: '#f5f3ff',
@@ -228,6 +245,7 @@ export default {
228
245
  700: '#6d28d9',
229
246
  800: '#5b21b6',
230
247
  900: '#4c1d95',
248
+ 950: '#2e1065',
231
249
  },
232
250
  purple: {
233
251
  50: '#faf5ff',
@@ -240,6 +258,7 @@ export default {
240
258
  700: '#7e22ce',
241
259
  800: '#6b21a8',
242
260
  900: '#581c87',
261
+ 950: '#3b0764',
243
262
  },
244
263
  fuchsia: {
245
264
  50: '#fdf4ff',
@@ -252,6 +271,7 @@ export default {
252
271
  700: '#a21caf',
253
272
  800: '#86198f',
254
273
  900: '#701a75',
274
+ 950: '#4a044e',
255
275
  },
256
276
  pink: {
257
277
  50: '#fdf2f8',
@@ -264,6 +284,7 @@ export default {
264
284
  700: '#be185d',
265
285
  800: '#9d174d',
266
286
  900: '#831843',
287
+ 950: '#500724',
267
288
  },
268
289
  rose: {
269
290
  50: '#fff1f2',
@@ -276,6 +297,7 @@ export default {
276
297
  700: '#be123c',
277
298
  800: '#9f1239',
278
299
  900: '#881337',
300
+ 950: '#4c0519',
279
301
  },
280
302
  get lightBlue() {
281
303
  warn({ version: 'v2.2', from: 'lightBlue', to: 'sky' })
@@ -1,4 +1,4 @@
1
1
  import { cloneDeep } from '../util/cloneDeep'
2
- import defaultConfig from '../../stubs/defaultConfig.stub'
2
+ import defaultConfig from '../../stubs/config.full'
3
3
 
4
4
  export default cloneDeep(defaultConfig)
@@ -1,4 +1,4 @@
1
1
  import { cloneDeep } from '../util/cloneDeep'
2
- import defaultConfig from '../../stubs/defaultConfig.stub'
2
+ import defaultFullConfig from '../../stubs/config.full'
3
3
 
4
- export default cloneDeep(defaultConfig.theme)
4
+ export default cloneDeep(defaultFullConfig.theme)
@@ -0,0 +1,2 @@
1
+ import { loadConfig } from '../lib/load-config'
2
+ export default loadConfig
@@ -0,0 +1,27 @@
1
+ import parser from 'postcss-selector-parser'
2
+ import { movePseudos } from './pseudoElements'
3
+
4
+ export function applyImportantSelector(selector, important) {
5
+ let sel = parser().astSync(selector)
6
+
7
+ sel.each((sel) => {
8
+ // Wrap with :is if it's not already wrapped
9
+ let isWrapped =
10
+ sel.nodes[0].type === 'pseudo' &&
11
+ sel.nodes[0].value === ':is' &&
12
+ sel.nodes.every((node) => node.type !== 'combinator')
13
+
14
+ if (!isWrapped) {
15
+ sel.nodes = [
16
+ parser.pseudo({
17
+ value: ':is',
18
+ nodes: [sel.clone()],
19
+ }),
20
+ ]
21
+ }
22
+
23
+ movePseudos(sel)
24
+ })
25
+
26
+ return `${important} ${sel.toString()}`
27
+ }
@@ -2,8 +2,8 @@ export default function buildMediaQuery(screens) {
2
2
  screens = Array.isArray(screens) ? screens : [screens]
3
3
 
4
4
  return screens
5
- .map((screen) =>
6
- screen.values.map((screen) => {
5
+ .map((screen) => {
6
+ let values = screen.values.map((screen) => {
7
7
  if (screen.raw !== undefined) {
8
8
  return screen.raw
9
9
  }
@@ -15,6 +15,8 @@ export default function buildMediaQuery(screens) {
15
15
  .filter(Boolean)
16
16
  .join(' and ')
17
17
  })
18
- )
18
+
19
+ return screen.not ? `not all and ${values}` : values
20
+ })
19
21
  .join(', ')
20
22
  }
@@ -1,9 +1,26 @@
1
- export default function cloneNodes(nodes, source) {
1
+ export default function cloneNodes(nodes, source = undefined, raws = undefined) {
2
2
  return nodes.map((node) => {
3
3
  let cloned = node.clone()
4
4
 
5
- if (source !== undefined) {
5
+ // We always want override the source map
6
+ // except when explicitly told not to
7
+ let shouldOverwriteSource = node.raws.tailwind?.preserveSource !== true || !cloned.source
8
+
9
+ if (source !== undefined && shouldOverwriteSource) {
6
10
  cloned.source = source
11
+
12
+ if ('walk' in cloned) {
13
+ cloned.walk((child) => {
14
+ child.source = source
15
+ })
16
+ }
17
+ }
18
+
19
+ if (raws !== undefined) {
20
+ cloned.raws.tailwind = {
21
+ ...cloned.raws.tailwind,
22
+ ...raws,
23
+ }
7
24
  }
8
25
 
9
26
  return cloned
package/src/util/color.js CHANGED
@@ -1,15 +1,22 @@
1
- import namedColors from 'color-name'
1
+ import namedColors from './colorNames'
2
2
 
3
3
  let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i
4
4
  let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i
5
- let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`
6
- let SEP = `(?:\\s*,\\s*|\\s+)`
7
- let ALPHA_SEP = `\\s*[,/]\\s*`
8
- let RGB_HSL = new RegExp(
9
- `^(rgb|hsl)a?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`
5
+ let VALUE = /(?:\d+|\d*\.\d+)%?/
6
+ let SEP = /(?:\s*,\s*|\s+)/
7
+ let ALPHA_SEP = /\s*[,/]\s*/
8
+ let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/
9
+
10
+ let RGB = new RegExp(
11
+ `^(rgba?)\\(\\s*(${VALUE.source}|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`
12
+ )
13
+ let HSL = new RegExp(
14
+ `^(hsla?)\\(\\s*((?:${VALUE.source})(?:deg|rad|grad|turn)?|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`
10
15
  )
11
16
 
12
- export function parseColor(value) {
17
+ // In "loose" mode the color may contain fewer than 3 parts, as long as at least
18
+ // one of the parts is variable.
19
+ export function parseColor(value, { loose = false } = {}) {
13
20
  if (typeof value !== 'string') {
14
21
  return null
15
22
  }
@@ -37,20 +44,45 @@ export function parseColor(value) {
37
44
  }
38
45
  }
39
46
 
40
- let match = value.match(RGB_HSL)
47
+ let match = value.match(RGB) ?? value.match(HSL)
48
+
49
+ if (match === null) {
50
+ return null
51
+ }
52
+
53
+ let color = [match[2], match[3], match[4]].filter(Boolean).map((v) => v.toString())
41
54
 
42
- if (match !== null) {
55
+ // rgba(var(--my-color), 0.1)
56
+ // hsla(var(--my-color), 0.1)
57
+ if (color.length === 2 && color[0].startsWith('var(')) {
43
58
  return {
44
59
  mode: match[1],
45
- color: [match[2], match[3], match[4]].map((v) => v.toString()),
46
- alpha: match[5]?.toString?.(),
60
+ color: [color[0]],
61
+ alpha: color[1],
47
62
  }
48
63
  }
49
64
 
50
- return null
65
+ if (!loose && color.length !== 3) {
66
+ return null
67
+ }
68
+
69
+ if (color.length < 3 && !color.some((part) => /^var\(.*?\)$/.test(part))) {
70
+ return null
71
+ }
72
+
73
+ return {
74
+ mode: match[1],
75
+ color,
76
+ alpha: match[5]?.toString?.(),
77
+ }
51
78
  }
52
79
 
53
80
  export function formatColor({ mode, color, alpha }) {
54
81
  let hasAlpha = alpha !== undefined
82
+
83
+ if (mode === 'rgba' || mode === 'hsla') {
84
+ return `${mode}(${color.join(', ')}${hasAlpha ? `, ${alpha}` : ''})`
85
+ }
86
+
55
87
  return `${mode}(${color.join(' ')}${hasAlpha ? ` / ${alpha}` : ''})`
56
88
  }
@@ -0,0 +1,150 @@
1
+ export default {
2
+ aliceblue: [240, 248, 255],
3
+ antiquewhite: [250, 235, 215],
4
+ aqua: [0, 255, 255],
5
+ aquamarine: [127, 255, 212],
6
+ azure: [240, 255, 255],
7
+ beige: [245, 245, 220],
8
+ bisque: [255, 228, 196],
9
+ black: [0, 0, 0],
10
+ blanchedalmond: [255, 235, 205],
11
+ blue: [0, 0, 255],
12
+ blueviolet: [138, 43, 226],
13
+ brown: [165, 42, 42],
14
+ burlywood: [222, 184, 135],
15
+ cadetblue: [95, 158, 160],
16
+ chartreuse: [127, 255, 0],
17
+ chocolate: [210, 105, 30],
18
+ coral: [255, 127, 80],
19
+ cornflowerblue: [100, 149, 237],
20
+ cornsilk: [255, 248, 220],
21
+ crimson: [220, 20, 60],
22
+ cyan: [0, 255, 255],
23
+ darkblue: [0, 0, 139],
24
+ darkcyan: [0, 139, 139],
25
+ darkgoldenrod: [184, 134, 11],
26
+ darkgray: [169, 169, 169],
27
+ darkgreen: [0, 100, 0],
28
+ darkgrey: [169, 169, 169],
29
+ darkkhaki: [189, 183, 107],
30
+ darkmagenta: [139, 0, 139],
31
+ darkolivegreen: [85, 107, 47],
32
+ darkorange: [255, 140, 0],
33
+ darkorchid: [153, 50, 204],
34
+ darkred: [139, 0, 0],
35
+ darksalmon: [233, 150, 122],
36
+ darkseagreen: [143, 188, 143],
37
+ darkslateblue: [72, 61, 139],
38
+ darkslategray: [47, 79, 79],
39
+ darkslategrey: [47, 79, 79],
40
+ darkturquoise: [0, 206, 209],
41
+ darkviolet: [148, 0, 211],
42
+ deeppink: [255, 20, 147],
43
+ deepskyblue: [0, 191, 255],
44
+ dimgray: [105, 105, 105],
45
+ dimgrey: [105, 105, 105],
46
+ dodgerblue: [30, 144, 255],
47
+ firebrick: [178, 34, 34],
48
+ floralwhite: [255, 250, 240],
49
+ forestgreen: [34, 139, 34],
50
+ fuchsia: [255, 0, 255],
51
+ gainsboro: [220, 220, 220],
52
+ ghostwhite: [248, 248, 255],
53
+ gold: [255, 215, 0],
54
+ goldenrod: [218, 165, 32],
55
+ gray: [128, 128, 128],
56
+ green: [0, 128, 0],
57
+ greenyellow: [173, 255, 47],
58
+ grey: [128, 128, 128],
59
+ honeydew: [240, 255, 240],
60
+ hotpink: [255, 105, 180],
61
+ indianred: [205, 92, 92],
62
+ indigo: [75, 0, 130],
63
+ ivory: [255, 255, 240],
64
+ khaki: [240, 230, 140],
65
+ lavender: [230, 230, 250],
66
+ lavenderblush: [255, 240, 245],
67
+ lawngreen: [124, 252, 0],
68
+ lemonchiffon: [255, 250, 205],
69
+ lightblue: [173, 216, 230],
70
+ lightcoral: [240, 128, 128],
71
+ lightcyan: [224, 255, 255],
72
+ lightgoldenrodyellow: [250, 250, 210],
73
+ lightgray: [211, 211, 211],
74
+ lightgreen: [144, 238, 144],
75
+ lightgrey: [211, 211, 211],
76
+ lightpink: [255, 182, 193],
77
+ lightsalmon: [255, 160, 122],
78
+ lightseagreen: [32, 178, 170],
79
+ lightskyblue: [135, 206, 250],
80
+ lightslategray: [119, 136, 153],
81
+ lightslategrey: [119, 136, 153],
82
+ lightsteelblue: [176, 196, 222],
83
+ lightyellow: [255, 255, 224],
84
+ lime: [0, 255, 0],
85
+ limegreen: [50, 205, 50],
86
+ linen: [250, 240, 230],
87
+ magenta: [255, 0, 255],
88
+ maroon: [128, 0, 0],
89
+ mediumaquamarine: [102, 205, 170],
90
+ mediumblue: [0, 0, 205],
91
+ mediumorchid: [186, 85, 211],
92
+ mediumpurple: [147, 112, 219],
93
+ mediumseagreen: [60, 179, 113],
94
+ mediumslateblue: [123, 104, 238],
95
+ mediumspringgreen: [0, 250, 154],
96
+ mediumturquoise: [72, 209, 204],
97
+ mediumvioletred: [199, 21, 133],
98
+ midnightblue: [25, 25, 112],
99
+ mintcream: [245, 255, 250],
100
+ mistyrose: [255, 228, 225],
101
+ moccasin: [255, 228, 181],
102
+ navajowhite: [255, 222, 173],
103
+ navy: [0, 0, 128],
104
+ oldlace: [253, 245, 230],
105
+ olive: [128, 128, 0],
106
+ olivedrab: [107, 142, 35],
107
+ orange: [255, 165, 0],
108
+ orangered: [255, 69, 0],
109
+ orchid: [218, 112, 214],
110
+ palegoldenrod: [238, 232, 170],
111
+ palegreen: [152, 251, 152],
112
+ paleturquoise: [175, 238, 238],
113
+ palevioletred: [219, 112, 147],
114
+ papayawhip: [255, 239, 213],
115
+ peachpuff: [255, 218, 185],
116
+ peru: [205, 133, 63],
117
+ pink: [255, 192, 203],
118
+ plum: [221, 160, 221],
119
+ powderblue: [176, 224, 230],
120
+ purple: [128, 0, 128],
121
+ rebeccapurple: [102, 51, 153],
122
+ red: [255, 0, 0],
123
+ rosybrown: [188, 143, 143],
124
+ royalblue: [65, 105, 225],
125
+ saddlebrown: [139, 69, 19],
126
+ salmon: [250, 128, 114],
127
+ sandybrown: [244, 164, 96],
128
+ seagreen: [46, 139, 87],
129
+ seashell: [255, 245, 238],
130
+ sienna: [160, 82, 45],
131
+ silver: [192, 192, 192],
132
+ skyblue: [135, 206, 235],
133
+ slateblue: [106, 90, 205],
134
+ slategray: [112, 128, 144],
135
+ slategrey: [112, 128, 144],
136
+ snow: [255, 250, 250],
137
+ springgreen: [0, 255, 127],
138
+ steelblue: [70, 130, 180],
139
+ tan: [210, 180, 140],
140
+ teal: [0, 128, 128],
141
+ thistle: [216, 191, 216],
142
+ tomato: [255, 99, 71],
143
+ turquoise: [64, 224, 208],
144
+ violet: [238, 130, 238],
145
+ wheat: [245, 222, 179],
146
+ white: [255, 255, 255],
147
+ whitesmoke: [245, 245, 245],
148
+ yellow: [255, 255, 0],
149
+ yellowgreen: [154, 205, 50],
150
+ }