-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove need for
transform
toggle (#4604)
- Loading branch information
1 parent
6f1d5f0
commit b86aa5c
Showing
30 changed files
with
430 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import * as plugins from './plugins/index.js' | ||
import configurePlugins from './util/configurePlugins' | ||
|
||
function move(items, item, before) { | ||
if (items.indexOf(item) === -1) { | ||
return items | ||
} | ||
|
||
items = [...items] | ||
let fromIndex = items.indexOf(item) | ||
let toIndex = items.indexOf(before) | ||
items.splice(fromIndex, 1) | ||
items.splice(toIndex, 0, item) | ||
return items | ||
} | ||
|
||
export default function ({ corePlugins: corePluginConfig }) { | ||
return configurePlugins(corePluginConfig, Object.keys(plugins)).map((pluginName) => { | ||
let pluginOrder = Object.keys(plugins) | ||
|
||
pluginOrder = configurePlugins(corePluginConfig, pluginOrder) | ||
pluginOrder = move(pluginOrder, 'transform', 'transformOrigin') | ||
|
||
return pluginOrder.map((pluginName) => { | ||
return plugins[pluginName]() | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function () { | ||
return createUtilityPlugin('rotate', [['rotate', ['--tw-rotate']]]) | ||
return function ({ config, ...rest }) { | ||
if (config('mode') === 'jit') { | ||
return createUtilityPlugin('rotate', [ | ||
['rotate', ['--tw-rotate', ['transform', 'var(--tw-transform)']]], | ||
])({ config, ...rest }) | ||
} else { | ||
return createUtilityPlugin('rotate', [['rotate', ['--tw-rotate']]])({ config, ...rest }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function () { | ||
return createUtilityPlugin('scale', [ | ||
['scale', ['--tw-scale-x', '--tw-scale-y']], | ||
[ | ||
['scale-x', ['--tw-scale-x']], | ||
['scale-y', ['--tw-scale-y']], | ||
], | ||
]) | ||
return function ({ config, ...rest }) { | ||
if (config('mode') === 'jit') { | ||
return createUtilityPlugin('scale', [ | ||
['scale', ['--tw-scale-x', '--tw-scale-y', ['transform', 'var(--tw-transform)']]], | ||
[ | ||
['scale-x', ['--tw-scale-x', ['transform', 'var(--tw-transform)']]], | ||
['scale-y', ['--tw-scale-y', ['transform', 'var(--tw-transform)']]], | ||
], | ||
])({ config, ...rest }) | ||
} else { | ||
return createUtilityPlugin('scale', [ | ||
['scale', ['--tw-scale-x', '--tw-scale-y']], | ||
[ | ||
['scale-x', ['--tw-scale-x']], | ||
['scale-y', ['--tw-scale-y']], | ||
], | ||
])({ config, ...rest }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function () { | ||
return createUtilityPlugin('skew', [ | ||
[ | ||
['skew-x', ['--tw-skew-x']], | ||
['skew-y', ['--tw-skew-y']], | ||
], | ||
]) | ||
return function ({ config, ...rest }) { | ||
if (config('mode') === 'jit') { | ||
return createUtilityPlugin('skew', [ | ||
[ | ||
['skew-x', ['--tw-skew-x', ['transform', 'var(--tw-transform)']]], | ||
['skew-y', ['--tw-skew-y', ['transform', 'var(--tw-transform)']]], | ||
], | ||
])({ config, ...rest }) | ||
} else { | ||
return createUtilityPlugin('skew', [ | ||
[ | ||
['skew-x', ['--tw-skew-x']], | ||
['skew-y', ['--tw-skew-y']], | ||
], | ||
])({ config, ...rest }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function () { | ||
return createUtilityPlugin('translate', [ | ||
[ | ||
['translate-x', ['--tw-translate-x']], | ||
['translate-y', ['--tw-translate-y']], | ||
], | ||
]) | ||
return function ({ config, ...rest }) { | ||
if (config('mode') === 'jit') { | ||
return createUtilityPlugin('translate', [ | ||
[ | ||
['translate-x', ['--tw-translate-x', ['transform', 'var(--tw-transform)']]], | ||
['translate-y', ['--tw-translate-y', ['transform', 'var(--tw-transform)']]], | ||
], | ||
])({ config, ...rest }) | ||
} else { | ||
return createUtilityPlugin('translate', [ | ||
[ | ||
['translate-x', ['--tw-translate-x']], | ||
['translate-y', ['--tw-translate-y']], | ||
], | ||
])({ config, ...rest }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.