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

Move truncate to textOverflow #2562

Merged
merged 2 commits into from Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added `overflow-ellipsis` and `overflow-clip` utilities ([#1289](https://github.com/tailwindlabs/tailwindcss/pull/1289))
- Move `truncate` class to `textOverflow` core plugin ([#2562](https://github.com/tailwindlabs/tailwindcss/pull/2562))

## [1.9.2]

Expand Down
72 changes: 36 additions & 36 deletions __tests__/fixtures/tailwind-output-flagged.css
Expand Up @@ -38562,6 +38562,12 @@ video {
--text-opacity: 1;
}

.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.overflow-ellipsis {
text-overflow: ellipsis;
}
Expand Down Expand Up @@ -38792,12 +38798,6 @@ video {
word-break: break-all;
}

.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.w-0 {
width: 0;
}
Expand Down Expand Up @@ -82557,6 +82557,12 @@ video {
--text-opacity: 1;
}

.sm\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.sm\:overflow-ellipsis {
text-overflow: ellipsis;
}
Expand Down Expand Up @@ -82787,12 +82793,6 @@ video {
word-break: break-all;
}

.sm\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.sm\:w-0 {
width: 0;
}
Expand Down Expand Up @@ -126522,6 +126522,12 @@ video {
--text-opacity: 1;
}

.md\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.md\:overflow-ellipsis {
text-overflow: ellipsis;
}
Expand Down Expand Up @@ -126752,12 +126758,6 @@ video {
word-break: break-all;
}

.md\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.md\:w-0 {
width: 0;
}
Expand Down Expand Up @@ -170487,6 +170487,12 @@ video {
--text-opacity: 1;
}

.lg\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.lg\:overflow-ellipsis {
text-overflow: ellipsis;
}
Expand Down Expand Up @@ -170717,12 +170723,6 @@ video {
word-break: break-all;
}

.lg\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.lg\:w-0 {
width: 0;
}
Expand Down Expand Up @@ -214452,6 +214452,12 @@ video {
--text-opacity: 1;
}

.xl\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.xl\:overflow-ellipsis {
text-overflow: ellipsis;
}
Expand Down Expand Up @@ -214682,12 +214688,6 @@ video {
word-break: break-all;
}

.xl\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.xl\:w-0 {
width: 0;
}
Expand Down Expand Up @@ -258417,6 +258417,12 @@ video {
--text-opacity: 1;
}

.\32xl\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.\32xl\:overflow-ellipsis {
text-overflow: ellipsis;
}
Expand Down Expand Up @@ -258647,12 +258653,6 @@ video {
word-break: break-all;
}

.\32xl\:truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.\32xl\:w-0 {
width: 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/featureFlags.js
Expand Up @@ -8,6 +8,7 @@ const featureFlags = {
'purgeLayersByDefault',
'defaultLineHeights',
'standardFontWeights',
'moveTruncateToTextOverflow',
],
experimental: [
'uniformColorPalette',
Expand Down
13 changes: 12 additions & 1 deletion src/plugins/textOverflow.js
@@ -1,7 +1,18 @@
import { flagEnabled } from '../featureFlags'

export default function() {
return function({ addUtilities, variants }) {
return function({ addUtilities, variants, config }) {
addUtilities(
{
...(flagEnabled(config(), 'moveTruncateToTextOverflow')
? {
'.truncate': {
overflow: 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
},
}
: {}),
'.overflow-ellipsis': { 'text-overflow': 'ellipsis' },
'.overflow-clip': { 'text-overflow': 'clip' },
},
Expand Down
18 changes: 12 additions & 6 deletions src/plugins/wordBreak.js
@@ -1,5 +1,7 @@
import { flagEnabled } from '../featureFlags'

export default function() {
return function({ addUtilities, variants }) {
return function({ addUtilities, variants, config }) {
addUtilities(
{
'.break-normal': {
Expand All @@ -15,11 +17,15 @@ export default function() {
},
'.break-all': { 'word-break': 'break-all' },

'.truncate': {
overflow: 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
},
...(!flagEnabled(config(), 'moveTruncateToTextOverflow')
? {
'.truncate': {
overflow: 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
},
}
: {}),
},
variants('wordBreak')
)
Expand Down