Skip to content

Commit

Permalink
Revert "Prepare for the v3.2.5 release (#10531)"
Browse files Browse the repository at this point in the history
This reverts commit cb46ebd.
  • Loading branch information
RobinMalfait committed Feb 8, 2023
1 parent abe5163 commit 0bf3a7d
Show file tree
Hide file tree
Showing 26 changed files with 825 additions and 325 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Added

- Add `line-height` modifier support to `font-size` utilities ([#9875](https://github.com/tailwindlabs/tailwindcss/pull/9875))
- Support using variables as arbitrary values without `var(...)` ([#9880](https://github.com/tailwindlabs/tailwindcss/pull/9880), [#9962](https://github.com/tailwindlabs/tailwindcss/pull/9962))
- Add `delay-0` and `duration-0` by default ([#10294](https://github.com/tailwindlabs/tailwindcss/pull/10294))
- Add logical properties support for inline direction ([#10166](https://github.com/tailwindlabs/tailwindcss/pull/10166))
- Add `hyphens` utilities ([#10071](https://github.com/tailwindlabs/tailwindcss/pull/10071))
- [Oxide] Use `lightningcss` for nesting and vendor prefixes in PostCSS plugin ([#10399](https://github.com/tailwindlabs/tailwindcss/pull/10399))
- Add support for configuring default `font-variation-settings` for a `font-family` ([#10034](https://github.com/tailwindlabs/tailwindcss/pull/10034), [#10515](https://github.com/tailwindlabs/tailwindcss/pull/10515))
- Add `caption-side` utilities ([#10470](https://github.com/tailwindlabs/tailwindcss/pull/10470))

## [3.2.5] - 2023-02-08

Expand Down
96 changes: 94 additions & 2 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs'
import * as path from 'path'
import postcss from 'postcss'
import { env } from './lib/sharedState'
import createUtilityPlugin from './util/createUtilityPlugin'
import buildMediaQuery from './util/buildMediaQuery'
import escapeClassName from './util/escapeClassName'
Expand Down Expand Up @@ -646,6 +647,8 @@ export let corePlugins = {
['inset-y', ['top', 'bottom']],
],
[
['start', ['inset-inline-start']],
['end', ['inset-inline-end']],
['top', ['top']],
['right', ['right']],
['bottom', ['bottom']],
Expand Down Expand Up @@ -697,6 +700,8 @@ export let corePlugins = {
['my', ['margin-top', 'margin-bottom']],
],
[
['ms', ['margin-inline-start']],
['me', ['margin-inline-end']],
['mt', ['margin-top']],
['mr', ['margin-right']],
['mb', ['margin-bottom']],
Expand Down Expand Up @@ -767,6 +772,13 @@ export let corePlugins = {
})
},

captionSide: ({ addUtilities }) => {
addUtilities({
'.caption-top': { 'caption-side': 'top' },
'.caption-bottom': { 'caption-side': 'bottom' },
})
},

borderCollapse: ({ addUtilities }) => {
addUtilities({
'.border-collapse': { 'border-collapse': 'collapse' },
Expand Down Expand Up @@ -1045,6 +1057,8 @@ export let corePlugins = {
['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
],
[
['scroll-ms', ['scroll-margin-inline-start']],
['scroll-me', ['scroll-margin-inline-end']],
['scroll-mt', ['scroll-margin-top']],
['scroll-mr', ['scroll-margin-right']],
['scroll-mb', ['scroll-margin-bottom']],
Expand All @@ -1061,6 +1075,8 @@ export let corePlugins = {
['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
],
[
['scroll-ps', ['scroll-padding-inline-start']],
['scroll-pe', ['scroll-padding-inline-end']],
['scroll-pt', ['scroll-padding-top']],
['scroll-pr', ['scroll-padding-right']],
['scroll-pb', ['scroll-padding-bottom']],
Expand Down Expand Up @@ -1234,6 +1250,16 @@ export let corePlugins = {
'space-x': (value) => {
value = value === '0' ? '0px' : value

if (env.OXIDE) {
return {
'& > :not([hidden]) ~ :not([hidden])': {
'--tw-space-x-reverse': '0',
'margin-inline-end': `calc(${value} * var(--tw-space-x-reverse))`,
'margin-inline-start': `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`,
},
}
}

return {
'& > :not([hidden]) ~ :not([hidden])': {
'--tw-space-x-reverse': '0',
Expand Down Expand Up @@ -1269,6 +1295,17 @@ export let corePlugins = {
'divide-x': (value) => {
value = value === '0' ? '0px' : value

if (env.OXIDE) {
return {
'& > :not([hidden]) ~ :not([hidden])': {
'@defaults border-width': {},
'--tw-divide-x-reverse': '0',
'border-inline-end-width': `calc(${value} * var(--tw-divide-x-reverse))`,
'border-inline-start-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
},
}
}

return {
'& > :not([hidden]) ~ :not([hidden])': {
'@defaults border-width': {},
Expand Down Expand Up @@ -1436,6 +1473,14 @@ export let corePlugins = {
})
},

hyphens: ({ addUtilities }) => {
addUtilities({
'.hyphens-none': { hyphens: 'none' },
'.hyphens-manual': { hyphens: 'manual' },
'.hyphens-auto': { hyphens: 'auto' },
})
},

whitespace: ({ addUtilities }) => {
addUtilities({
'.whitespace-normal': { 'white-space': 'normal' },
Expand All @@ -1458,12 +1503,18 @@ export let corePlugins = {
borderRadius: createUtilityPlugin('borderRadius', [
['rounded', ['border-radius']],
[
['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
],
[
['rounded-ss', ['border-start-start-radius']],
['rounded-se', ['border-start-end-radius']],
['rounded-ee', ['border-end-end-radius']],
['rounded-es', ['border-end-start-radius']],
['rounded-tl', ['border-top-left-radius']],
['rounded-tr', ['border-top-right-radius']],
['rounded-br', ['border-bottom-right-radius']],
Expand All @@ -1480,6 +1531,8 @@ export let corePlugins = {
['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
],
[
['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
['border-t', [['@defaults border-width', {}], 'border-top-width']],
['border-r', [['@defaults border-width', {}], 'border-right-width']],
['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
Expand Down Expand Up @@ -1562,6 +1615,32 @@ export let corePlugins = {

matchUtilities(
{
'border-s': (value) => {
if (!corePlugins('borderOpacity')) {
return {
'border-inline-start-color': toColorValue(value),
}
}

return withAlphaVariable({
color: value,
property: 'border-inline-start-color',
variable: '--tw-border-opacity',
})
},
'border-e': (value) => {
if (!corePlugins('borderOpacity')) {
return {
'border-inline-end-color': toColorValue(value),
}
}

return withAlphaVariable({
color: value,
property: 'border-inline-end-color',
variable: '--tw-border-opacity',
})
},
'border-t': (value) => {
if (!corePlugins('borderOpacity')) {
return {
Expand Down Expand Up @@ -1798,6 +1877,8 @@ export let corePlugins = {
['py', ['padding-top', 'padding-bottom']],
],
[
['ps', ['padding-inline-start']],
['pe', ['padding-inline-end']],
['pt', ['padding-top']],
['pr', ['padding-right']],
['pb', ['padding-bottom']],
Expand Down Expand Up @@ -1841,13 +1922,16 @@ export let corePlugins = {
font: (value) => {
let [families, options = {}] =
Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
let { fontFeatureSettings } = options
let { fontFeatureSettings, fontVariationSettings } = options

return {
'font-family': Array.isArray(families) ? families.join(', ') : families,
...(fontFeatureSettings === undefined
? {}
: { 'font-feature-settings': fontFeatureSettings }),
...(fontVariationSettings === undefined
? {}
: { 'font-variation-settings': fontVariationSettings }),
}
},
},
Expand All @@ -1861,9 +1945,16 @@ export let corePlugins = {
fontSize: ({ matchUtilities, theme }) => {
matchUtilities(
{
text: (value) => {
text: (value, { modifier }) => {
let [fontSize, options] = Array.isArray(value) ? value : [value]

if (modifier) {
return {
'font-size': fontSize,
'line-height': modifier,
}
}

let { lineHeight, letterSpacing, fontWeight } = isPlainObject(options)
? options
: { lineHeight: options }
Expand All @@ -1878,6 +1969,7 @@ export let corePlugins = {
},
{
values: theme('fontSize'),
modifiers: theme('lineHeight'),
type: ['absolute-size', 'relative-size', 'length', 'percentage'],
}
)
Expand Down
2 changes: 2 additions & 0 deletions src/css/preflight.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
*/

html {
Expand All @@ -32,6 +33,7 @@ html {
tab-size: 4; /* 3 */
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 */
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
}

/*
Expand Down
4 changes: 4 additions & 0 deletions src/util/dataTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const placeholderRe = new RegExp(placeholder, 'g')
// This is not a data type, but rather a function that can normalize the
// correct values.
export function normalize(value, isRoot = true) {
if (value.startsWith('--')) {
return `var(${value})`
}

// Keep raw strings if it starts with `url(`
if (value.includes('url(')) {
return value
Expand Down
12 changes: 10 additions & 2 deletions src/util/pluginUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ export function parseColorFormat(value) {
return value
}

function unwrapArbitraryModifier(modifier) {
modifier = modifier.slice(1, -1)
if (modifier.startsWith('--')) {
modifier = `var(${modifier})`
}
return modifier
}

export function asColor(modifier, options = {}, { tailwindConfig = {} } = {}) {
if (options.values?.[modifier] !== undefined) {
return parseColorFormat(options.values?.[modifier])
Expand All @@ -153,7 +161,7 @@ export function asColor(modifier, options = {}, { tailwindConfig = {} } = {}) {
normalizedColor = parseColorFormat(normalizedColor)

if (isArbitraryValue(alpha)) {
return withAlphaValue(normalizedColor, alpha.slice(1, -1))
return withAlphaValue(normalizedColor, unwrapArbitraryModifier(alpha))
}

if (tailwindConfig.theme?.opacity?.[alpha] === undefined) {
Expand Down Expand Up @@ -287,7 +295,7 @@ export function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
if (configValue !== null) {
utilityModifier = configValue
} else if (isArbitraryValue(utilityModifier)) {
utilityModifier = utilityModifier.slice(1, -1)
utilityModifier = unwrapArbitraryModifier(utilityModifier)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions stubs/defaultConfig.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ module.exports = {
'top-left': 'top left',
},
transitionDelay: {
0: '0s',
75: '75ms',
100: '100ms',
150: '150ms',
Expand All @@ -864,6 +865,7 @@ module.exports = {
},
transitionDuration: {
DEFAULT: '150ms',
0: '0s',
75: '75ms',
100: '100ms',
150: '150ms',
Expand Down
4 changes: 2 additions & 2 deletions tests/any-type.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ crosscheck(({ stable, oxide }) => {
}
.space-x-\[var\(--any-value\)\] > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(var(--any-value) * var(--tw-space-x-reverse));
margin-left: calc(var(--any-value) * calc(1 - var(--tw-space-x-reverse)));
margin-inline-start: calc(var(--any-value) * calc(1 - var(--tw-space-x-reverse)));
margin-inline-end: calc(var(--any-value) * var(--tw-space-x-reverse));
}
.space-y-\[var\(--any-value\)\] > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
Expand Down
16 changes: 8 additions & 8 deletions tests/arbitrary-values.oxide.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,13 @@
}
.space-x-\[20cm\] > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(20cm * var(--tw-space-x-reverse));
margin-left: calc(20cm * calc(1 - var(--tw-space-x-reverse)));
margin-inline-start: calc(20cm * calc(1 - var(--tw-space-x-reverse)));
margin-inline-end: calc(20cm * var(--tw-space-x-reverse));
}
.space-x-\[calc\(20\%-1cm\)\] > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(calc(20% - 1cm) * var(--tw-space-x-reverse));
margin-left: calc(calc(20% - 1cm) * calc(1 - var(--tw-space-x-reverse)));
margin-inline-start: calc(calc(20% - 1cm) * calc(1 - var(--tw-space-x-reverse)));
margin-inline-end: calc(calc(20% - 1cm) * var(--tw-space-x-reverse));
}
.space-y-\[20cm\] > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
Expand All @@ -475,13 +475,13 @@
}
.divide-x-\[20cm\] > :not([hidden]) ~ :not([hidden]) {
--tw-divide-x-reverse: 0;
border-right-width: calc(20cm * var(--tw-divide-x-reverse));
border-left-width: calc(20cm * calc(1 - var(--tw-divide-x-reverse)));
border-inline-end-width: calc(20cm * var(--tw-divide-x-reverse));
border-inline-start-width: calc(20cm * calc(1 - var(--tw-divide-x-reverse)));
}
.divide-x-\[calc\(20\%-1cm\)\] > :not([hidden]) ~ :not([hidden]) {
--tw-divide-x-reverse: 0;
border-right-width: calc(calc(20% - 1cm) * var(--tw-divide-x-reverse));
border-left-width: calc(calc(20% - 1cm) * calc(1 - var(--tw-divide-x-reverse)));
border-inline-end-width: calc(calc(20% - 1cm) * var(--tw-divide-x-reverse));
border-inline-start-width: calc(calc(20% - 1cm) * calc(1 - var(--tw-divide-x-reverse)));
}
.divide-y-\[20cm\] > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 0;
Expand Down
Loading

0 comments on commit 0bf3a7d

Please sign in to comment.