Comparing version
@@ -205,3 +205,3 @@ const cxs = require('cxs').default | ||
if (Array.isArray(content)) { | ||
content.forEach(child => wrapper.appendChild(child)) | ||
content.filter(e => e).forEach(child => wrapper.appendChild(child)) | ||
} else if (typeof content === 'string') { | ||
@@ -208,0 +208,0 @@ wrapper.innerHTML = content |
@@ -13,5 +13,10 @@ function getUnitFallback(value, fallback) { | ||
function getIntegerValue(value) { | ||
return isNaN(value) ? 0 : parseInt(value) | ||
} | ||
module.exports = { | ||
getUnitFallback, | ||
getUnitValue | ||
getUnitValue, | ||
getIntegerValue | ||
} |
@@ -1,1 +0,1 @@ | ||
module.exports = require('./').e | ||
module.exports = require('./').g |
@@ -35,3 +35,3 @@ const xtend = require('xtend') | ||
gr8r, | ||
e: gr8r, | ||
g: gr8r, | ||
addMethod: method => addMethod(method, methods), | ||
@@ -38,0 +38,0 @@ setMethods: methods => setMethods, |
const { | ||
getUnitFallback, | ||
getUnitValue | ||
getUnitValue, | ||
getIntegerValue | ||
} = require('../helpers/values') | ||
@@ -84,2 +85,38 @@ | ||
const flex = { | ||
match: ['xi', 'xx', 'xa', 'xn'], | ||
value: ({ xi, xx, xa, xn }) => { | ||
const val = () => { | ||
if (xi) { | ||
return 'initial' | ||
} else if (xx) { | ||
return '1' | ||
} else if (xa) { | ||
return 'auto' | ||
} else if (xn) { | ||
return 'none' | ||
} | ||
} | ||
return { flex: val() } | ||
} | ||
} | ||
const order = { | ||
match: ['xo', 'xot', 'xob'], | ||
value: ({ xo, xot, xob }) => { | ||
const val = () => { | ||
if (xo !== undefined) { | ||
return getIntegerValue(xo) | ||
} else if (xot) { | ||
return -1 | ||
} else if (xob) { | ||
return 99 | ||
} | ||
} | ||
return { order: val() } | ||
} | ||
} | ||
module.exports = [ | ||
@@ -89,3 +126,5 @@ flexAlign, | ||
flexJustify, | ||
flexWrap | ||
flexWrap, | ||
flex, | ||
order | ||
] |
@@ -17,9 +17,6 @@ const float = { | ||
value: ({cf}) => ({ | ||
':before': { | ||
content: '""', | ||
display: 'table' | ||
}, | ||
':after': { | ||
content: '""', | ||
display: 'table' | ||
display: 'block', | ||
clear: 'both' | ||
} | ||
@@ -26,0 +23,0 @@ }) |
@@ -7,39 +7,47 @@ const { getUnitValue } = require('../helpers/values') | ||
const height = { | ||
match: ['h', 'vh'], | ||
value: ({h, vh}) => { | ||
let val = () => { | ||
if (vh !== undefined) { | ||
return vh + 'vh' | ||
} else if (h !== undefined) { | ||
return getUnitValue(h) | ||
} else { | ||
return undefined | ||
} | ||
const size = { | ||
match: ['w', 'h'], | ||
value: ({w, h}) => { | ||
if (w !== undefined) { | ||
return { width: getUnitValue(w) || 0 } | ||
} else if (h !== undefined) { | ||
return { height: getUnitValue(h) || 0 } | ||
} | ||
return { height: val() } | ||
} | ||
} | ||
const width = { | ||
match: ['w', 'vw'], | ||
value: ({w, vw}) => { | ||
let val = () => { | ||
if (vw !== undefined) { | ||
return vw + 'vw' | ||
} else if (w !== undefined) { | ||
return getUnitValue(w) | ||
} else { | ||
return undefined | ||
} | ||
const viewport = { | ||
match: ['vw', 'vh', 'vwmn', 'vwmx', 'vhmn', 'vhmx'], | ||
value: ({vw, vh, vwmn, vhmn, vwmx, vhmx}) => { | ||
if (vw) { | ||
return { width: vw + 'vw' } | ||
} else if (vh) { | ||
return { height: vh + 'vh' } | ||
} else if (vwmn) { | ||
return { minWidth: vwmn + 'vw' } | ||
} else if (vhmn) { | ||
return { minHeight: vhmn + 'vh' } | ||
} else if (vwmx) { | ||
return { maxWidth: vwmx + 'vw' } | ||
} else if (vhmx) { | ||
return { maxHeight: vhmx + 'vh' } | ||
} | ||
return { width: val() } | ||
} | ||
} | ||
const aspectRatio = { | ||
match: ['ar'], | ||
value: ({ar}) => ({ | ||
':before': { | ||
content: '""', | ||
display: 'block', | ||
paddingTop: ar + '%' | ||
} | ||
}) | ||
} | ||
module.exports = [ | ||
height, | ||
width | ||
size, | ||
viewport, | ||
aspectRatio | ||
] |
{ | ||
"name": "gr8r", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "JS gr8", | ||
"main": "index.js", | ||
"scripts": {}, | ||
"scripts": { | ||
"build": "mkdir -p dist && npm run build-js", | ||
"build-js": "browserify index.js -o dist/index.js" | ||
}, | ||
"author": "Jon-Kyle & Jon Gacnik", | ||
@@ -8,0 +11,0 @@ "license": "ISC", |
28303
4.63%876
5.42%315
2.61%