tailwindcss 0.0.0-insiders.ea10bb9 → 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 (184) hide show
  1. package/README.md +1 -1
  2. package/lib/cli/build/deps.js +17 -9
  3. package/lib/cli/build/index.js +20 -10
  4. package/lib/cli/build/plugin.js +86 -70
  5. package/lib/cli/build/utils.js +18 -8
  6. package/lib/cli/build/watching.js +16 -12
  7. package/lib/cli/help/index.js +6 -4
  8. package/lib/cli/index.js +222 -10
  9. package/lib/cli/init/index.js +29 -12
  10. package/lib/cli-peer-dependencies.js +12 -4
  11. package/lib/cli.js +4 -226
  12. package/lib/corePluginList.js +7 -1
  13. package/lib/corePlugins.js +348 -75
  14. package/lib/css/preflight.css +2 -0
  15. package/lib/featureFlags.js +27 -15
  16. package/lib/index.js +1 -47
  17. package/lib/lib/cacheInvalidation.js +7 -5
  18. package/lib/lib/collapseAdjacentRules.js +5 -3
  19. package/lib/lib/collapseDuplicateDeclarations.js +12 -10
  20. package/lib/lib/content.js +34 -30
  21. package/lib/lib/defaultExtractor.js +15 -8
  22. package/lib/lib/detectNesting.js +10 -2
  23. package/lib/lib/evaluateTailwindFunctions.js +22 -20
  24. package/lib/lib/expandApplyAtRules.js +43 -35
  25. package/lib/lib/expandTailwindAtRules.js +46 -19
  26. package/lib/lib/findAtConfigPath.js +9 -7
  27. package/lib/lib/generateRules.js +157 -92
  28. package/lib/lib/getModuleDependencies.js +85 -37
  29. package/lib/lib/load-config.js +42 -0
  30. package/lib/lib/normalizeTailwindDirectives.js +5 -3
  31. package/lib/lib/offsets.js +93 -4
  32. package/lib/lib/partitionApplyAtRules.js +3 -1
  33. package/lib/lib/regex.js +21 -7
  34. package/lib/lib/remap-bitfield.js +89 -0
  35. package/lib/lib/resolveDefaultsAtRules.js +28 -24
  36. package/lib/lib/setupContextUtils.js +190 -131
  37. package/lib/lib/setupTrackingContext.js +49 -26
  38. package/lib/lib/sharedState.js +37 -10
  39. package/lib/lib/substituteScreenAtRules.js +5 -3
  40. package/lib/oxide/cli/build/deps.js +89 -0
  41. package/lib/oxide/cli/build/index.js +53 -0
  42. package/lib/oxide/cli/build/plugin.js +375 -0
  43. package/lib/oxide/cli/build/utils.js +87 -0
  44. package/lib/oxide/cli/build/watching.js +179 -0
  45. package/lib/oxide/cli/help/index.js +72 -0
  46. package/lib/oxide/cli/index.js +214 -0
  47. package/lib/oxide/cli/init/index.js +52 -0
  48. package/lib/oxide/cli.js +5 -0
  49. package/lib/oxide/postcss-plugin.js +2 -0
  50. package/lib/plugin.js +98 -0
  51. package/lib/postcss-plugins/nesting/index.js +3 -1
  52. package/lib/postcss-plugins/nesting/plugin.js +10 -8
  53. package/lib/processTailwindFeatures.js +14 -12
  54. package/lib/public/colors.js +49 -25
  55. package/lib/public/create-plugin.js +5 -3
  56. package/lib/public/default-config.js +6 -4
  57. package/lib/public/default-theme.js +6 -4
  58. package/lib/public/load-config.js +12 -0
  59. package/lib/public/resolve-config.js +6 -4
  60. package/lib/util/applyImportantSelector.js +36 -0
  61. package/lib/util/bigSign.js +3 -1
  62. package/lib/util/buildMediaQuery.js +3 -1
  63. package/lib/util/cloneDeep.js +3 -1
  64. package/lib/util/cloneNodes.js +5 -3
  65. package/lib/util/color.js +30 -12
  66. package/lib/util/colorNames.js +752 -0
  67. package/lib/util/configurePlugins.js +3 -1
  68. package/lib/util/createPlugin.js +3 -1
  69. package/lib/util/createUtilityPlugin.js +7 -5
  70. package/lib/util/dataTypes.js +74 -17
  71. package/lib/util/defaults.js +9 -7
  72. package/lib/util/escapeClassName.js +10 -8
  73. package/lib/util/escapeCommas.js +3 -1
  74. package/lib/util/flattenColorPalette.js +3 -1
  75. package/lib/util/formatVariantSelector.js +138 -160
  76. package/lib/util/getAllConfigs.js +8 -6
  77. package/lib/util/hashConfig.js +6 -4
  78. package/lib/util/isKeyframeRule.js +3 -1
  79. package/lib/util/isPlainObject.js +3 -1
  80. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  81. package/lib/util/log.js +8 -4
  82. package/lib/util/nameClass.js +12 -6
  83. package/lib/util/negateValue.js +4 -2
  84. package/lib/util/normalizeConfig.js +28 -27
  85. package/lib/util/normalizeScreens.js +12 -4
  86. package/lib/util/parseAnimationValue.js +3 -1
  87. package/lib/util/parseBoxShadowValue.js +6 -2
  88. package/lib/util/parseDependency.js +3 -1
  89. package/lib/util/parseGlob.js +6 -4
  90. package/lib/util/parseObjectStyles.js +9 -7
  91. package/lib/util/pluginUtils.js +54 -54
  92. package/lib/util/prefixSelector.js +27 -11
  93. package/lib/util/pseudoElements.js +229 -0
  94. package/lib/util/removeAlphaVariables.js +3 -1
  95. package/lib/util/resolveConfig.js +17 -15
  96. package/lib/util/resolveConfigPath.js +26 -10
  97. package/lib/util/responsive.js +6 -4
  98. package/lib/util/splitAtTopLevelOnly.js +10 -2
  99. package/lib/util/tap.js +3 -1
  100. package/lib/util/toColorValue.js +3 -1
  101. package/lib/util/toPath.js +3 -1
  102. package/lib/util/transformThemeValue.js +6 -4
  103. package/lib/util/validateConfig.js +16 -3
  104. package/lib/util/validateFormalSyntax.js +3 -1
  105. package/lib/util/withAlphaVariable.js +6 -2
  106. package/loadConfig.d.ts +4 -0
  107. package/loadConfig.js +2 -0
  108. package/package.json +45 -37
  109. package/peers/index.js +63324 -46417
  110. package/resolveConfig.d.ts +11 -2
  111. package/scripts/swap-engines.js +40 -0
  112. package/src/cli/build/index.js +13 -9
  113. package/src/cli/build/plugin.js +42 -32
  114. package/src/cli/build/watching.js +4 -2
  115. package/src/cli/index.js +216 -3
  116. package/src/cli/init/index.js +37 -8
  117. package/src/cli.js +4 -220
  118. package/src/corePluginList.js +1 -1
  119. package/src/corePlugins.js +207 -32
  120. package/src/css/preflight.css +2 -0
  121. package/src/featureFlags.js +6 -0
  122. package/src/index.js +1 -47
  123. package/src/lib/content.js +12 -17
  124. package/src/lib/defaultExtractor.js +9 -3
  125. package/src/lib/detectNesting.js +9 -1
  126. package/src/lib/expandApplyAtRules.js +8 -1
  127. package/src/lib/expandTailwindAtRules.js +36 -7
  128. package/src/lib/generateRules.js +124 -42
  129. package/src/lib/getModuleDependencies.js +70 -30
  130. package/src/lib/load-config.ts +31 -0
  131. package/src/lib/offsets.js +104 -1
  132. package/src/lib/remap-bitfield.js +82 -0
  133. package/src/lib/setupContextUtils.js +103 -54
  134. package/src/lib/setupTrackingContext.js +36 -11
  135. package/src/lib/sharedState.js +15 -4
  136. package/src/oxide/cli/build/deps.ts +91 -0
  137. package/src/oxide/cli/build/index.ts +47 -0
  138. package/src/oxide/cli/build/plugin.ts +442 -0
  139. package/src/oxide/cli/build/utils.ts +74 -0
  140. package/src/oxide/cli/build/watching.ts +225 -0
  141. package/src/oxide/cli/help/index.ts +69 -0
  142. package/src/oxide/cli/index.ts +204 -0
  143. package/src/oxide/cli/init/index.ts +59 -0
  144. package/src/oxide/cli.ts +1 -0
  145. package/src/oxide/postcss-plugin.ts +1 -0
  146. package/src/plugin.js +107 -0
  147. package/src/public/colors.js +22 -0
  148. package/src/public/default-config.js +1 -1
  149. package/src/public/default-theme.js +2 -2
  150. package/src/public/load-config.js +2 -0
  151. package/src/util/applyImportantSelector.js +27 -0
  152. package/src/util/color.js +18 -3
  153. package/src/util/colorNames.js +150 -0
  154. package/src/util/dataTypes.js +33 -4
  155. package/src/util/formatVariantSelector.js +160 -163
  156. package/src/util/getAllConfigs.js +2 -2
  157. package/src/util/negateValue.js +1 -1
  158. package/src/util/normalizeConfig.js +2 -1
  159. package/src/util/pluginUtils.js +16 -31
  160. package/src/util/prefixSelector.js +28 -10
  161. package/src/util/pseudoElements.js +170 -0
  162. package/src/util/resolveConfigPath.js +12 -1
  163. package/src/util/splitAtTopLevelOnly.js +8 -1
  164. package/src/util/validateConfig.js +13 -0
  165. package/stubs/.gitignore +1 -0
  166. package/stubs/.prettierrc.json +6 -0
  167. package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
  168. package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
  169. package/stubs/postcss.config.js +6 -0
  170. package/stubs/tailwind.config.cjs +2 -0
  171. package/stubs/tailwind.config.js +2 -0
  172. package/stubs/tailwind.config.ts +3 -0
  173. package/types/config.d.ts +15 -9
  174. package/types/generated/colors.d.ts +22 -0
  175. package/types/generated/corePluginList.d.ts +1 -1
  176. package/types/generated/default-theme.d.ts +108 -79
  177. package/CHANGELOG.md +0 -2336
  178. package/lib/cli/shared.js +0 -12
  179. package/lib/constants.js +0 -44
  180. package/scripts/install-integrations.js +0 -27
  181. package/scripts/rebuildFixtures.js +0 -68
  182. package/src/cli/shared.js +0 -5
  183. package/src/constants.js +0 -17
  184. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -150,9 +150,13 @@ export let variantPlugins = {
150
150
 
151
151
  let variants = {
152
152
  group: (_, { modifier }) =>
153
- modifier ? [`:merge(.group\\/${modifier})`, ' &'] : [`:merge(.group)`, ' &'],
153
+ modifier
154
+ ? [`:merge(.group\\/${escapeClassName(modifier)})`, ' &']
155
+ : [`:merge(.group)`, ' &'],
154
156
  peer: (_, { modifier }) =>
155
- modifier ? [`:merge(.peer\\/${modifier})`, ' ~ &'] : [`:merge(.peer)`, ' ~ &'],
157
+ modifier
158
+ ? [`:merge(.peer\\/${escapeClassName(modifier)})`, ' ~ &']
159
+ : [`:merge(.peer)`, ' ~ &'],
156
160
  }
157
161
 
158
162
  for (let [name, fn] of Object.entries(variants)) {
@@ -163,7 +167,30 @@ export let variantPlugins = {
163
167
  if (!result.includes('&')) result = '&' + result
164
168
 
165
169
  let [a, b] = fn('', extra)
166
- return result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
170
+
171
+ let start = null
172
+ let end = null
173
+ let quotes = 0
174
+
175
+ for (let i = 0; i < result.length; ++i) {
176
+ let c = result[i]
177
+ if (c === '&') {
178
+ start = i
179
+ } else if (c === "'" || c === '"') {
180
+ quotes += 1
181
+ } else if (start !== null && c === ' ' && !quotes) {
182
+ end = i
183
+ }
184
+ }
185
+
186
+ if (start !== null && end === null) {
187
+ end = result.length
188
+ }
189
+
190
+ // Basically this but can handle quotes:
191
+ // result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
192
+
193
+ return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end)
167
194
  },
168
195
  { values: Object.fromEntries(pseudoVariants) }
169
196
  )
@@ -171,23 +198,8 @@ export let variantPlugins = {
171
198
  },
172
199
 
173
200
  directionVariants: ({ addVariant }) => {
174
- addVariant('ltr', () => {
175
- log.warn('rtl-experimental', [
176
- 'The RTL features in Tailwind CSS are currently in preview.',
177
- 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
178
- ])
179
-
180
- return '[dir="ltr"] &'
181
- })
182
-
183
- addVariant('rtl', () => {
184
- log.warn('rtl-experimental', [
185
- 'The RTL features in Tailwind CSS are currently in preview.',
186
- 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
187
- ])
188
-
189
- return '[dir="rtl"] &'
190
- })
201
+ addVariant('ltr', ':is([dir="ltr"] &)')
202
+ addVariant('rtl', ':is([dir="rtl"] &)')
191
203
  },
192
204
 
193
205
  reducedMotionVariants: ({ addVariant }) => {
@@ -208,7 +220,7 @@ export let variantPlugins = {
208
220
  }
209
221
 
210
222
  if (mode === 'class') {
211
- addVariant('dark', `${className} &`)
223
+ addVariant('dark', `:is(${className} &)`)
212
224
  } else if (mode === 'media') {
213
225
  addVariant('dark', '@media (prefers-color-scheme: dark)')
214
226
  }
@@ -613,12 +625,14 @@ export let corePlugins = {
613
625
  inset: createUtilityPlugin(
614
626
  'inset',
615
627
  [
616
- ['inset', ['top', 'right', 'bottom', 'left']],
628
+ ['inset', ['inset']],
617
629
  [
618
630
  ['inset-x', ['left', 'right']],
619
631
  ['inset-y', ['top', 'bottom']],
620
632
  ],
621
633
  [
634
+ ['start', ['inset-inline-start']],
635
+ ['end', ['inset-inline-end']],
622
636
  ['top', ['top']],
623
637
  ['right', ['right']],
624
638
  ['bottom', ['bottom']],
@@ -670,6 +684,8 @@ export let corePlugins = {
670
684
  ['my', ['margin-top', 'margin-bottom']],
671
685
  ],
672
686
  [
687
+ ['ms', ['margin-inline-start']],
688
+ ['me', ['margin-inline-end']],
673
689
  ['mt', ['margin-top']],
674
690
  ['mr', ['margin-right']],
675
691
  ['mb', ['margin-bottom']],
@@ -686,6 +702,29 @@ export let corePlugins = {
686
702
  })
687
703
  },
688
704
 
705
+ lineClamp: ({ matchUtilities, addUtilities, theme }) => {
706
+ matchUtilities(
707
+ {
708
+ 'line-clamp': (value) => ({
709
+ overflow: 'hidden',
710
+ display: '-webkit-box',
711
+ '-webkit-box-orient': 'vertical',
712
+ '-webkit-line-clamp': `${value}`,
713
+ }),
714
+ },
715
+ { values: theme('lineClamp') }
716
+ )
717
+
718
+ addUtilities({
719
+ '.line-clamp-none': {
720
+ overflow: 'visible',
721
+ display: 'block',
722
+ '-webkit-box-orient': 'horizontal',
723
+ '-webkit-line-clamp': 'none',
724
+ },
725
+ })
726
+ },
727
+
689
728
  display: ({ addUtilities }) => {
690
729
  addUtilities({
691
730
  '.block': { display: 'block' },
@@ -740,6 +779,13 @@ export let corePlugins = {
740
779
  })
741
780
  },
742
781
 
782
+ captionSide: ({ addUtilities }) => {
783
+ addUtilities({
784
+ '.caption-top': { 'caption-side': 'top' },
785
+ '.caption-bottom': { 'caption-side': 'bottom' },
786
+ })
787
+ },
788
+
743
789
  borderCollapse: ({ addUtilities }) => {
744
790
  addUtilities({
745
791
  '.border-collapse': { 'border-collapse': 'collapse' },
@@ -1018,6 +1064,8 @@ export let corePlugins = {
1018
1064
  ['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
1019
1065
  ],
1020
1066
  [
1067
+ ['scroll-ms', ['scroll-margin-inline-start']],
1068
+ ['scroll-me', ['scroll-margin-inline-end']],
1021
1069
  ['scroll-mt', ['scroll-margin-top']],
1022
1070
  ['scroll-mr', ['scroll-margin-right']],
1023
1071
  ['scroll-mb', ['scroll-margin-bottom']],
@@ -1034,6 +1082,8 @@ export let corePlugins = {
1034
1082
  ['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
1035
1083
  ],
1036
1084
  [
1085
+ ['scroll-ps', ['scroll-padding-inline-start']],
1086
+ ['scroll-pe', ['scroll-padding-inline-end']],
1037
1087
  ['scroll-pt', ['scroll-padding-top']],
1038
1088
  ['scroll-pr', ['scroll-padding-right']],
1039
1089
  ['scroll-pb', ['scroll-padding-bottom']],
@@ -1047,8 +1097,8 @@ export let corePlugins = {
1047
1097
  '.list-outside': { 'list-style-position': 'outside' },
1048
1098
  })
1049
1099
  },
1050
-
1051
1100
  listStyleType: createUtilityPlugin('listStyleType', [['list', ['listStyleType']]]),
1101
+ listStyleImage: createUtilityPlugin('listStyleImage', [['list-image', ['listStyleImage']]]),
1052
1102
 
1053
1103
  appearance: ({ addUtilities }) => {
1054
1104
  addUtilities({
@@ -1153,6 +1203,7 @@ export let corePlugins = {
1153
1203
 
1154
1204
  alignContent: ({ addUtilities }) => {
1155
1205
  addUtilities({
1206
+ '.content-normal': { 'align-content': 'normal' },
1156
1207
  '.content-center': { 'align-content': 'center' },
1157
1208
  '.content-start': { 'align-content': 'flex-start' },
1158
1209
  '.content-end': { 'align-content': 'flex-end' },
@@ -1160,6 +1211,7 @@ export let corePlugins = {
1160
1211
  '.content-around': { 'align-content': 'space-around' },
1161
1212
  '.content-evenly': { 'align-content': 'space-evenly' },
1162
1213
  '.content-baseline': { 'align-content': 'baseline' },
1214
+ '.content-stretch': { 'align-content': 'stretch' },
1163
1215
  })
1164
1216
  },
1165
1217
 
@@ -1175,12 +1227,14 @@ export let corePlugins = {
1175
1227
 
1176
1228
  justifyContent: ({ addUtilities }) => {
1177
1229
  addUtilities({
1230
+ '.justify-normal': { 'justify-content': 'normal' },
1178
1231
  '.justify-start': { 'justify-content': 'flex-start' },
1179
1232
  '.justify-end': { 'justify-content': 'flex-end' },
1180
1233
  '.justify-center': { 'justify-content': 'center' },
1181
1234
  '.justify-between': { 'justify-content': 'space-between' },
1182
1235
  '.justify-around': { 'justify-content': 'space-around' },
1183
1236
  '.justify-evenly': { 'justify-content': 'space-evenly' },
1237
+ '.justify-stretch': { 'justify-content': 'stretch' },
1184
1238
  })
1185
1239
  },
1186
1240
 
@@ -1207,6 +1261,16 @@ export let corePlugins = {
1207
1261
  'space-x': (value) => {
1208
1262
  value = value === '0' ? '0px' : value
1209
1263
 
1264
+ if (__OXIDE__) {
1265
+ return {
1266
+ '& > :not([hidden]) ~ :not([hidden])': {
1267
+ '--tw-space-x-reverse': '0',
1268
+ 'margin-inline-end': `calc(${value} * var(--tw-space-x-reverse))`,
1269
+ 'margin-inline-start': `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`,
1270
+ },
1271
+ }
1272
+ }
1273
+
1210
1274
  return {
1211
1275
  '& > :not([hidden]) ~ :not([hidden])': {
1212
1276
  '--tw-space-x-reverse': '0',
@@ -1242,6 +1306,17 @@ export let corePlugins = {
1242
1306
  'divide-x': (value) => {
1243
1307
  value = value === '0' ? '0px' : value
1244
1308
 
1309
+ if (__OXIDE__) {
1310
+ return {
1311
+ '& > :not([hidden]) ~ :not([hidden])': {
1312
+ '@defaults border-width': {},
1313
+ '--tw-divide-x-reverse': '0',
1314
+ 'border-inline-end-width': `calc(${value} * var(--tw-divide-x-reverse))`,
1315
+ 'border-inline-start-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
1316
+ },
1317
+ }
1318
+ }
1319
+
1245
1320
  return {
1246
1321
  '& > :not([hidden]) ~ :not([hidden])': {
1247
1322
  '@defaults border-width': {},
@@ -1409,6 +1484,14 @@ export let corePlugins = {
1409
1484
  })
1410
1485
  },
1411
1486
 
1487
+ hyphens: ({ addUtilities }) => {
1488
+ addUtilities({
1489
+ '.hyphens-none': { hyphens: 'none' },
1490
+ '.hyphens-manual': { hyphens: 'manual' },
1491
+ '.hyphens-auto': { hyphens: 'auto' },
1492
+ })
1493
+ },
1494
+
1412
1495
  whitespace: ({ addUtilities }) => {
1413
1496
  addUtilities({
1414
1497
  '.whitespace-normal': { 'white-space': 'normal' },
@@ -1416,6 +1499,7 @@ export let corePlugins = {
1416
1499
  '.whitespace-pre': { 'white-space': 'pre' },
1417
1500
  '.whitespace-pre-line': { 'white-space': 'pre-line' },
1418
1501
  '.whitespace-pre-wrap': { 'white-space': 'pre-wrap' },
1502
+ '.whitespace-break-spaces': { 'white-space': 'break-spaces' },
1419
1503
  })
1420
1504
  },
1421
1505
 
@@ -1431,12 +1515,18 @@ export let corePlugins = {
1431
1515
  borderRadius: createUtilityPlugin('borderRadius', [
1432
1516
  ['rounded', ['border-radius']],
1433
1517
  [
1518
+ ['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
1519
+ ['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
1434
1520
  ['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
1435
1521
  ['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
1436
1522
  ['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
1437
1523
  ['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
1438
1524
  ],
1439
1525
  [
1526
+ ['rounded-ss', ['border-start-start-radius']],
1527
+ ['rounded-se', ['border-start-end-radius']],
1528
+ ['rounded-ee', ['border-end-end-radius']],
1529
+ ['rounded-es', ['border-end-start-radius']],
1440
1530
  ['rounded-tl', ['border-top-left-radius']],
1441
1531
  ['rounded-tr', ['border-top-right-radius']],
1442
1532
  ['rounded-br', ['border-bottom-right-radius']],
@@ -1453,6 +1543,8 @@ export let corePlugins = {
1453
1543
  ['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
1454
1544
  ],
1455
1545
  [
1546
+ ['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
1547
+ ['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
1456
1548
  ['border-t', [['@defaults border-width', {}], 'border-top-width']],
1457
1549
  ['border-r', [['@defaults border-width', {}], 'border-right-width']],
1458
1550
  ['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
@@ -1535,6 +1627,32 @@ export let corePlugins = {
1535
1627
 
1536
1628
  matchUtilities(
1537
1629
  {
1630
+ 'border-s': (value) => {
1631
+ if (!corePlugins('borderOpacity')) {
1632
+ return {
1633
+ 'border-inline-start-color': toColorValue(value),
1634
+ }
1635
+ }
1636
+
1637
+ return withAlphaVariable({
1638
+ color: value,
1639
+ property: 'border-inline-start-color',
1640
+ variable: '--tw-border-opacity',
1641
+ })
1642
+ },
1643
+ 'border-e': (value) => {
1644
+ if (!corePlugins('borderOpacity')) {
1645
+ return {
1646
+ 'border-inline-end-color': toColorValue(value),
1647
+ }
1648
+ }
1649
+
1650
+ return withAlphaVariable({
1651
+ color: value,
1652
+ property: 'border-inline-end-color',
1653
+ variable: '--tw-border-opacity',
1654
+ })
1655
+ },
1538
1656
  'border-t': (value) => {
1539
1657
  if (!corePlugins('borderOpacity')) {
1540
1658
  return {
@@ -1631,46 +1749,98 @@ export let corePlugins = {
1631
1749
  return withAlphaValue(value, 0, 'rgb(255 255 255 / 0)')
1632
1750
  }
1633
1751
 
1634
- return function ({ matchUtilities, theme }) {
1752
+ return function ({ matchUtilities, theme, addDefaults }) {
1753
+ addDefaults('gradient-color-stops', {
1754
+ '--tw-gradient-from-position': ' ',
1755
+ '--tw-gradient-via-position': ' ',
1756
+ '--tw-gradient-to-position': ' ',
1757
+ })
1758
+
1635
1759
  let options = {
1636
1760
  values: flattenColorPalette(theme('gradientColorStops')),
1637
1761
  type: ['color', 'any'],
1638
1762
  }
1639
1763
 
1764
+ let positionOptions = {
1765
+ values: theme('gradientColorStopPositions'),
1766
+ type: ['length', 'percentage'],
1767
+ }
1768
+
1640
1769
  matchUtilities(
1641
1770
  {
1642
1771
  from: (value) => {
1643
1772
  let transparentToValue = transparentTo(value)
1644
1773
 
1645
1774
  return {
1646
- '--tw-gradient-from': toColorValue(value, 'from'),
1647
- '--tw-gradient-to': transparentToValue,
1775
+ '@defaults gradient-color-stops': {},
1776
+ '--tw-gradient-from': `${toColorValue(value)} var(--tw-gradient-from-position)`,
1777
+ '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
1648
1778
  '--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to)`,
1649
1779
  }
1650
1780
  },
1651
1781
  },
1652
1782
  options
1653
1783
  )
1784
+
1785
+ matchUtilities(
1786
+ {
1787
+ from: (value) => {
1788
+ return {
1789
+ '--tw-gradient-from-position': value,
1790
+ }
1791
+ },
1792
+ },
1793
+ positionOptions
1794
+ )
1795
+
1654
1796
  matchUtilities(
1655
1797
  {
1656
1798
  via: (value) => {
1657
1799
  let transparentToValue = transparentTo(value)
1658
1800
 
1659
1801
  return {
1660
- '--tw-gradient-to': transparentToValue,
1802
+ '@defaults gradient-color-stops': {},
1803
+ '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
1661
1804
  '--tw-gradient-stops': `var(--tw-gradient-from), ${toColorValue(
1662
- value,
1663
- 'via'
1664
- )}, var(--tw-gradient-to)`,
1805
+ value
1806
+ )} var(--tw-gradient-via-position), var(--tw-gradient-to)`,
1665
1807
  }
1666
1808
  },
1667
1809
  },
1668
1810
  options
1669
1811
  )
1812
+
1670
1813
  matchUtilities(
1671
- { to: (value) => ({ '--tw-gradient-to': toColorValue(value, 'to') }) },
1814
+ {
1815
+ via: (value) => {
1816
+ return {
1817
+ '--tw-gradient-via-position': value,
1818
+ }
1819
+ },
1820
+ },
1821
+ positionOptions
1822
+ )
1823
+
1824
+ matchUtilities(
1825
+ {
1826
+ to: (value) => ({
1827
+ '@defaults gradient-color-stops': {},
1828
+ '--tw-gradient-to': `${toColorValue(value)} var(--tw-gradient-to-position)`,
1829
+ }),
1830
+ },
1672
1831
  options
1673
1832
  )
1833
+
1834
+ matchUtilities(
1835
+ {
1836
+ to: (value) => {
1837
+ return {
1838
+ '--tw-gradient-to-position': value,
1839
+ }
1840
+ },
1841
+ },
1842
+ positionOptions
1843
+ )
1674
1844
  }
1675
1845
  })(),
1676
1846
 
@@ -1771,6 +1941,8 @@ export let corePlugins = {
1771
1941
  ['py', ['padding-top', 'padding-bottom']],
1772
1942
  ],
1773
1943
  [
1944
+ ['ps', ['padding-inline-start']],
1945
+ ['pe', ['padding-inline-end']],
1774
1946
  ['pt', ['padding-top']],
1775
1947
  ['pr', ['padding-right']],
1776
1948
  ['pb', ['padding-bottom']],
@@ -1814,13 +1986,16 @@ export let corePlugins = {
1814
1986
  font: (value) => {
1815
1987
  let [families, options = {}] =
1816
1988
  Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
1817
- let { fontFeatureSettings } = options
1989
+ let { fontFeatureSettings, fontVariationSettings } = options
1818
1990
 
1819
1991
  return {
1820
1992
  'font-family': Array.isArray(families) ? families.join(', ') : families,
1821
1993
  ...(fontFeatureSettings === undefined
1822
1994
  ? {}
1823
1995
  : { 'font-feature-settings': fontFeatureSettings }),
1996
+ ...(fontVariationSettings === undefined
1997
+ ? {}
1998
+ : { 'font-variation-settings': fontVariationSettings }),
1824
1999
  }
1825
2000
  },
1826
2001
  },
@@ -23,6 +23,7 @@
23
23
  3. Use a more readable tab size.
24
24
  4. Use the user's configured `sans` font-family by default.
25
25
  5. Use the user's configured `sans` font-feature-settings by default.
26
+ 6. Use the user's configured `sans` font-variation-settings by default.
26
27
  */
27
28
 
28
29
  html {
@@ -32,6 +33,7 @@ html {
32
33
  tab-size: 4; /* 3 */
33
34
  font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
34
35
  font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
36
+ font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
35
37
  }
36
38
 
37
39
  /*
@@ -4,6 +4,12 @@ import log from './util/log'
4
4
  let defaults = {
5
5
  optimizeUniversalDefaults: false,
6
6
  generalizedModifiers: true,
7
+ get disableColorOpacityUtilitiesByDefault() {
8
+ return __OXIDE__
9
+ },
10
+ get relativeContentPathsByDefault() {
11
+ return __OXIDE__
12
+ },
7
13
  }
8
14
 
9
15
  let featureFlags = {
package/src/index.js CHANGED
@@ -1,47 +1 @@
1
- import setupTrackingContext from './lib/setupTrackingContext'
2
- import processTailwindFeatures from './processTailwindFeatures'
3
- import { env } from './lib/sharedState'
4
- import { findAtConfigPath } from './lib/findAtConfigPath'
5
-
6
- module.exports = function tailwindcss(configOrPath) {
7
- return {
8
- postcssPlugin: 'tailwindcss',
9
- plugins: [
10
- env.DEBUG &&
11
- function (root) {
12
- console.log('\n')
13
- console.time('JIT TOTAL')
14
- return root
15
- },
16
- function (root, result) {
17
- // Use the path for the `@config` directive if it exists, otherwise use the
18
- // path for the file being processed
19
- configOrPath = findAtConfigPath(root, result) ?? configOrPath
20
-
21
- let context = setupTrackingContext(configOrPath)
22
-
23
- if (root.type === 'document') {
24
- let roots = root.nodes.filter((node) => node.type === 'root')
25
-
26
- for (const root of roots) {
27
- if (root.type === 'root') {
28
- processTailwindFeatures(context)(root, result)
29
- }
30
- }
31
-
32
- return
33
- }
34
-
35
- processTailwindFeatures(context)(root, result)
36
- },
37
- env.DEBUG &&
38
- function (root) {
39
- console.timeEnd('JIT TOTAL')
40
- console.log('\n')
41
- return root
42
- },
43
- ].filter(Boolean),
44
- }
45
- }
46
-
47
- module.exports.postcss = true
1
+ module.exports = require('./plugin')
@@ -164,50 +164,45 @@ function resolvePathSymlinks(contentPath) {
164
164
  * @param {any} context
165
165
  * @param {ContentPath[]} candidateFiles
166
166
  * @param {Map<string, number>} fileModifiedMap
167
- * @returns {{ content: string, extension: string }[]}
167
+ * @returns {[{ content: string, extension: string }[], Map<string, number>]}
168
168
  */
169
169
  export function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
170
170
  let changedContent = context.tailwindConfig.content.files
171
171
  .filter((item) => typeof item.raw === 'string')
172
172
  .map(({ raw, extension = 'html' }) => ({ content: raw, extension }))
173
173
 
174
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)) {
175
- let content = fs.readFileSync(changedFile, 'utf8')
174
+ let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap)
175
+
176
+ for (let changedFile of changedFiles) {
176
177
  let extension = path.extname(changedFile).slice(1)
177
- changedContent.push({ content, extension })
178
+ changedContent.push({ file: changedFile, extension })
178
179
  }
179
180
 
180
- return changedContent
181
+ return [changedContent, mTimesToCommit]
181
182
  }
182
183
 
183
184
  /**
184
185
  *
185
186
  * @param {ContentPath[]} candidateFiles
186
187
  * @param {Map<string, number>} fileModifiedMap
187
- * @returns {Set<string>}
188
+ * @returns {[Set<string>, Map<string, number>]}
188
189
  */
189
190
  function resolveChangedFiles(candidateFiles, fileModifiedMap) {
190
191
  let paths = candidateFiles.map((contentPath) => contentPath.pattern)
192
+ let mTimesToCommit = new Map()
191
193
 
192
194
  let changedFiles = new Set()
193
195
  env.DEBUG && console.time('Finding changed files')
194
196
  let files = fastGlob.sync(paths, { absolute: true })
195
197
  for (let file of files) {
196
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity
198
+ let prevModified = fileModifiedMap.get(file) || -Infinity
197
199
  let modified = fs.statSync(file).mtimeMs
198
200
 
199
- // This check is intentionally >= because we track the last modified time of context dependencies
200
- // earier in the process and we want to make sure we don't miss any changes that happen
201
- // when a context dependency is also a content dependency
202
- // Ideally, we'd do all this tracking at one time but that is a larger refactor
203
- // than we want to commit to right now, so this is a decent compromise.
204
- // This should be sufficient because file modification times will be off by at least
205
- // 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
206
- if (modified >= prevModified) {
201
+ if (modified > prevModified) {
207
202
  changedFiles.add(file)
208
- fileModifiedMap.set(file, modified)
203
+ mTimesToCommit.set(file, modified)
209
204
  }
210
205
  }
211
206
  env.DEBUG && console.timeEnd('Finding changed files')
212
- return changedFiles
207
+ return [changedFiles, mTimesToCommit]
213
208
  }
@@ -28,8 +28,14 @@ function* buildRegExps(context) {
28
28
  : ''
29
29
 
30
30
  let utility = regex.any([
31
- // Arbitrary properties
32
- /\[[^\s:'"`]+:[^\s]+\]/,
31
+ // Arbitrary properties (without square brackets)
32
+ /\[[^\s:'"`]+:[^\s\[\]]+\]/,
33
+
34
+ // Arbitrary properties with balanced square brackets
35
+ // This is a targeted fix to continue to allow theme()
36
+ // with square brackets to work in arbitrary properties
37
+ // while fixing a problem with the regex matching too much
38
+ /\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
33
39
 
34
40
  // Utilities
35
41
  regex.pattern([
@@ -184,7 +190,7 @@ function clipAtBalancedParens(input) {
184
190
  // This means that there was an extra closing `]`
185
191
  // We'll clip to just before it
186
192
  if (depth < 0) {
187
- return input.substring(0, match.index)
193
+ return input.substring(0, match.index - 1)
188
194
  }
189
195
 
190
196
  // We've finished balancing the brackets but there still may be characters that can be included
@@ -1,3 +1,11 @@
1
+ function isRoot(node) {
2
+ return node.type === 'root'
3
+ }
4
+
5
+ function isAtLayer(node) {
6
+ return node.type === 'atrule' && node.name === 'layer'
7
+ }
8
+
1
9
  export default function (_context) {
2
10
  return (root, result) => {
3
11
  let found = false
@@ -5,7 +13,7 @@ export default function (_context) {
5
13
  root.walkAtRules('tailwind', (node) => {
6
14
  if (found) return false
7
15
 
8
- if (node.parent && node.parent.type !== 'root') {
16
+ if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
9
17
  found = true
10
18
  node.warn(
11
19
  result,
@@ -3,6 +3,8 @@ import parser from 'postcss-selector-parser'
3
3
 
4
4
  import { resolveMatches } from './generateRules'
5
5
  import escapeClassName from '../util/escapeClassName'
6
+ import { applyImportantSelector } from '../util/applyImportantSelector'
7
+ import { movePseudos } from '../util/pseudoElements'
6
8
 
7
9
  /** @typedef {Map<string, [any, import('postcss').Rule[]]>} ApplyCache */
8
10
 
@@ -555,12 +557,17 @@ function processApply(root, context, localCache) {
555
557
 
556
558
  // And then re-add it if it was removed
557
559
  if (importantSelector && parentSelector !== parent.selector) {
558
- rule.selector = `${importantSelector} ${rule.selector}`
560
+ rule.selector = applyImportantSelector(rule.selector, importantSelector)
559
561
  }
560
562
 
561
563
  rule.walkDecls((d) => {
562
564
  d.important = meta.important || important
563
565
  })
566
+
567
+ // Move pseudo elements to the end of the selector (if necessary)
568
+ let selector = parser().astSync(rule.selector)
569
+ selector.each((sel) => movePseudos(sel))
570
+ rule.selector = selector.toString()
564
571
  })
565
572
  }
566
573