Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order utilities clockwise where applicable #10947

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 50 additions & 66 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,14 +631,12 @@ export let corePlugins = {
['inset-x', ['left', 'right']],
['inset-y', ['top', 'bottom']],
],
[
['start', ['inset-inline-start']],
['end', ['inset-inline-end']],
['top', ['top']],
['right', ['right']],
['bottom', ['bottom']],
['left', ['left']],
],
[['top', ['top']]],
[['right', ['right']]],
[['end', ['inset-inline-end']]],
[['bottom', ['bottom']]],
[['left', ['left']]],
[['start', ['inset-inline-start']]],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should keep start and end as-is? This change would sort it end first then start which seems odd? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Yo @adamwathan what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I put them there on purpose but doing some more research, it looks like the logical ones will be flipped when/if that’s ever supported:

image

So we should go top, right, inline-start, bottom, left, inline-end I think.

],
{ supportsNegativeValues: true }
),
Expand Down Expand Up @@ -684,14 +682,12 @@ export let corePlugins = {
['mx', ['margin-left', 'margin-right']],
['my', ['margin-top', 'margin-bottom']],
],
[
['ms', ['margin-inline-start']],
['me', ['margin-inline-end']],
['mt', ['margin-top']],
['mr', ['margin-right']],
['mb', ['margin-bottom']],
['ml', ['margin-left']],
],
[['mt', ['margin-top']]],
[['mr', ['margin-right']]],
[['me', ['margin-inline-end']]],
[['mb', ['margin-bottom']]],
[['ml', ['margin-left']]],
[['ms', ['margin-inline-start']]],
],
{ supportsNegativeValues: true }
),
Expand Down Expand Up @@ -1064,14 +1060,12 @@ export let corePlugins = {
['scroll-mx', ['scroll-margin-left', 'scroll-margin-right']],
['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']],
['scroll-ml', ['scroll-margin-left']],
],
[['scroll-mt', ['scroll-margin-top']]],
[['scroll-mr', ['scroll-margin-right']]],
[['scroll-me', ['scroll-margin-inline-end']]],
[['scroll-mb', ['scroll-margin-bottom']]],
[['scroll-ml', ['scroll-margin-left']]],
[['scroll-ms', ['scroll-margin-inline-start']]],
],
{ supportsNegativeValues: true }
),
Expand All @@ -1082,14 +1076,12 @@ export let corePlugins = {
['scroll-px', ['scroll-padding-left', 'scroll-padding-right']],
['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']],
['scroll-pl', ['scroll-padding-left']],
],
[['scroll-pt', ['scroll-padding-top']]],
[['scroll-pr', ['scroll-padding-right']]],
[['scroll-pe', ['scroll-padding-inline-end']]],
[['scroll-pb', ['scroll-padding-bottom']]],
[['scroll-pl', ['scroll-padding-left']]],
[['scroll-ps', ['scroll-padding-inline-start']]],
]),

listStylePosition: ({ addUtilities }) => {
Expand Down Expand Up @@ -1515,24 +1507,20 @@ 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']],
['rounded-bl', ['border-bottom-left-radius']],
],
[['rounded-t', ['border-top-left-radius', 'border-top-right-radius']]],
[['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']]],
[['rounded-e', ['border-start-end-radius', 'border-end-end-radius']]],
[['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']]],
[['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']]],
[['rounded-s', ['border-start-start-radius', 'border-end-start-radius']]],
[['rounded-tl', ['border-top-left-radius']]],
[['rounded-ss', ['border-start-start-radius']]],
[['rounded-tr', ['border-top-right-radius']]],
[['rounded-se', ['border-start-end-radius']]],
[['rounded-br', ['border-bottom-right-radius']]],
[['rounded-ee', ['border-end-end-radius']]],
[['rounded-bl', ['border-bottom-left-radius']]],
[['rounded-es', ['border-end-start-radius']]],
]),

borderWidth: createUtilityPlugin(
Expand All @@ -1543,14 +1531,12 @@ export let corePlugins = {
['border-x', [['@defaults border-width', {}], 'border-left-width', 'border-right-width']],
['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']],
['border-l', [['@defaults border-width', {}], 'border-left-width']],
],
[['border-t', [['@defaults border-width', {}], 'border-top-width']]],
[['border-r', [['@defaults border-width', {}], 'border-right-width']]],
[['border-e', [['@defaults border-width', {}], 'border-inline-end-width']]],
[['border-b', [['@defaults border-width', {}], 'border-bottom-width']]],
[['border-l', [['@defaults border-width', {}], 'border-left-width']]],
[['border-s', [['@defaults border-width', {}], 'border-inline-start-width']]],
],
{ type: ['line-width', 'length'] }
),
Expand Down Expand Up @@ -1941,14 +1927,12 @@ export let corePlugins = {
['px', ['padding-left', 'padding-right']],
['py', ['padding-top', 'padding-bottom']],
],
[
['ps', ['padding-inline-start']],
['pe', ['padding-inline-end']],
['pt', ['padding-top']],
['pr', ['padding-right']],
['pb', ['padding-bottom']],
['pl', ['padding-left']],
],
[['pt', ['padding-top']]],
[['pr', ['padding-right']]],
[['pe', ['padding-inline-end']]],
[['pb', ['padding-bottom']]],
[['pl', ['padding-left']]],
[['ps', ['padding-inline-start']]],
]),

textAlign: ({ addUtilities }) => {
Expand Down
24 changes: 12 additions & 12 deletions tests/any-type.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,18 @@ crosscheck(({ stable, oxide }) => {
top: var(--any-value);
bottom: var(--any-value);
}
.top-\[var\(--any-value\)\] {
top: var(--any-value);
}
.right-\[var\(--any-value\)\] {
right: var(--any-value);
}
.bottom-\[var\(--any-value\)\] {
bottom: var(--any-value);
}
.left-\[var\(--any-value\)\] {
left: var(--any-value);
}
.right-\[var\(--any-value\)\] {
right: var(--any-value);
}
.top-\[var\(--any-value\)\] {
top: var(--any-value);
}
.z-\[var\(--any-value\)\] {
z-index: var(--any-value);
}
Expand Down Expand Up @@ -751,18 +751,18 @@ crosscheck(({ stable, oxide }) => {
top: var(--any-value);
bottom: var(--any-value);
}
.top-\[var\(--any-value\)\] {
top: var(--any-value);
}
.right-\[var\(--any-value\)\] {
right: var(--any-value);
}
.bottom-\[var\(--any-value\)\] {
bottom: var(--any-value);
}
.left-\[var\(--any-value\)\] {
left: var(--any-value);
}
.right-\[var\(--any-value\)\] {
right: var(--any-value);
}
.top-\[var\(--any-value\)\] {
top: var(--any-value);
}
.z-\[var\(--any-value\)\] {
z-index: var(--any-value);
}
Expand Down
Loading