From 998f3ffc03a7945fd37e538922074cdfa655f655 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Sat, 17 Oct 2020 20:51:34 -0400 Subject: [PATCH] Move truncate to textOverflow plugin --- .../fixtures/tailwind-output-important.css | 60 +++++++++---------- .../tailwind-output-no-color-opacity.css | 60 +++++++++---------- __tests__/fixtures/tailwind-output.css | 60 +++++++++---------- src/featureFlags.js | 2 +- src/plugins/textOverflow.js | 18 ++---- src/plugins/wordBreak.js | 14 +---- 6 files changed, 98 insertions(+), 116 deletions(-) diff --git a/__tests__/fixtures/tailwind-output-important.css b/__tests__/fixtures/tailwind-output-important.css index e631f91f4..2e202c7c5 100644 --- a/__tests__/fixtures/tailwind-output-important.css +++ b/__tests__/fixtures/tailwind-output-important.css @@ -14674,6 +14674,12 @@ video { --text-opacity: 1 !important; } +.truncate { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; +} + .overflow-ellipsis { text-overflow: ellipsis !important; } @@ -14902,12 +14908,6 @@ video { word-break: break-all !important; } -.truncate { - overflow: hidden !important; - text-overflow: ellipsis !important; - white-space: nowrap !important; -} - .w-0 { width: 0 !important; } @@ -32022,6 +32022,12 @@ video { --text-opacity: 1 !important; } + .sm\:truncate { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + .sm\:overflow-ellipsis { text-overflow: ellipsis !important; } @@ -32250,12 +32256,6 @@ video { word-break: break-all !important; } - .sm\:truncate { - overflow: hidden !important; - text-overflow: ellipsis !important; - white-space: nowrap !important; - } - .sm\:w-0 { width: 0 !important; } @@ -49340,6 +49340,12 @@ video { --text-opacity: 1 !important; } + .md\:truncate { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + .md\:overflow-ellipsis { text-overflow: ellipsis !important; } @@ -49568,12 +49574,6 @@ video { word-break: break-all !important; } - .md\:truncate { - overflow: hidden !important; - text-overflow: ellipsis !important; - white-space: nowrap !important; - } - .md\:w-0 { width: 0 !important; } @@ -66658,6 +66658,12 @@ video { --text-opacity: 1 !important; } + .lg\:truncate { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + .lg\:overflow-ellipsis { text-overflow: ellipsis !important; } @@ -66886,12 +66892,6 @@ video { word-break: break-all !important; } - .lg\:truncate { - overflow: hidden !important; - text-overflow: ellipsis !important; - white-space: nowrap !important; - } - .lg\:w-0 { width: 0 !important; } @@ -83976,6 +83976,12 @@ video { --text-opacity: 1 !important; } + .xl\:truncate { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + .xl\:overflow-ellipsis { text-overflow: ellipsis !important; } @@ -84204,12 +84210,6 @@ video { word-break: break-all !important; } - .xl\:truncate { - overflow: hidden !important; - text-overflow: ellipsis !important; - white-space: nowrap !important; - } - .xl\:w-0 { width: 0 !important; } diff --git a/__tests__/fixtures/tailwind-output-no-color-opacity.css b/__tests__/fixtures/tailwind-output-no-color-opacity.css index c54a4a2b7..6d6861ad7 100644 --- a/__tests__/fixtures/tailwind-output-no-color-opacity.css +++ b/__tests__/fixtures/tailwind-output-no-color-opacity.css @@ -13330,6 +13330,12 @@ video { color: #702459; } +.truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .overflow-ellipsis { text-overflow: ellipsis; } @@ -13558,12 +13564,6 @@ video { word-break: break-all; } -.truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - .w-0 { width: 0; } @@ -29334,6 +29334,12 @@ video { color: #702459; } + .sm\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .sm\:overflow-ellipsis { text-overflow: ellipsis; } @@ -29562,12 +29568,6 @@ video { word-break: break-all; } - .sm\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .sm\:w-0 { width: 0; } @@ -45308,6 +45308,12 @@ video { color: #702459; } + .md\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .md\:overflow-ellipsis { text-overflow: ellipsis; } @@ -45536,12 +45542,6 @@ video { word-break: break-all; } - .md\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .md\:w-0 { width: 0; } @@ -61282,6 +61282,12 @@ video { color: #702459; } + .lg\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .lg\:overflow-ellipsis { text-overflow: ellipsis; } @@ -61510,12 +61516,6 @@ video { word-break: break-all; } - .lg\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .lg\:w-0 { width: 0; } @@ -77256,6 +77256,12 @@ video { color: #702459; } + .xl\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .xl\:overflow-ellipsis { text-overflow: ellipsis; } @@ -77484,12 +77490,6 @@ video { word-break: break-all; } - .xl\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .xl\:w-0 { width: 0; } diff --git a/__tests__/fixtures/tailwind-output.css b/__tests__/fixtures/tailwind-output.css index ddf81b88f..1b3931c5f 100644 --- a/__tests__/fixtures/tailwind-output.css +++ b/__tests__/fixtures/tailwind-output.css @@ -14674,6 +14674,12 @@ video { --text-opacity: 1; } +.truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .overflow-ellipsis { text-overflow: ellipsis; } @@ -14902,12 +14908,6 @@ video { word-break: break-all; } -.truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - .w-0 { width: 0; } @@ -32022,6 +32022,12 @@ video { --text-opacity: 1; } + .sm\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .sm\:overflow-ellipsis { text-overflow: ellipsis; } @@ -32250,12 +32256,6 @@ video { word-break: break-all; } - .sm\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .sm\:w-0 { width: 0; } @@ -49340,6 +49340,12 @@ video { --text-opacity: 1; } + .md\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .md\:overflow-ellipsis { text-overflow: ellipsis; } @@ -49568,12 +49574,6 @@ video { word-break: break-all; } - .md\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .md\:w-0 { width: 0; } @@ -66658,6 +66658,12 @@ video { --text-opacity: 1; } + .lg\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .lg\:overflow-ellipsis { text-overflow: ellipsis; } @@ -66886,12 +66892,6 @@ video { word-break: break-all; } - .lg\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .lg\:w-0 { width: 0; } @@ -83976,6 +83976,12 @@ video { --text-opacity: 1; } + .xl\:truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .xl\:overflow-ellipsis { text-overflow: ellipsis; } @@ -84204,12 +84210,6 @@ video { word-break: break-all; } - .xl\:truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .xl\:w-0 { width: 0; } diff --git a/src/featureFlags.js b/src/featureFlags.js index ed875f35e..76374c427 100644 --- a/src/featureFlags.js +++ b/src/featureFlags.js @@ -3,7 +3,7 @@ import chalk from 'chalk' import log from './util/log' const featureFlags = { - future: ['moveTruncateToTextOverflow'], + future: [], experimental: [ 'uniformColorPalette', 'extendedSpacingScale', diff --git a/src/plugins/textOverflow.js b/src/plugins/textOverflow.js index 0ca2a4b04..9d99aafaf 100644 --- a/src/plugins/textOverflow.js +++ b/src/plugins/textOverflow.js @@ -1,18 +1,12 @@ -import { flagEnabled } from '../featureFlags' - export default function () { - return function ({ addUtilities, variants, config }) { + return function ({ addUtilities, variants }) { addUtilities( { - ...(flagEnabled(config(), 'moveTruncateToTextOverflow') - ? { - '.truncate': { - overflow: 'hidden', - 'text-overflow': 'ellipsis', - 'white-space': 'nowrap', - }, - } - : {}), + '.truncate': { + overflow: 'hidden', + 'text-overflow': 'ellipsis', + 'white-space': 'nowrap', + }, '.overflow-ellipsis': { 'text-overflow': 'ellipsis' }, '.overflow-clip': { 'text-overflow': 'clip' }, }, diff --git a/src/plugins/wordBreak.js b/src/plugins/wordBreak.js index 9c2c99cc9..fb2ef8794 100644 --- a/src/plugins/wordBreak.js +++ b/src/plugins/wordBreak.js @@ -1,7 +1,5 @@ -import { flagEnabled } from '../featureFlags' - export default function () { - return function ({ addUtilities, variants, config }) { + return function ({ addUtilities, variants }) { addUtilities( { '.break-normal': { @@ -12,16 +10,6 @@ export default function () { 'overflow-wrap': 'break-word', }, '.break-all': { 'word-break': 'break-all' }, - - ...(!flagEnabled(config(), 'moveTruncateToTextOverflow') - ? { - '.truncate': { - overflow: 'hidden', - 'text-overflow': 'ellipsis', - 'white-space': 'nowrap', - }, - } - : {}), }, variants('wordBreak') )