Skip to content

Commit 9e34619

Browse files
Add logical properties support for inline direction (#10166)
* ensure we use `npm@7` for older versions of Node.js This is important so that we can guarantee that `workspaces` are supported which we depend on right now (just for install purposes). * tmp: trigger CI build (GitHub is doing funky things and not working right now) * drop Node.js 12 from Node.js CI workflow * focus on Node.js 16 for now * Revert "tmp: trigger CI build (GitHub is doing funky things and not working right now)" This reverts commit a3deed4. * WIP * Add support for logical properties in inline direction * Add scroll-margin/scroll-padding utilities * Update CHANGELOG * Rename inset-s/e to start/end * Update sort order in test * Use logical properties for space/divide in Oxide * run non-oxide and OXIDE tests + fix oxide version tests * drop oxide specific test job The normal `npm run test` will already include the non-oxide and oxide version when running tests. Co-authored-by: Robin Malfait <malfait.robin@gmail.com> Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
1 parent d0ecd29 commit 9e34619

20 files changed

+5323
-1442
lines changed

.github/workflows/nodejs.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
strategy:
2525
matrix:
26-
node-version: [12, 14, 16, 18]
26+
node-version: [16]
2727

2828
steps:
2929
- uses: actions/checkout@v3
@@ -33,6 +33,10 @@ jobs:
3333
node-version: ${{ matrix.node-version }}
3434
# cache: 'npm'
3535

36+
- name: Install newer version of npm on older versions of Node.js
37+
if: matrix.node-version < 16
38+
run: npm install -g npm@7
39+
3640
- name: Cache node_modules
3741
uses: actions/cache@v3
3842
with:
@@ -57,12 +61,9 @@ jobs:
5761
- name: Build Tailwind CSS
5862
run: npx turbo run oxide:build --filter=//
5963

60-
- name: Test (default)
64+
- name: Test
6165
run: npx turbo run test --filter=//
6266

63-
- name: Test (oxide)
64-
run: OXIDE=1 npx turbo run test --filter=//
65-
6667
lint:
6768
runs-on: ubuntu-latest
6869

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Add `--watch=always` option to prevent exit when stdin closes ([#9966](https://github.com/tailwindlabs/tailwindcss/pull/9966))
1515
- Add standalone CLI build for 64-bit Windows on ARM (`node16-win-arm64`) ([#10001](https://github.com/tailwindlabs/tailwindcss/pull/10001))
1616
- Add `delay-0` and `duration-0` by default ([#10294](https://github.com/tailwindlabs/tailwindcss/pull/10294))
17+
- Add logical properties support for inline direction ([#10166](https://github.com/tailwindlabs/tailwindcss/pull/10166))
1718

1819
### Fixed
1920

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"rebuild-fixtures": "npm run build && node -r @swc/register scripts/rebuildFixtures.js",
2424
"style": "eslint .",
2525
"pretest": "npm run generate",
26-
"test": "jest",
26+
"test": "jest && OXIDE=1 jest",
2727
"test:integrations": "npm run test --prefix ./integrations",
2828
"install:integrations": "node scripts/install-integrations.js",
2929
"generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",

src/corePlugins.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from 'fs'
22
import * as path from 'path'
33
import postcss from 'postcss'
4+
import { env } from './lib/sharedState'
45
import createUtilityPlugin from './util/createUtilityPlugin'
56
import buildMediaQuery from './util/buildMediaQuery'
67
import escapeClassName from './util/escapeClassName'
@@ -623,6 +624,8 @@ export let corePlugins = {
623624
['inset-y', ['top', 'bottom']],
624625
],
625626
[
627+
['start', ['inset-inline-start']],
628+
['end', ['inset-inline-end']],
626629
['top', ['top']],
627630
['right', ['right']],
628631
['bottom', ['bottom']],
@@ -674,6 +677,8 @@ export let corePlugins = {
674677
['my', ['margin-top', 'margin-bottom']],
675678
],
676679
[
680+
['ms', ['margin-inline-start']],
681+
['me', ['margin-inline-end']],
677682
['mt', ['margin-top']],
678683
['mr', ['margin-right']],
679684
['mb', ['margin-bottom']],
@@ -1022,6 +1027,8 @@ export let corePlugins = {
10221027
['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
10231028
],
10241029
[
1030+
['scroll-ms', ['scroll-margin-inline-start']],
1031+
['scroll-me', ['scroll-margin-inline-end']],
10251032
['scroll-mt', ['scroll-margin-top']],
10261033
['scroll-mr', ['scroll-margin-right']],
10271034
['scroll-mb', ['scroll-margin-bottom']],
@@ -1038,6 +1045,8 @@ export let corePlugins = {
10381045
['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
10391046
],
10401047
[
1048+
['scroll-ps', ['scroll-padding-inline-start']],
1049+
['scroll-pe', ['scroll-padding-inline-end']],
10411050
['scroll-pt', ['scroll-padding-top']],
10421051
['scroll-pr', ['scroll-padding-right']],
10431052
['scroll-pb', ['scroll-padding-bottom']],
@@ -1211,6 +1220,16 @@ export let corePlugins = {
12111220
'space-x': (value) => {
12121221
value = value === '0' ? '0px' : value
12131222

1223+
if (env.OXIDE) {
1224+
return {
1225+
'& > :not([hidden]) ~ :not([hidden])': {
1226+
'--tw-space-x-reverse': '0',
1227+
'margin-inline-end': `calc(${value} * var(--tw-space-x-reverse))`,
1228+
'margin-inline-start': `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`,
1229+
},
1230+
}
1231+
}
1232+
12141233
return {
12151234
'& > :not([hidden]) ~ :not([hidden])': {
12161235
'--tw-space-x-reverse': '0',
@@ -1246,6 +1265,17 @@ export let corePlugins = {
12461265
'divide-x': (value) => {
12471266
value = value === '0' ? '0px' : value
12481267

1268+
if (env.OXIDE) {
1269+
return {
1270+
'& > :not([hidden]) ~ :not([hidden])': {
1271+
'@defaults border-width': {},
1272+
'--tw-divide-x-reverse': '0',
1273+
'border-inline-end-width': `calc(${value} * var(--tw-divide-x-reverse))`,
1274+
'border-inline-start-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
1275+
},
1276+
}
1277+
}
1278+
12491279
return {
12501280
'& > :not([hidden]) ~ :not([hidden])': {
12511281
'@defaults border-width': {},
@@ -1435,12 +1465,18 @@ export let corePlugins = {
14351465
borderRadius: createUtilityPlugin('borderRadius', [
14361466
['rounded', ['border-radius']],
14371467
[
1468+
['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
1469+
['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
14381470
['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
14391471
['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
14401472
['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
14411473
['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
14421474
],
14431475
[
1476+
['rounded-ss', ['border-start-start-radius']],
1477+
['rounded-se', ['border-start-end-radius']],
1478+
['rounded-ee', ['border-end-end-radius']],
1479+
['rounded-es', ['border-end-start-radius']],
14441480
['rounded-tl', ['border-top-left-radius']],
14451481
['rounded-tr', ['border-top-right-radius']],
14461482
['rounded-br', ['border-bottom-right-radius']],
@@ -1457,6 +1493,8 @@ export let corePlugins = {
14571493
['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
14581494
],
14591495
[
1496+
['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
1497+
['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
14601498
['border-t', [['@defaults border-width', {}], 'border-top-width']],
14611499
['border-r', [['@defaults border-width', {}], 'border-right-width']],
14621500
['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
@@ -1539,6 +1577,32 @@ export let corePlugins = {
15391577

15401578
matchUtilities(
15411579
{
1580+
'border-s': (value) => {
1581+
if (!corePlugins('borderOpacity')) {
1582+
return {
1583+
'border-inline-start-color': toColorValue(value),
1584+
}
1585+
}
1586+
1587+
return withAlphaVariable({
1588+
color: value,
1589+
property: 'border-inline-start-color',
1590+
variable: '--tw-border-opacity',
1591+
})
1592+
},
1593+
'border-e': (value) => {
1594+
if (!corePlugins('borderOpacity')) {
1595+
return {
1596+
'border-inline-end-color': toColorValue(value),
1597+
}
1598+
}
1599+
1600+
return withAlphaVariable({
1601+
color: value,
1602+
property: 'border-inline-end-color',
1603+
variable: '--tw-border-opacity',
1604+
})
1605+
},
15421606
'border-t': (value) => {
15431607
if (!corePlugins('borderOpacity')) {
15441608
return {
@@ -1775,6 +1839,8 @@ export let corePlugins = {
17751839
['py', ['padding-top', 'padding-bottom']],
17761840
],
17771841
[
1842+
['ps', ['padding-inline-start']],
1843+
['pe', ['padding-inline-end']],
17781844
['pt', ['padding-top']],
17791845
['pr', ['padding-right']],
17801846
['pb', ['padding-bottom']],

0 commit comments

Comments
 (0)