tailwindcss 0.0.0-insiders.ed61821 → 0.0.0-insiders.ed8ff92

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 (222) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +15 -7
  3. package/colors.d.ts +3 -0
  4. package/colors.js +2 -304
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -4
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -4
  9. package/lib/cli/build/deps.js +54 -0
  10. package/lib/cli/build/index.js +48 -0
  11. package/lib/cli/build/plugin.js +367 -0
  12. package/lib/cli/build/utils.js +78 -0
  13. package/lib/cli/build/watching.js +178 -0
  14. package/lib/cli/help/index.js +71 -0
  15. package/lib/cli/index.js +239 -0
  16. package/lib/cli/init/index.js +46 -0
  17. package/lib/cli-peer-dependencies.js +20 -7
  18. package/lib/cli.js +4 -702
  19. package/lib/constants.js +27 -20
  20. package/lib/corePluginList.js +22 -4
  21. package/lib/corePlugins.js +2558 -1744
  22. package/lib/css/preflight.css +22 -9
  23. package/lib/featureFlags.js +39 -25
  24. package/lib/index.js +4 -30
  25. package/lib/lib/cacheInvalidation.js +90 -0
  26. package/lib/lib/collapseAdjacentRules.js +28 -10
  27. package/lib/lib/collapseDuplicateDeclarations.js +83 -0
  28. package/lib/lib/content.js +177 -0
  29. package/lib/lib/defaultExtractor.js +241 -0
  30. package/lib/lib/detectNesting.js +27 -3
  31. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  32. package/lib/lib/expandApplyAtRules.js +457 -159
  33. package/lib/lib/expandTailwindAtRules.js +169 -153
  34. package/lib/lib/findAtConfigPath.js +44 -0
  35. package/lib/lib/generateRules.js +621 -105
  36. package/lib/lib/getModuleDependencies.js +11 -8
  37. package/lib/lib/normalizeTailwindDirectives.js +45 -33
  38. package/lib/lib/offsets.js +299 -0
  39. package/lib/lib/partitionApplyAtRules.js +56 -0
  40. package/lib/lib/regex.js +60 -0
  41. package/lib/lib/remap-bitfield.js +87 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +114 -81
  43. package/lib/lib/setupContextUtils.js +839 -364
  44. package/lib/lib/setupTrackingContext.js +67 -71
  45. package/lib/lib/sharedState.js +63 -14
  46. package/lib/lib/substituteScreenAtRules.js +13 -8
  47. package/lib/oxide/cli/build/deps.js +81 -0
  48. package/lib/oxide/cli/build/index.js +47 -0
  49. package/lib/oxide/cli/build/plugin.js +364 -0
  50. package/lib/oxide/cli/build/utils.js +77 -0
  51. package/lib/oxide/cli/build/watching.js +177 -0
  52. package/lib/oxide/cli/help/index.js +70 -0
  53. package/lib/oxide/cli/index.js +220 -0
  54. package/lib/oxide/cli/init/index.js +35 -0
  55. package/lib/oxide/cli.js +5 -0
  56. package/lib/oxide/postcss-plugin.js +2 -0
  57. package/lib/plugin.js +48 -0
  58. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  59. package/lib/postcss-plugins/nesting/index.js +19 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  61. package/lib/processTailwindFeatures.js +36 -21
  62. package/lib/public/colors.js +331 -0
  63. package/lib/public/create-plugin.js +15 -0
  64. package/lib/public/default-config.js +16 -0
  65. package/lib/public/default-theme.js +16 -0
  66. package/lib/public/resolve-config.js +22 -0
  67. package/lib/util/bigSign.js +4 -1
  68. package/lib/util/buildMediaQuery.js +18 -24
  69. package/lib/util/cloneDeep.js +7 -6
  70. package/lib/util/cloneNodes.js +21 -3
  71. package/lib/util/color.js +54 -40
  72. package/lib/util/configurePlugins.js +5 -2
  73. package/lib/util/createPlugin.js +6 -6
  74. package/lib/util/createUtilityPlugin.js +12 -14
  75. package/lib/util/dataTypes.js +164 -100
  76. package/lib/util/defaults.js +12 -3
  77. package/lib/util/escapeClassName.js +9 -6
  78. package/lib/util/escapeCommas.js +5 -2
  79. package/lib/util/flattenColorPalette.js +9 -12
  80. package/lib/util/formatVariantSelector.js +351 -0
  81. package/lib/util/getAllConfigs.js +29 -10
  82. package/lib/util/hashConfig.js +6 -3
  83. package/lib/util/isKeyframeRule.js +5 -2
  84. package/lib/util/isPlainObject.js +5 -2
  85. package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
  86. package/lib/util/log.js +44 -22
  87. package/lib/util/nameClass.js +20 -8
  88. package/lib/util/negateValue.js +24 -7
  89. package/lib/util/normalizeConfig.js +281 -0
  90. package/lib/util/normalizeScreens.js +170 -0
  91. package/lib/util/parseAnimationValue.js +47 -39
  92. package/lib/util/parseBoxShadowValue.js +84 -0
  93. package/lib/util/parseDependency.js +38 -53
  94. package/lib/util/parseGlob.js +34 -0
  95. package/lib/util/parseObjectStyles.js +11 -8
  96. package/lib/util/pluginUtils.js +186 -181
  97. package/lib/util/prefixSelector.js +27 -13
  98. package/lib/util/removeAlphaVariables.js +29 -0
  99. package/lib/util/resolveConfig.js +98 -137
  100. package/lib/util/resolveConfigPath.js +11 -9
  101. package/lib/util/responsive.js +8 -5
  102. package/lib/util/splitAtTopLevelOnly.js +43 -0
  103. package/lib/util/tap.js +4 -1
  104. package/lib/util/toColorValue.js +5 -3
  105. package/lib/util/toPath.js +24 -3
  106. package/lib/util/transformThemeValue.js +49 -31
  107. package/lib/util/validateConfig.js +24 -0
  108. package/lib/util/validateFormalSyntax.js +24 -0
  109. package/lib/util/withAlphaVariable.js +47 -24
  110. package/nesting/index.js +2 -12
  111. package/oxide-node-api-shim/index.js +21 -0
  112. package/oxide-node-api-shim/package.json +5 -0
  113. package/package.json +61 -52
  114. package/peers/index.js +76301 -84138
  115. package/plugin.d.ts +11 -0
  116. package/plugin.js +1 -2
  117. package/resolveConfig.d.ts +12 -0
  118. package/resolveConfig.js +2 -7
  119. package/scripts/create-plugin-list.js +2 -2
  120. package/scripts/generate-types.js +105 -0
  121. package/scripts/release-channel.js +18 -0
  122. package/scripts/release-notes.js +21 -0
  123. package/scripts/swap-engines.js +40 -0
  124. package/scripts/type-utils.js +27 -0
  125. package/src/cli/build/deps.js +56 -0
  126. package/src/cli/build/index.js +49 -0
  127. package/src/cli/build/plugin.js +439 -0
  128. package/src/cli/build/utils.js +76 -0
  129. package/src/cli/build/watching.js +227 -0
  130. package/src/cli/help/index.js +70 -0
  131. package/src/cli/index.js +234 -0
  132. package/src/cli/init/index.js +50 -0
  133. package/src/cli-peer-dependencies.js +7 -1
  134. package/src/cli.js +4 -756
  135. package/src/corePluginList.js +1 -1
  136. package/src/corePlugins.js +1087 -590
  137. package/src/css/preflight.css +22 -9
  138. package/src/featureFlags.js +26 -10
  139. package/src/index.js +4 -33
  140. package/src/lib/cacheInvalidation.js +52 -0
  141. package/src/lib/collapseAdjacentRules.js +21 -2
  142. package/src/lib/collapseDuplicateDeclarations.js +93 -0
  143. package/src/lib/content.js +208 -0
  144. package/src/lib/defaultExtractor.js +217 -0
  145. package/src/lib/detectNesting.js +30 -3
  146. package/src/lib/evaluateTailwindFunctions.js +84 -10
  147. package/src/lib/expandApplyAtRules.js +508 -153
  148. package/src/lib/expandTailwindAtRules.js +127 -108
  149. package/src/lib/findAtConfigPath.js +48 -0
  150. package/src/lib/generateRules.js +648 -69
  151. package/src/lib/normalizeTailwindDirectives.js +10 -3
  152. package/src/lib/offsets.js +367 -0
  153. package/src/lib/partitionApplyAtRules.js +52 -0
  154. package/src/lib/regex.js +74 -0
  155. package/src/lib/remap-bitfield.js +82 -0
  156. package/src/lib/resolveDefaultsAtRules.js +98 -60
  157. package/src/lib/setupContextUtils.js +814 -246
  158. package/src/lib/setupTrackingContext.js +50 -61
  159. package/src/lib/sharedState.js +60 -6
  160. package/src/lib/substituteScreenAtRules.js +6 -3
  161. package/src/oxide/cli/build/deps.ts +91 -0
  162. package/src/oxide/cli/build/index.ts +47 -0
  163. package/src/oxide/cli/build/plugin.ts +436 -0
  164. package/src/oxide/cli/build/utils.ts +74 -0
  165. package/src/oxide/cli/build/watching.ts +225 -0
  166. package/src/oxide/cli/help/index.ts +69 -0
  167. package/src/oxide/cli/index.ts +212 -0
  168. package/src/oxide/cli/init/index.ts +32 -0
  169. package/src/oxide/cli.ts +1 -0
  170. package/src/oxide/postcss-plugin.ts +1 -0
  171. package/src/plugin.js +47 -0
  172. package/src/postcss-plugins/nesting/README.md +42 -0
  173. package/src/postcss-plugins/nesting/index.js +13 -0
  174. package/src/postcss-plugins/nesting/plugin.js +80 -0
  175. package/src/processTailwindFeatures.js +18 -3
  176. package/src/public/colors.js +300 -0
  177. package/src/public/create-plugin.js +2 -0
  178. package/src/public/default-config.js +4 -0
  179. package/src/public/default-theme.js +4 -0
  180. package/src/public/resolve-config.js +7 -0
  181. package/src/util/buildMediaQuery.js +14 -16
  182. package/src/util/cloneNodes.js +19 -2
  183. package/src/util/color.js +31 -14
  184. package/src/util/createUtilityPlugin.js +2 -2
  185. package/src/util/dataTypes.js +86 -21
  186. package/src/util/defaults.js +6 -0
  187. package/src/util/formatVariantSelector.js +412 -0
  188. package/src/util/getAllConfigs.js +19 -0
  189. package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
  190. package/src/util/log.js +23 -22
  191. package/src/util/nameClass.js +6 -2
  192. package/src/util/negateValue.js +15 -5
  193. package/src/util/normalizeConfig.js +300 -0
  194. package/src/util/normalizeScreens.js +140 -0
  195. package/src/util/parseAnimationValue.js +7 -1
  196. package/src/util/parseBoxShadowValue.js +72 -0
  197. package/src/util/parseDependency.js +37 -38
  198. package/src/util/parseGlob.js +24 -0
  199. package/src/util/pluginUtils.js +177 -143
  200. package/src/util/prefixSelector.js +30 -13
  201. package/src/util/removeAlphaVariables.js +24 -0
  202. package/src/util/resolveConfig.js +86 -91
  203. package/src/util/splitAtTopLevelOnly.js +45 -0
  204. package/src/util/toPath.js +23 -1
  205. package/src/util/transformThemeValue.js +33 -8
  206. package/src/util/validateConfig.js +13 -0
  207. package/src/util/validateFormalSyntax.js +34 -0
  208. package/src/util/withAlphaVariable.js +14 -9
  209. package/stubs/defaultConfig.stub.js +313 -241
  210. package/stubs/simpleConfig.stub.js +1 -1
  211. package/types/config.d.ts +367 -0
  212. package/types/generated/.gitkeep +0 -0
  213. package/types/generated/colors.d.ts +276 -0
  214. package/types/generated/corePluginList.d.ts +1 -0
  215. package/types/generated/default-theme.d.ts +345 -0
  216. package/types/index.d.ts +7 -0
  217. package/CHANGELOG.md +0 -1744
  218. package/lib/lib/setupWatchingContext.js +0 -284
  219. package/nesting/plugin.js +0 -41
  220. package/scripts/install-integrations.js +0 -27
  221. package/scripts/rebuildFixtures.js +0 -68
  222. package/src/lib/setupWatchingContext.js +0 -307
@@ -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
+ }
@@ -5,15 +5,25 @@ import evaluateTailwindFunctions from './lib/evaluateTailwindFunctions'
5
5
  import substituteScreenAtRules from './lib/substituteScreenAtRules'
6
6
  import resolveDefaultsAtRules from './lib/resolveDefaultsAtRules'
7
7
  import collapseAdjacentRules from './lib/collapseAdjacentRules'
8
+ import collapseDuplicateDeclarations from './lib/collapseDuplicateDeclarations'
9
+ import partitionApplyAtRules from './lib/partitionApplyAtRules'
8
10
  import detectNesting from './lib/detectNesting'
9
11
  import { createContext } from './lib/setupContextUtils'
12
+ import { issueFlagNotices } from './featureFlags'
10
13
 
11
14
  export default function processTailwindFeatures(setupContext) {
12
15
  return function (root, result) {
13
- 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)
14
23
 
15
24
  let context = setupContext({
16
25
  tailwindDirectives,
26
+ applyDirectives,
17
27
  registerDependency(dependency) {
18
28
  result.messages.push({
19
29
  plugin: 'tailwindcss',
@@ -22,7 +32,7 @@ export default function processTailwindFeatures(setupContext) {
22
32
  })
23
33
  },
24
34
  createContext(tailwindConfig, changedContent) {
25
- return createContext(tailwindConfig, changedContent, tailwindDirectives, root)
35
+ return createContext(tailwindConfig, changedContent, root)
26
36
  },
27
37
  })(root, result)
28
38
 
@@ -32,12 +42,17 @@ export default function processTailwindFeatures(setupContext) {
32
42
  )
33
43
  }
34
44
 
35
- detectNesting(context)(root, result)
45
+ issueFlagNotices(context.tailwindConfig)
46
+
36
47
  expandTailwindAtRules(context)(root, result)
48
+ // Partition apply rules that are generated by
49
+ // addComponents, addUtilities and so on.
50
+ partitionApplyAtRules()(root, result)
37
51
  expandApplyAtRules(context)(root, result)
38
52
  evaluateTailwindFunctions(context)(root, result)
39
53
  substituteScreenAtRules(context)(root, result)
40
54
  resolveDefaultsAtRules(context)(root, result)
41
55
  collapseAdjacentRules(context)(root, result)
56
+ collapseDuplicateDeclarations(context)(root, result)
42
57
  }
43
58
  }
@@ -0,0 +1,300 @@
1
+ import log from '../util/log'
2
+
3
+ function warn({ version, from, to }) {
4
+ log.warn(`${from}-color-renamed`, [
5
+ `As of Tailwind CSS ${version}, \`${from}\` has been renamed to \`${to}\`.`,
6
+ 'Update your configuration file to silence this warning.',
7
+ ])
8
+ }
9
+
10
+ export default {
11
+ inherit: 'inherit',
12
+ current: 'currentColor',
13
+ transparent: 'transparent',
14
+ black: '#000',
15
+ white: '#fff',
16
+ slate: {
17
+ 50: '#f8fafc',
18
+ 100: '#f1f5f9',
19
+ 200: '#e2e8f0',
20
+ 300: '#cbd5e1',
21
+ 400: '#94a3b8',
22
+ 500: '#64748b',
23
+ 600: '#475569',
24
+ 700: '#334155',
25
+ 800: '#1e293b',
26
+ 900: '#0f172a',
27
+ },
28
+ gray: {
29
+ 50: '#f9fafb',
30
+ 100: '#f3f4f6',
31
+ 200: '#e5e7eb',
32
+ 300: '#d1d5db',
33
+ 400: '#9ca3af',
34
+ 500: '#6b7280',
35
+ 600: '#4b5563',
36
+ 700: '#374151',
37
+ 800: '#1f2937',
38
+ 900: '#111827',
39
+ },
40
+ zinc: {
41
+ 50: '#fafafa',
42
+ 100: '#f4f4f5',
43
+ 200: '#e4e4e7',
44
+ 300: '#d4d4d8',
45
+ 400: '#a1a1aa',
46
+ 500: '#71717a',
47
+ 600: '#52525b',
48
+ 700: '#3f3f46',
49
+ 800: '#27272a',
50
+ 900: '#18181b',
51
+ },
52
+ neutral: {
53
+ 50: '#fafafa',
54
+ 100: '#f5f5f5',
55
+ 200: '#e5e5e5',
56
+ 300: '#d4d4d4',
57
+ 400: '#a3a3a3',
58
+ 500: '#737373',
59
+ 600: '#525252',
60
+ 700: '#404040',
61
+ 800: '#262626',
62
+ 900: '#171717',
63
+ },
64
+ stone: {
65
+ 50: '#fafaf9',
66
+ 100: '#f5f5f4',
67
+ 200: '#e7e5e4',
68
+ 300: '#d6d3d1',
69
+ 400: '#a8a29e',
70
+ 500: '#78716c',
71
+ 600: '#57534e',
72
+ 700: '#44403c',
73
+ 800: '#292524',
74
+ 900: '#1c1917',
75
+ },
76
+ red: {
77
+ 50: '#fef2f2',
78
+ 100: '#fee2e2',
79
+ 200: '#fecaca',
80
+ 300: '#fca5a5',
81
+ 400: '#f87171',
82
+ 500: '#ef4444',
83
+ 600: '#dc2626',
84
+ 700: '#b91c1c',
85
+ 800: '#991b1b',
86
+ 900: '#7f1d1d',
87
+ },
88
+ orange: {
89
+ 50: '#fff7ed',
90
+ 100: '#ffedd5',
91
+ 200: '#fed7aa',
92
+ 300: '#fdba74',
93
+ 400: '#fb923c',
94
+ 500: '#f97316',
95
+ 600: '#ea580c',
96
+ 700: '#c2410c',
97
+ 800: '#9a3412',
98
+ 900: '#7c2d12',
99
+ },
100
+ amber: {
101
+ 50: '#fffbeb',
102
+ 100: '#fef3c7',
103
+ 200: '#fde68a',
104
+ 300: '#fcd34d',
105
+ 400: '#fbbf24',
106
+ 500: '#f59e0b',
107
+ 600: '#d97706',
108
+ 700: '#b45309',
109
+ 800: '#92400e',
110
+ 900: '#78350f',
111
+ },
112
+ yellow: {
113
+ 50: '#fefce8',
114
+ 100: '#fef9c3',
115
+ 200: '#fef08a',
116
+ 300: '#fde047',
117
+ 400: '#facc15',
118
+ 500: '#eab308',
119
+ 600: '#ca8a04',
120
+ 700: '#a16207',
121
+ 800: '#854d0e',
122
+ 900: '#713f12',
123
+ },
124
+ lime: {
125
+ 50: '#f7fee7',
126
+ 100: '#ecfccb',
127
+ 200: '#d9f99d',
128
+ 300: '#bef264',
129
+ 400: '#a3e635',
130
+ 500: '#84cc16',
131
+ 600: '#65a30d',
132
+ 700: '#4d7c0f',
133
+ 800: '#3f6212',
134
+ 900: '#365314',
135
+ },
136
+ green: {
137
+ 50: '#f0fdf4',
138
+ 100: '#dcfce7',
139
+ 200: '#bbf7d0',
140
+ 300: '#86efac',
141
+ 400: '#4ade80',
142
+ 500: '#22c55e',
143
+ 600: '#16a34a',
144
+ 700: '#15803d',
145
+ 800: '#166534',
146
+ 900: '#14532d',
147
+ },
148
+ emerald: {
149
+ 50: '#ecfdf5',
150
+ 100: '#d1fae5',
151
+ 200: '#a7f3d0',
152
+ 300: '#6ee7b7',
153
+ 400: '#34d399',
154
+ 500: '#10b981',
155
+ 600: '#059669',
156
+ 700: '#047857',
157
+ 800: '#065f46',
158
+ 900: '#064e3b',
159
+ },
160
+ teal: {
161
+ 50: '#f0fdfa',
162
+ 100: '#ccfbf1',
163
+ 200: '#99f6e4',
164
+ 300: '#5eead4',
165
+ 400: '#2dd4bf',
166
+ 500: '#14b8a6',
167
+ 600: '#0d9488',
168
+ 700: '#0f766e',
169
+ 800: '#115e59',
170
+ 900: '#134e4a',
171
+ },
172
+ cyan: {
173
+ 50: '#ecfeff',
174
+ 100: '#cffafe',
175
+ 200: '#a5f3fc',
176
+ 300: '#67e8f9',
177
+ 400: '#22d3ee',
178
+ 500: '#06b6d4',
179
+ 600: '#0891b2',
180
+ 700: '#0e7490',
181
+ 800: '#155e75',
182
+ 900: '#164e63',
183
+ },
184
+ sky: {
185
+ 50: '#f0f9ff',
186
+ 100: '#e0f2fe',
187
+ 200: '#bae6fd',
188
+ 300: '#7dd3fc',
189
+ 400: '#38bdf8',
190
+ 500: '#0ea5e9',
191
+ 600: '#0284c7',
192
+ 700: '#0369a1',
193
+ 800: '#075985',
194
+ 900: '#0c4a6e',
195
+ },
196
+ blue: {
197
+ 50: '#eff6ff',
198
+ 100: '#dbeafe',
199
+ 200: '#bfdbfe',
200
+ 300: '#93c5fd',
201
+ 400: '#60a5fa',
202
+ 500: '#3b82f6',
203
+ 600: '#2563eb',
204
+ 700: '#1d4ed8',
205
+ 800: '#1e40af',
206
+ 900: '#1e3a8a',
207
+ },
208
+ indigo: {
209
+ 50: '#eef2ff',
210
+ 100: '#e0e7ff',
211
+ 200: '#c7d2fe',
212
+ 300: '#a5b4fc',
213
+ 400: '#818cf8',
214
+ 500: '#6366f1',
215
+ 600: '#4f46e5',
216
+ 700: '#4338ca',
217
+ 800: '#3730a3',
218
+ 900: '#312e81',
219
+ },
220
+ violet: {
221
+ 50: '#f5f3ff',
222
+ 100: '#ede9fe',
223
+ 200: '#ddd6fe',
224
+ 300: '#c4b5fd',
225
+ 400: '#a78bfa',
226
+ 500: '#8b5cf6',
227
+ 600: '#7c3aed',
228
+ 700: '#6d28d9',
229
+ 800: '#5b21b6',
230
+ 900: '#4c1d95',
231
+ },
232
+ purple: {
233
+ 50: '#faf5ff',
234
+ 100: '#f3e8ff',
235
+ 200: '#e9d5ff',
236
+ 300: '#d8b4fe',
237
+ 400: '#c084fc',
238
+ 500: '#a855f7',
239
+ 600: '#9333ea',
240
+ 700: '#7e22ce',
241
+ 800: '#6b21a8',
242
+ 900: '#581c87',
243
+ },
244
+ fuchsia: {
245
+ 50: '#fdf4ff',
246
+ 100: '#fae8ff',
247
+ 200: '#f5d0fe',
248
+ 300: '#f0abfc',
249
+ 400: '#e879f9',
250
+ 500: '#d946ef',
251
+ 600: '#c026d3',
252
+ 700: '#a21caf',
253
+ 800: '#86198f',
254
+ 900: '#701a75',
255
+ },
256
+ pink: {
257
+ 50: '#fdf2f8',
258
+ 100: '#fce7f3',
259
+ 200: '#fbcfe8',
260
+ 300: '#f9a8d4',
261
+ 400: '#f472b6',
262
+ 500: '#ec4899',
263
+ 600: '#db2777',
264
+ 700: '#be185d',
265
+ 800: '#9d174d',
266
+ 900: '#831843',
267
+ },
268
+ rose: {
269
+ 50: '#fff1f2',
270
+ 100: '#ffe4e6',
271
+ 200: '#fecdd3',
272
+ 300: '#fda4af',
273
+ 400: '#fb7185',
274
+ 500: '#f43f5e',
275
+ 600: '#e11d48',
276
+ 700: '#be123c',
277
+ 800: '#9f1239',
278
+ 900: '#881337',
279
+ },
280
+ get lightBlue() {
281
+ warn({ version: 'v2.2', from: 'lightBlue', to: 'sky' })
282
+ return this.sky
283
+ },
284
+ get warmGray() {
285
+ warn({ version: 'v3.0', from: 'warmGray', to: 'stone' })
286
+ return this.stone
287
+ },
288
+ get trueGray() {
289
+ warn({ version: 'v3.0', from: 'trueGray', to: 'neutral' })
290
+ return this.neutral
291
+ },
292
+ get coolGray() {
293
+ warn({ version: 'v3.0', from: 'coolGray', to: 'gray' })
294
+ return this.gray
295
+ },
296
+ get blueGray() {
297
+ warn({ version: 'v3.0', from: 'blueGray', to: 'slate' })
298
+ return this.slate
299
+ },
300
+ }
@@ -0,0 +1,2 @@
1
+ import createPlugin from '../util/createPlugin'
2
+ export default createPlugin
@@ -0,0 +1,4 @@
1
+ import { cloneDeep } from '../util/cloneDeep'
2
+ import defaultConfig from '../../stubs/defaultConfig.stub'
3
+
4
+ export default cloneDeep(defaultConfig)
@@ -0,0 +1,4 @@
1
+ import { cloneDeep } from '../util/cloneDeep'
2
+ import defaultConfig from '../../stubs/defaultConfig.stub'
3
+
4
+ export default cloneDeep(defaultConfig.theme)
@@ -0,0 +1,7 @@
1
+ import resolveConfigObjects from '../util/resolveConfig'
2
+ import getAllConfigs from '../util/getAllConfigs'
3
+
4
+ export default function resolveConfig(...configs) {
5
+ let [, ...defaultConfigs] = getAllConfigs(configs[0])
6
+ return resolveConfigObjects([...configs, ...defaultConfigs])
7
+ }
@@ -1,24 +1,22 @@
1
1
  export default function buildMediaQuery(screens) {
2
- if (typeof screens === 'string') {
3
- screens = { min: screens }
4
- }
5
-
6
- if (!Array.isArray(screens)) {
7
- screens = [screens]
8
- }
2
+ screens = Array.isArray(screens) ? screens : [screens]
9
3
 
10
4
  return screens
11
5
  .map((screen) => {
12
- if (screen?.hasOwnProperty?.('raw')) {
13
- return screen.raw
14
- }
6
+ let values = screen.values.map((screen) => {
7
+ if (screen.raw !== undefined) {
8
+ return screen.raw
9
+ }
10
+
11
+ return [
12
+ screen.min && `(min-width: ${screen.min})`,
13
+ screen.max && `(max-width: ${screen.max})`,
14
+ ]
15
+ .filter(Boolean)
16
+ .join(' and ')
17
+ })
15
18
 
16
- return Object.entries(screen)
17
- .map(([feature, value]) => {
18
- feature = { min: 'min-width', max: 'max-width' }[feature] ?? feature
19
- return `(${feature}: ${value})`
20
- })
21
- .join(' and ')
19
+ return screen.not ? `not all and ${values}` : values
22
20
  })
23
21
  .join(', ')
24
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
@@ -2,14 +2,21 @@ import namedColors from 'color-name'
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
+ `^(rgb)a?\\(\\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
+ `^(hsl)a?\\(\\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,17 +44,27 @@ 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)
41
48
 
42
- if (match !== null) {
43
- return {
44
- mode: match[1],
45
- color: [match[2], match[3], match[4]].map((v) => v.toString()),
46
- alpha: match[5]?.toString?.(),
47
- }
49
+ if (match === null) {
50
+ return null
48
51
  }
49
52
 
50
- return null
53
+ let color = [match[2], match[3], match[4]].filter(Boolean).map((v) => v.toString())
54
+
55
+ if (!loose && color.length !== 3) {
56
+ return null
57
+ }
58
+
59
+ if (color.length < 3 && !color.some((part) => /^var\(.*?\)$/.test(part))) {
60
+ return null
61
+ }
62
+
63
+ return {
64
+ mode: match[1],
65
+ color,
66
+ alpha: match[5]?.toString?.(),
67
+ }
51
68
  }
52
69
 
53
70
  export function formatColor({ mode, color, alpha }) {
@@ -3,7 +3,7 @@ import transformThemeValue from './transformThemeValue'
3
3
  export default function createUtilityPlugin(
4
4
  themeKey,
5
5
  utilityVariations = [[themeKey, [themeKey]]],
6
- { filterDefault = false, type = 'any' } = {}
6
+ { filterDefault = false, ...options } = {}
7
7
  ) {
8
8
  let transformValue = transformThemeValue(themeKey)
9
9
  return function ({ matchUtilities, theme }) {
@@ -24,12 +24,12 @@ export default function createUtilityPlugin(
24
24
  })
25
25
  }, {}),
26
26
  {
27
+ ...options,
27
28
  values: filterDefault
28
29
  ? Object.fromEntries(
29
30
  Object.entries(theme(themeKey) ?? {}).filter(([modifier]) => modifier !== 'DEFAULT')
30
31
  )
31
32
  : theme(themeKey),
32
- type,
33
33
  }
34
34
  )
35
35
  }