Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move to Sheet.js, wip revamped gradient support

  • Loading branch information...
commit e3f9ca6d0d9830005c2a993e14be05976808e89f 1 parent 0a859d7
@Inviz authored
2  Dependencies/lsd-examples
@@ -1 +1 @@
-Subproject commit c5aa33739d9203974ca17c2ecd43c5312207c776
+Subproject commit 69983ef0be70b6825236671ccd022ac6cc1c41a3
View
1  Source/ART/ART.SVG.js
@@ -67,6 +67,7 @@ ART.SVG.Base.implement({
},
fill: function(color){
+ console.info('fill', color)
var args = arguments;
if ($equals(args, this.filled)) return;
this.filled = args;
View
50 Source/Sheet.js
@@ -9,7 +9,7 @@ license: MIT-style license.
requires:
- ART
-- CSSParser/CSSParser
+- Sheet/Sheet
- Core/Slick.Parser
- Core/Slick.Finder
- Core/Request
@@ -149,36 +149,44 @@ ART.Sheet = {};
onSuccess: function(text) {
var sheet = {}
- var parsed = CSSParser.parse(text);;
- parsed.each(function(rule) {
- var selector = rule.selectors.map(function(selector) {
- return selector.selector.
+ var parsed = Sheet.from(text);
+ for (var i = 0, rules = parsed.rules, rule; rule = rules[i++];) {
+ console.log(rule)
+ var selector = rule.selectorText.
replace(/\.is-/g, ':').
replace(/\.id-/g , '#').
replace(/\.art#/g, '#').
replace(/\.art\./g, '').
replace(/^html \> body /g, '')
- }).join(', ');
- if (!selector.length || (selector.match(/svg|v\\?:|:(?:before|after)|\.container/))) return;
-
+ if (!selector.length || (selector.match(/svg|v\\?:|:(?:before|after)|\.container/))) continue;
+
if (!sheet[selector]) sheet[selector] = {};
- var styles = sheet[selector];
-
- rule.styles.each(function(style) {
- var name = style.name.replace('-art-', '');
- var value = style.value;
+ var hash = sheet[selector];
+
+ for (var j = 0, styles = rule.style, style; style = styles[j++];) {
+ var name = style.replace('-art-', '');
+ var value = styles[style];
var integer = value.toInt();
if ((integer + 'px') == value) {
- styles[name] = integer;
+ hash[name] = integer;
} else {
- if ((value.indexOf('hsb') > -1)
- || (value.indexOf('ART') > -1)
- || (value == 'false')
- || (integer == value) || (value == parseFloat(value))) value = eval(value.replace(/^['"]/, '').replace(/['"]$/, ''));
- styles[name] = value;
+ if (integer == value) {
+ value = integer;
+ } else {
+ var flt = parseFloat(value);
+ if (flt == value) {
+ value = flt;
+ } else {
+ var substring = value.substring(0, 3);
+ if (substring == 'hsb' || substring == 'ART') {
+ value = eval(value)
+ }
+ }
+ }
+ hash[name] = value;
}
- })
- });
+ }
+ }
//console.dir(sheet)
for (var selector in sheet) {
ART.Sheet.define(selector, sheet[selector]);
Please sign in to comment.
Something went wrong with that request. Please try again.