11import * as plugins from './plugins/index.js'
22import configurePlugins from './util/configurePlugins'
33
4- function move ( items , item , before ) {
5- if ( items . indexOf ( item ) === - 1 ) {
4+ function move ( items , item , befores ) {
5+ let lowestBefore = - 1
6+
7+ for ( let before of befores ) {
8+ let index = items . indexOf ( before )
9+ if ( index >= 0 && ( index < lowestBefore || lowestBefore === - 1 ) ) {
10+ lowestBefore = index
11+ }
12+ }
13+
14+ if ( items . indexOf ( item ) === - 1 || lowestBefore === - 1 ) {
615 return items
716 }
817
918 items = [ ...items ]
1019 let fromIndex = items . indexOf ( item )
11- let toIndex = items . indexOf ( before )
20+ let toIndex = lowestBefore
1221 items . splice ( fromIndex , 1 )
1322 items . splice ( toIndex , 0 , item )
1423 return items
@@ -18,9 +27,29 @@ export default function ({ corePlugins: corePluginConfig }) {
1827 let pluginOrder = Object . keys ( plugins )
1928
2029 pluginOrder = configurePlugins ( corePluginConfig , pluginOrder )
21- pluginOrder = move ( pluginOrder , 'transform' , 'transformOrigin' )
22- pluginOrder = move ( pluginOrder , 'filter' , 'blur' )
23- pluginOrder = move ( pluginOrder , 'backdropFilter' , 'backdropBlur' )
30+ pluginOrder = move ( pluginOrder , 'transform' , [ 'translate' , 'rotate' , 'skew' , 'scale' ] )
31+ pluginOrder = move ( pluginOrder , 'filter' , [
32+ 'blur' ,
33+ 'brightness' ,
34+ 'contrast' ,
35+ 'dropShadow' ,
36+ 'grayscale' ,
37+ 'hueRotate' ,
38+ 'invert' ,
39+ 'saturate' ,
40+ 'sepia' ,
41+ ] )
42+ pluginOrder = move ( pluginOrder , 'backdropFilter' , [
43+ 'backdropBlur' ,
44+ 'backdropBrightness' ,
45+ 'backdropContrast' ,
46+ 'backdropGrayscale' ,
47+ 'backdropHueRotate' ,
48+ 'backdropInvert' ,
49+ 'backdropOpacity' ,
50+ 'backdropSaturate' ,
51+ 'backdropSepia' ,
52+ ] )
2453
2554 return pluginOrder . map ( ( pluginName ) => {
2655 return plugins [ pluginName ] ( )
0 commit comments