-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from yahoo/refactor
Descendent selectors, pseudo selectors, and overhaul of configuration format
- Loading branch information
Showing
13 changed files
with
1,550 additions
and
3,750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,42 @@ | ||
module.exports = { | ||
// pattern | ||
'display': { | ||
'b': true | ||
'custom': { | ||
uh: '79px', | ||
primary: '#f6a1e1', | ||
l: '$START', | ||
r: '$END' | ||
}, | ||
|
||
// pattern | ||
'border-top': { | ||
custom: [ | ||
{suffix: '1', values: ['1px solid #ccc']} | ||
] | ||
} | ||
breakPoints: { | ||
'sm': '@media(min-width:500px)', | ||
'md': '@media(min-width:900px)', | ||
'lg': '@media(min-width:1200px)' | ||
}, | ||
'classNames': [ | ||
// normal | ||
'Td-u', | ||
'Td-u:h', | ||
'Td-u--sm', | ||
// custom | ||
'foo>W-uh', | ||
'H-uh', | ||
'C-primary', | ||
// rtl | ||
'Fl-start', | ||
'Fl-end', | ||
'Fl-l', | ||
'Fl-r', | ||
// more lengthy then the previous one | ||
'W-1/12', | ||
'W-2/12', | ||
'W-3/12', | ||
'W-4/12', | ||
'W-5/12', | ||
'W-6/12', | ||
'W-7/12', | ||
'W-8/12', | ||
'W-9/12', | ||
'W-10/12', | ||
'W-11/12', | ||
'W-12/12', | ||
'W-1/12--sm' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Future refactor with Atomizer with type declarations. | ||
* Not using TypeScript until 1.5 officially comes out, | ||
* so we can write as close to ES6 as possible (including modules). | ||
* For now, we just declare the interfance and class to serve as | ||
* our implementation contract. | ||
*/ | ||
var Atomizer = (function () { | ||
function Atomizer(rules, options) { | ||
this.rules = rules; | ||
this.verbose = options && options.verbose || false; | ||
} | ||
Atomizer.prototype.findClassNames = function (src) { | ||
return []; | ||
}; | ||
Atomizer.prototype.getCss = function (classNames, config, options) { | ||
return; | ||
}; | ||
Atomizer.prototype.parseClassNames = function (classNames, config) { | ||
return {}; | ||
}; | ||
Atomizer.prototype.getCssFromParseTree = function (parseTree) { | ||
return ''; | ||
}; | ||
Atomizer.grammar = { | ||
'DESC': '[^\\s]+_', | ||
'DIRECT': '[^\\s]+>', | ||
'PROP': '(W-|H-|...)', | ||
'SIGN': '(?:neg)?', | ||
'NUMBER': '[0-9]+(?:\\.[0-9]+)?', | ||
'UNIT': '(?:[a-zA-Z%]+)?', | ||
'HEX': '[0-9a-f]{3}(?:[0-9a-f]{3})?', | ||
'CUSTOM': '[a-zA-Z0-9%\\.]+\\b', | ||
'MOD': '--[a-z]+' | ||
}; | ||
Atomizer.regex = new RegExp([ | ||
'\\b(', | ||
'(?:', | ||
Atomizer.grammar['DESC'], | ||
'|', | ||
Atomizer.grammar['DIRECT'], | ||
')?', | ||
Atomizer.grammar['PROP'], | ||
'(?:', | ||
Atomizer.grammar['SIGN'], | ||
Atomizer.grammar['NUMBER'], | ||
Atomizer.grammar['UNIT'], | ||
'|', | ||
Atomizer.grammar['HEX'], | ||
'|', | ||
Atomizer.grammar['CUSTOM'], | ||
')', | ||
'(?:', | ||
Atomizer.grammar['MOD'], | ||
')?', | ||
')' | ||
].join('')); | ||
return Atomizer; | ||
})(); | ||
// 1.5 | ||
// export Atomizer; |
Oops, something went wrong.