0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

View file

@ -0,0 +1,3 @@
import {Plugin} from 'jss'
export default function jssPluginPropsSort(): Plugin

27
web/node_modules/jss-plugin-props-sort/src/index.js generated vendored Normal file
View file

@ -0,0 +1,27 @@
// @flow
import type {Plugin} from 'jss'
/**
* Sort props by length.
*/
export default function jssPropsSort(): Plugin {
const sort = (prop0, prop1) => {
if (prop0.length === prop1.length) {
return prop0 > prop1 ? 1 : -1
}
return prop0.length - prop1.length
}
return {
onProcessStyle(style, rule) {
if (rule.type !== 'style') return style
const newStyle = {}
const props = Object.keys(style).sort(sort)
for (let i = 0; i < props.length; i++) {
newStyle[props[i]] = style[props[i]]
}
return newStyle
}
}
}