Skip to content

Commit ae8b634

Browse files
authored
Move truncate to textOverflow (#2562)
* Move truncate to textOverflow * Update changelog
1 parent 7744b5a commit ae8b634

5 files changed

Lines changed: 62 additions & 43 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

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

1415
## [1.9.2]
1516

__tests__/fixtures/tailwind-output-flagged.css

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38562,6 +38562,12 @@ video {
3856238562
--text-opacity: 1;
3856338563
}
3856438564

38565+
.truncate {
38566+
overflow: hidden;
38567+
text-overflow: ellipsis;
38568+
white-space: nowrap;
38569+
}
38570+
3856538571
.overflow-ellipsis {
3856638572
text-overflow: ellipsis;
3856738573
}
@@ -38792,12 +38798,6 @@ video {
3879238798
word-break: break-all;
3879338799
}
3879438800

38795-
.truncate {
38796-
overflow: hidden;
38797-
text-overflow: ellipsis;
38798-
white-space: nowrap;
38799-
}
38800-
3880138801
.w-0 {
3880238802
width: 0;
3880338803
}
@@ -82557,6 +82557,12 @@ video {
8255782557
--text-opacity: 1;
8255882558
}
8255982559

82560+
.sm\:truncate {
82561+
overflow: hidden;
82562+
text-overflow: ellipsis;
82563+
white-space: nowrap;
82564+
}
82565+
8256082566
.sm\:overflow-ellipsis {
8256182567
text-overflow: ellipsis;
8256282568
}
@@ -82787,12 +82793,6 @@ video {
8278782793
word-break: break-all;
8278882794
}
8278982795

82790-
.sm\:truncate {
82791-
overflow: hidden;
82792-
text-overflow: ellipsis;
82793-
white-space: nowrap;
82794-
}
82795-
8279682796
.sm\:w-0 {
8279782797
width: 0;
8279882798
}
@@ -126522,6 +126522,12 @@ video {
126522126522
--text-opacity: 1;
126523126523
}
126524126524

126525+
.md\:truncate {
126526+
overflow: hidden;
126527+
text-overflow: ellipsis;
126528+
white-space: nowrap;
126529+
}
126530+
126525126531
.md\:overflow-ellipsis {
126526126532
text-overflow: ellipsis;
126527126533
}
@@ -126752,12 +126758,6 @@ video {
126752126758
word-break: break-all;
126753126759
}
126754126760

126755-
.md\:truncate {
126756-
overflow: hidden;
126757-
text-overflow: ellipsis;
126758-
white-space: nowrap;
126759-
}
126760-
126761126761
.md\:w-0 {
126762126762
width: 0;
126763126763
}
@@ -170487,6 +170487,12 @@ video {
170487170487
--text-opacity: 1;
170488170488
}
170489170489

170490+
.lg\:truncate {
170491+
overflow: hidden;
170492+
text-overflow: ellipsis;
170493+
white-space: nowrap;
170494+
}
170495+
170490170496
.lg\:overflow-ellipsis {
170491170497
text-overflow: ellipsis;
170492170498
}
@@ -170717,12 +170723,6 @@ video {
170717170723
word-break: break-all;
170718170724
}
170719170725

170720-
.lg\:truncate {
170721-
overflow: hidden;
170722-
text-overflow: ellipsis;
170723-
white-space: nowrap;
170724-
}
170725-
170726170726
.lg\:w-0 {
170727170727
width: 0;
170728170728
}
@@ -214452,6 +214452,12 @@ video {
214452214452
--text-opacity: 1;
214453214453
}
214454214454

214455+
.xl\:truncate {
214456+
overflow: hidden;
214457+
text-overflow: ellipsis;
214458+
white-space: nowrap;
214459+
}
214460+
214455214461
.xl\:overflow-ellipsis {
214456214462
text-overflow: ellipsis;
214457214463
}
@@ -214682,12 +214688,6 @@ video {
214682214688
word-break: break-all;
214683214689
}
214684214690

214685-
.xl\:truncate {
214686-
overflow: hidden;
214687-
text-overflow: ellipsis;
214688-
white-space: nowrap;
214689-
}
214690-
214691214691
.xl\:w-0 {
214692214692
width: 0;
214693214693
}
@@ -258417,6 +258417,12 @@ video {
258417258417
--text-opacity: 1;
258418258418
}
258419258419

258420+
.\32xl\:truncate {
258421+
overflow: hidden;
258422+
text-overflow: ellipsis;
258423+
white-space: nowrap;
258424+
}
258425+
258420258426
.\32xl\:overflow-ellipsis {
258421258427
text-overflow: ellipsis;
258422258428
}
@@ -258647,12 +258653,6 @@ video {
258647258653
word-break: break-all;
258648258654
}
258649258655

258650-
.\32xl\:truncate {
258651-
overflow: hidden;
258652-
text-overflow: ellipsis;
258653-
white-space: nowrap;
258654-
}
258655-
258656258656
.\32xl\:w-0 {
258657258657
width: 0;
258658258658
}

src/featureFlags.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const featureFlags = {
88
'purgeLayersByDefault',
99
'defaultLineHeights',
1010
'standardFontWeights',
11+
'moveTruncateToTextOverflow',
1112
],
1213
experimental: [
1314
'uniformColorPalette',

src/plugins/textOverflow.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
import { flagEnabled } from '../featureFlags'
2+
13
export default function() {
2-
return function({ addUtilities, variants }) {
4+
return function({ addUtilities, variants, config }) {
35
addUtilities(
46
{
7+
...(flagEnabled(config(), 'moveTruncateToTextOverflow')
8+
? {
9+
'.truncate': {
10+
overflow: 'hidden',
11+
'text-overflow': 'ellipsis',
12+
'white-space': 'nowrap',
13+
},
14+
}
15+
: {}),
516
'.overflow-ellipsis': { 'text-overflow': 'ellipsis' },
617
'.overflow-clip': { 'text-overflow': 'clip' },
718
},

src/plugins/wordBreak.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { flagEnabled } from '../featureFlags'
2+
13
export default function() {
2-
return function({ addUtilities, variants }) {
4+
return function({ addUtilities, variants, config }) {
35
addUtilities(
46
{
57
'.break-normal': {
@@ -15,11 +17,15 @@ export default function() {
1517
},
1618
'.break-all': { 'word-break': 'break-all' },
1719

18-
'.truncate': {
19-
overflow: 'hidden',
20-
'text-overflow': 'ellipsis',
21-
'white-space': 'nowrap',
22-
},
20+
...(!flagEnabled(config(), 'moveTruncateToTextOverflow')
21+
? {
22+
'.truncate': {
23+
overflow: 'hidden',
24+
'text-overflow': 'ellipsis',
25+
'white-space': 'nowrap',
26+
},
27+
}
28+
: {}),
2329
},
2430
variants('wordBreak')
2531
)

0 commit comments

Comments
 (0)