Skip to content

Commit

Permalink
Use [hidden] instead of template in space/divide utilities (#2642)
Browse files Browse the repository at this point in the history
* Use [hidden] instead of template in space/divide utilities

* Update tests
  • Loading branch information
adamwathan authored Oct 21, 2020
1 parent e1ef998 commit cecb078
Show file tree
Hide file tree
Showing 12 changed files with 5,722 additions and 5,722 deletions.
2,880 changes: 1,440 additions & 1,440 deletions __tests__/fixtures/tailwind-output-flagged.css

Large diffs are not rendered by default.

2,880 changes: 1,440 additions & 1,440 deletions __tests__/fixtures/tailwind-output-important.css

Large diffs are not rendered by default.

2,724 changes: 1,362 additions & 1,362 deletions __tests__/fixtures/tailwind-output-no-color-opacity.css

Large diffs are not rendered by default.

2,880 changes: 1,440 additions & 1,440 deletions __tests__/fixtures/tailwind-output.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/plugins/divideColor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('defining color as a function', () => {
expect(utilities).toEqual([
[
{
'.divide-black > :not(template) ~ :not(template)': {
'.divide-black > :not([hidden]) ~ :not([hidden])': {
'border-color': 'black',
},
},
Expand Down
20 changes: 10 additions & 10 deletions __tests__/plugins/divideWidth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,50 @@ test('generating divide width utilities', () => {
expect(utilities).toEqual([
[
{
'.divide-y > :not(template) ~ :not(template)': {
'.divide-y > :not([hidden]) ~ :not([hidden])': {
'--divide-y-reverse': '0',
'border-top-width': 'calc(1px * calc(1 - var(--divide-y-reverse)))',
'border-bottom-width': 'calc(1px * var(--divide-y-reverse))',
},
'.divide-x > :not(template) ~ :not(template)': {
'.divide-x > :not([hidden]) ~ :not([hidden])': {
'--divide-x-reverse': '0',
'border-inline-end-width': 'calc(1px * var(--divide-x-reverse))',
'border-inline-start-width': 'calc(1px * calc(1 - var(--divide-x-reverse)))',
},
'.divide-y-0 > :not(template) ~ :not(template)': {
'.divide-y-0 > :not([hidden]) ~ :not([hidden])': {
'--divide-y-reverse': '0',
'border-top-width': 'calc(0px * calc(1 - var(--divide-y-reverse)))',
'border-bottom-width': 'calc(0px * var(--divide-y-reverse))',
},
'.divide-x-0 > :not(template) ~ :not(template)': {
'.divide-x-0 > :not([hidden]) ~ :not([hidden])': {
'--divide-x-reverse': '0',
'border-inline-end-width': 'calc(0px * var(--divide-x-reverse))',
'border-inline-start-width': 'calc(0px * calc(1 - var(--divide-x-reverse)))',
},
'.divide-y-2 > :not(template) ~ :not(template)': {
'.divide-y-2 > :not([hidden]) ~ :not([hidden])': {
'--divide-y-reverse': '0',
'border-top-width': 'calc(2px * calc(1 - var(--divide-y-reverse)))',
'border-bottom-width': 'calc(2px * var(--divide-y-reverse))',
},
'.divide-x-2 > :not(template) ~ :not(template)': {
'.divide-x-2 > :not([hidden]) ~ :not([hidden])': {
'--divide-x-reverse': '0',
'border-inline-end-width': 'calc(2px * var(--divide-x-reverse))',
'border-inline-start-width': 'calc(2px * calc(1 - var(--divide-x-reverse)))',
},
'.divide-y-4 > :not(template) ~ :not(template)': {
'.divide-y-4 > :not([hidden]) ~ :not([hidden])': {
'--divide-y-reverse': '0',
'border-top-width': 'calc(4px * calc(1 - var(--divide-y-reverse)))',
'border-bottom-width': 'calc(4px * var(--divide-y-reverse))',
},
'.divide-x-4 > :not(template) ~ :not(template)': {
'.divide-x-4 > :not([hidden]) ~ :not([hidden])': {
'--divide-x-reverse': '0',
'border-inline-end-width': 'calc(4px * var(--divide-x-reverse))',
'border-inline-start-width': 'calc(4px * calc(1 - var(--divide-x-reverse)))',
},
'.divide-y-reverse > :not(template) ~ :not(template)': {
'.divide-y-reverse > :not([hidden]) ~ :not([hidden])': {
'--divide-y-reverse': '1',
},
'.divide-x-reverse > :not(template) ~ :not(template)': {
'.divide-x-reverse > :not([hidden]) ~ :not([hidden])': {
'--divide-x-reverse': '1',
},
},
Expand Down
28 changes: 14 additions & 14 deletions __tests__/plugins/space.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,70 +23,70 @@ test('generating space utilities', () => {
expect(utilities).toEqual([
[
{
'.space-y-0 > :not(template) ~ :not(template)': {
'.space-y-0 > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '0',
'margin-top': 'calc(0px * calc(1 - var(--space-y-reverse)))',
'margin-bottom': 'calc(0px * var(--space-y-reverse))',
},
'.space-x-0 > :not(template) ~ :not(template)': {
'.space-x-0 > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '0',
'margin-inline-end': 'calc(0px * var(--space-x-reverse))',
'margin-inline-start': 'calc(0px * calc(1 - var(--space-x-reverse)))',
},
'.space-y-1 > :not(template) ~ :not(template)': {
'.space-y-1 > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '0',
'margin-top': 'calc(1px * calc(1 - var(--space-y-reverse)))',
'margin-bottom': 'calc(1px * var(--space-y-reverse))',
},
'.space-x-1 > :not(template) ~ :not(template)': {
'.space-x-1 > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '0',
'margin-inline-end': 'calc(1px * var(--space-x-reverse))',
'margin-inline-start': 'calc(1px * calc(1 - var(--space-x-reverse)))',
},
'.space-y-2 > :not(template) ~ :not(template)': {
'.space-y-2 > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '0',
'margin-top': 'calc(2px * calc(1 - var(--space-y-reverse)))',
'margin-bottom': 'calc(2px * var(--space-y-reverse))',
},
'.space-x-2 > :not(template) ~ :not(template)': {
'.space-x-2 > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '0',
'margin-inline-end': 'calc(2px * var(--space-x-reverse))',
'margin-inline-start': 'calc(2px * calc(1 - var(--space-x-reverse)))',
},
'.space-y-4 > :not(template) ~ :not(template)': {
'.space-y-4 > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '0',
'margin-top': 'calc(4px * calc(1 - var(--space-y-reverse)))',
'margin-bottom': 'calc(4px * var(--space-y-reverse))',
},
'.space-x-4 > :not(template) ~ :not(template)': {
'.space-x-4 > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '0',
'margin-inline-end': 'calc(4px * var(--space-x-reverse))',
'margin-inline-start': 'calc(4px * calc(1 - var(--space-x-reverse)))',
},
'.-space-y-2 > :not(template) ~ :not(template)': {
'.-space-y-2 > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '0',
'margin-top': 'calc(-2px * calc(1 - var(--space-y-reverse)))',
'margin-bottom': 'calc(-2px * var(--space-y-reverse))',
},
'.-space-x-2 > :not(template) ~ :not(template)': {
'.-space-x-2 > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '0',
'margin-inline-end': 'calc(-2px * var(--space-x-reverse))',
'margin-inline-start': 'calc(-2px * calc(1 - var(--space-x-reverse)))',
},
'.-space-y-1 > :not(template) ~ :not(template)': {
'.-space-y-1 > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '0',
'margin-top': 'calc(-1px * calc(1 - var(--space-y-reverse)))',
'margin-bottom': 'calc(-1px * var(--space-y-reverse))',
},
'.-space-x-1 > :not(template) ~ :not(template)': {
'.-space-x-1 > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '0',
'margin-inline-end': 'calc(-1px * var(--space-x-reverse))',
'margin-inline-start': 'calc(-1px * calc(1 - var(--space-x-reverse)))',
},
'.space-y-reverse > :not(template) ~ :not(template)': {
'.space-y-reverse > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '1',
},
'.space-x-reverse > :not(template) ~ :not(template)': {
'.space-x-reverse > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '1',
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/divideColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function () {
const utilities = _.fromPairs(
_.map(_.omit(colors, 'DEFAULT'), (value, modifier) => {
return [
`${nameClass('divide', modifier)} > :not(template) ~ :not(template)`,
`${nameClass('divide', modifier)} > :not([hidden]) ~ :not([hidden])`,
getProperties(value),
]
})
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/divideOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function () {
const utilities = _.fromPairs(
_.map(theme('divideOpacity'), (value, modifier) => {
return [
`${nameClass('divide-opacity', modifier)} > :not(template) ~ :not(template)`,
`${nameClass('divide-opacity', modifier)} > :not([hidden]) ~ :not([hidden])`,
{
'--divide-opacity': value,
},
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/divideStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ export default function () {
return function ({ addUtilities, variants }) {
addUtilities(
{
'.divide-solid > :not(template) ~ :not(template)': {
'.divide-solid > :not([hidden]) ~ :not([hidden])': {
'border-style': 'solid',
},
'.divide-dashed > :not(template) ~ :not(template)': {
'.divide-dashed > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dashed',
},
'.divide-dotted > :not(template) ~ :not(template)': {
'.divide-dotted > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dotted',
},
'.divide-double > :not(template) ~ :not(template)': {
'.divide-double > :not([hidden]) ~ :not([hidden])': {
'border-style': 'double',
},
'.divide-none > :not(template) ~ :not(template)': {
'.divide-none > :not([hidden]) ~ :not([hidden])': {
'border-style': 'none',
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/divideWidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export default function () {
(_size, modifier) => {
const size = _size === '0' ? '0px' : _size
return {
[`${nameClass('divide-y', modifier)} > :not(template) ~ :not(template)`]: {
[`${nameClass('divide-y', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
'--divide-y-reverse': '0',
'border-top-width': `calc(${size} * calc(1 - var(--divide-y-reverse)))`,
'border-bottom-width': `calc(${size} * var(--divide-y-reverse))`,
},
[`${nameClass('divide-x', modifier)} > :not(template) ~ :not(template)`]: {
[`${nameClass('divide-x', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
'--divide-x-reverse': '0',
'border-inline-end-width': `calc(${size} * var(--divide-x-reverse))`,
'border-inline-start-width': `calc(${size} * calc(1 - var(--divide-x-reverse)))`,
Expand All @@ -27,10 +27,10 @@ export default function () {
return generator(value, modifier)
}),
{
'.divide-y-reverse > :not(template) ~ :not(template)': {
'.divide-y-reverse > :not([hidden]) ~ :not([hidden])': {
'--divide-y-reverse': '1',
},
'.divide-x-reverse > :not(template) ~ :not(template)': {
'.divide-x-reverse > :not([hidden]) ~ :not([hidden])': {
'--divide-x-reverse': '1',
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/space.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export default function () {
(_size, modifier) => {
const size = _size === '0' ? '0px' : _size
return {
[`${nameClass('space-y', modifier)} > :not(template) ~ :not(template)`]: {
[`${nameClass('space-y', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
'--space-y-reverse': '0',
'margin-top': `calc(${size} * calc(1 - var(--space-y-reverse)))`,
'margin-bottom': `calc(${size} * var(--space-y-reverse))`,
},
[`${nameClass('space-x', modifier)} > :not(template) ~ :not(template)`]: {
[`${nameClass('space-x', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
'--space-x-reverse': '0',
'margin-inline-end': `calc(${size} * var(--space-x-reverse))`,
'margin-inline-start': `calc(${size} * calc(1 - var(--space-x-reverse)))`,
Expand All @@ -25,10 +25,10 @@ export default function () {
return [
..._.flatMap(theme('space'), generator),
{
'.space-y-reverse > :not(template) ~ :not(template)': {
'.space-y-reverse > :not([hidden]) ~ :not([hidden])': {
'--space-y-reverse': '1',
},
'.space-x-reverse > :not(template) ~ :not(template)': {
'.space-x-reverse > :not([hidden]) ~ :not([hidden])': {
'--space-x-reverse': '1',
},
},
Expand Down

0 comments on commit cecb078

Please sign in to comment.