Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new plugin for text-decoration-skip-ink property #69

Merged
merged 8 commits into from
Feb 8, 2019
28 changes: 14 additions & 14 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"dist/css-vendor.js": {
"bundled": 15626,
"minified": 4984,
"gzipped": 1907
"bundled": 16311,
"minified": 5303,
"gzipped": 2011
},
"dist/css-vendor.min.js": {
"bundled": 15626,
"minified": 4984,
"gzipped": 1907
"bundled": 16311,
"minified": 5303,
"gzipped": 2011
},
"./lib/index": {
"bundled": 14406,
"minified": 6274,
"gzipped": 2186
},
"./dist/css-vendor.cjs.js": {
"bundled": 13753,
"minified": 5745,
"gzipped": 1985
"bundled": 14406,
"minified": 6167,
"gzipped": 2096
},
"./dist/css-vendor.esm.js": {
"bundled": 13434,
"minified": 5484,
"gzipped": 1894,
"bundled": 14087,
"minified": 5906,
"gzipped": 1999,
"treeshaked": {
"rollup": {
"code": 3041,
"code": 3318,
"import_statements": 89
},
"webpack": {
"code": 4192
"code": 4497
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@babel/core": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"autoprefixer": "^9.3.1",
"autoprefixer": "^9.4.7",
"babel-cli": "^6.5.1",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.5",
Expand Down Expand Up @@ -82,7 +82,7 @@
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-size-snapshot": "^0.8.0",
"rollup-plugin-terser": "^4.0.3",
"webpack": "^4.15.1",
"webpack": "^4.29.2",
"webpack-cli": "^3.0.8"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import appearence from './appearence'
import breakPropsOld from './break-props-old'
import textDecorationSkipInk from './text-decoration-skip-ink'
import colorAdjust from './color-adjust'
import flex2009 from './flex-2009'
import flex2012 from './flex-2012'
Expand Down Expand Up @@ -35,6 +36,7 @@ const plugins = [
mask,
writingMode,
colorAdjust,
textDecorationSkipInk,
breakPropsOld,
inlineLogicalOld,
unprefixed,
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/text-decoration-skip-ink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import prefix from '../prefix'

// Support old appearance props syntax.
// https://caniuse.com/#feat=text-decoration
export default {
noPrefill: ['text-decoration-skip-ink'],
supportedProperty: prop => {
if (prop !== 'text-decoration-skip-ink') return false
if (prefix.vendor === 'apple') return `${prefix.css}${prop}`
if (prefix.js === 'Webkit' || prefix.js === 'Moz') return prop
return prefix.css + prop
}
}
8 changes: 7 additions & 1 deletion src/prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import isInBrowser from 'is-in-browser'

let js = ''
let css = ''
let vendor = ''

// We should not do anything if required serverside.
if (isInBrowser) {
Expand Down Expand Up @@ -33,6 +34,11 @@ if (isInBrowser) {
js = 'ms'
css = jsCssMap.ms
}

// Correctly detect the Safari browser.
if (js === 'Webkit' && '-apple-trailing-word' in style) {
vendor = 'apple'
}
}

/**
Expand All @@ -41,4 +47,4 @@ if (isInBrowser) {
* @type {{js: String, css: String}}
* @api public
*/
export default {js, css}
export default {js, css, vendor}
Loading