Skip to content

Commit

Permalink
remove #20 patch, use inline-style-prefixer #106, position:sticky #98,…
Browse files Browse the repository at this point in the history
… maybe ie10 support #81
  • Loading branch information
threepointone committed Nov 15, 2016
1 parent 727b146 commit 5e08f10
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 267 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
}
},
"dependencies": {
"fbjs": "^0.8.5"
"fbjs": "^0.8.5",
"inline-style-prefixer": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion src/CSSPropertyOperations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import hyphenateStyleName from 'fbjs/lib/hyphenateStyleName'
import memoizeStringOnly from 'fbjs/lib/memoizeStringOnly'
import warning from 'fbjs/lib/warning'

let processStyleName = memoizeStringOnly(hyphenateStyleName)
export const processStyleName = memoizeStringOnly(hyphenateStyleName)


if (process.env.NODE_ENV !== 'production') {
Expand Down
259 changes: 0 additions & 259 deletions src/autoprefix.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export function speedy(bool) {


// plugins
import { PluginSet, prefixes, fallbacks, bug20fix } from './plugins' // we include these by default
export const plugins = styleSheet.plugins = new PluginSet(fallbacks, bug20fix, prefixes)
import { PluginSet, prefixes, fallbacks } from './plugins' // we include these by default
export const plugins = styleSheet.plugins = new PluginSet(prefixes, fallbacks)
plugins.media = new PluginSet() // neat! media, font-face, keyframes
plugins.fontFace = new PluginSet()
plugins.keyframes = new PluginSet(prefixes)
Expand Down
25 changes: 21 additions & 4 deletions src/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export class PluginSet {
}
}

export function fallbacks(node) {
import { processStyleName } from './CSSPropertyOperations'

export function fallbacks(node) {
let hasArray = Object.keys(node.style).map(x => Array.isArray(node.style[x])).indexOf(true) >= 0
if(hasArray) {
let { style, ...rest } = node
let flattened = Object.keys(style).reduce((o, key) => {
o[key] = Array.isArray(style[key]) ? style[key].join(`; ${key}: `): style[key]
o[key] = Array.isArray(style[key]) ? style[key].join(`; ${processStyleName(key)}: `): style[key]
return o
}, {})
// todo -
Expand All @@ -42,9 +44,24 @@ export function fallbacks(node) {
return node
}

import { autoprefix } from './autoprefix'
import prefixAll from 'inline-style-prefixer/static'

export function prefixes({ style, ...rest }) {
return ({ style: autoprefix(style), ...rest })
return ({ style: prefixAll(style), ...rest })
}

export function positionSticky(node) {
if(node.style.position === 'sticky') {
let { style, ...rest } = node
return ({
style: {
...style,
position: [ 'sticky', '-webkit-sticky' ]
},
...rest
})
}
return node
}

export function bug20fix({ selector, style }) {
Expand Down
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,10 @@ boom@2.x.x:
dependencies:
hoek "2.x.x"

bowser@^1.0.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.5.0.tgz#b97414bacbc631f19f1e2e11466566ec19324983"

brace-expansion@^1.0.0:
version "1.1.6"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
Expand Down Expand Up @@ -2738,6 +2742,10 @@ https-proxy-agent@1.0.0:
debug "2"
extend "3"

hyphenate-style-name@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.2.tgz#31160a36930adaf1fc04c6074f7eb41465d4ec4b"

iconv-lite@~0.4.13, iconv-lite@0.4.13:
version "0.4.13"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"
Expand Down Expand Up @@ -2791,6 +2799,13 @@ ini@~1.3.0:
version "1.3.4"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e"

inline-style-prefixer:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inline-style-prefixer/-/inline-style-prefixer-2.0.4.tgz#3134989ee8723e141161726e0eaaec7db36b413f"
dependencies:
bowser "^1.0.0"
hyphenate-style-name "^1.0.1"

inquirer@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e"
Expand Down

0 comments on commit 5e08f10

Please sign in to comment.