Comparing version 0.0.5 to 0.0.6
@@ -1,3 +0,3 @@ | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("serialize")?_1.serialize:_1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
@@ -4,0 +4,0 @@ var Token = homunculus.getClass('token', 'css'); |
@@ -1,2 +0,2 @@ | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
@@ -3,0 +3,0 @@ var Token = homunculus.getClass('token', 'jsx'); |
@@ -1,4 +0,4 @@ | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("join")?_1.join:_1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("sort")?_2.sort:_2.hasOwnProperty("default")?_2["default"]:_2}(); | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("default")?_2["default"]:_2}(); | ||
@@ -54,3 +54,2 @@ var Token = homunculus.getClass('token', 'css'); | ||
function record(sel, idx, styles, res) { | ||
var first = sel[0]; | ||
var _p = 0; | ||
@@ -76,6 +75,22 @@ var now = res; | ||
sort(list, function(a, b) { | ||
return a < b; | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = list[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(list.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(list[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
s = list.join(''); | ||
} | ||
else if(s == '*') { | ||
now['_*'] = true; | ||
} | ||
now[s] = now[s] || {}; | ||
@@ -95,2 +110,3 @@ now = now[s]; | ||
if(!prev || prev.type() != Token.SELECTOR) { | ||
now['_*'] = true; | ||
now['*'] = now['*'] || {}; | ||
@@ -100,7 +116,40 @@ now = now['*']; | ||
else if(prev) { | ||
var selTemp = []; | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
//可能有多个tag.class#id:pseudo | ||
while(prev && prev.type() == Token.SELECTOR) { | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
i--; | ||
} | ||
sort(selTemp, function(a, b) { | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = selTemp[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(selTemp.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(selTemp.length > 1) { | ||
if(selTemp[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
else { | ||
now['_*'] = true; | ||
} | ||
} | ||
s = selTemp.join(''); | ||
now[s] = now[s] || {}; | ||
now = now[s]; | ||
i--; | ||
_p += priority(prev, s); | ||
} | ||
@@ -155,2 +204,3 @@ //伪类都存在_:对象下,是个数组 | ||
case ']': | ||
//TODO: 选择器和属性很特殊,可以交叉:div[attr].class[attr] | ||
var list = []; | ||
@@ -182,2 +232,3 @@ var item; | ||
if(!prev || prev.type() != Token.SELECTOR) { | ||
now['_*'] = true; | ||
now['*'] = now['*'] || {}; | ||
@@ -187,6 +238,38 @@ now = now['*']; | ||
else { | ||
var selTemp = []; | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
while(prev && prev.type() == Token.SELECTOR) { | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
i--; | ||
} | ||
sort(selTemp, function(a, b) { | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = selTemp[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(selTemp.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(selTemp.length > 1) { | ||
if(selTemp[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
else { | ||
now['_*'] = true; | ||
} | ||
} | ||
s = selTemp.join(''); | ||
now[s] = now[s] || {}; | ||
now = now[s]; | ||
_p += priority(prev, s); | ||
} | ||
@@ -238,2 +321,3 @@ //属性都存在_[对象下,是个数组 | ||
break; | ||
//TODO: attr和pseudo混杂的情况 | ||
} | ||
@@ -240,0 +324,0 @@ break; |
{ | ||
"name": "jaw", | ||
"version": "0.0.5", | ||
"description": "Parasitize CSS to JSX", | ||
"version": "0.0.6", | ||
"description": "Parasitize CSS to JSX for migi", | ||
"maintainers": [ | ||
@@ -20,4 +20,3 @@ { | ||
"javascript", | ||
"user interface", | ||
"mvvm" | ||
"serialize css" | ||
], | ||
@@ -47,4 +46,3 @@ "author": "army8735", | ||
"through2": "^0.6.1", | ||
"jsdc": "^0.6.5", | ||
"spm": "~3.6.0" | ||
"jsdc": "^0.6.7" | ||
}, | ||
@@ -51,0 +49,0 @@ "main": "./index", |
@@ -54,3 +54,2 @@ import homunculus from 'homunculus'; | ||
function record(sel, idx, styles, res) { | ||
var first = sel[0]; | ||
var _p = 0; | ||
@@ -76,6 +75,22 @@ var now = res; | ||
sort(list, function(a, b) { | ||
return a < b; | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = list[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(list.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(list[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
s = list.join(''); | ||
} | ||
else if(s == '*') { | ||
now['_*'] = true; | ||
} | ||
now[s] = now[s] || {}; | ||
@@ -95,2 +110,3 @@ now = now[s]; | ||
if(!prev || prev.type() != Token.SELECTOR) { | ||
now['_*'] = true; | ||
now['*'] = now['*'] || {}; | ||
@@ -100,7 +116,40 @@ now = now['*']; | ||
else if(prev) { | ||
var selTemp = []; | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
//可能有多个tag.class#id:pseudo | ||
while(prev && prev.type() == Token.SELECTOR) { | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
i--; | ||
} | ||
sort(selTemp, function(a, b) { | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = selTemp[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(selTemp.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(selTemp.length > 1) { | ||
if(selTemp[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
else { | ||
now['_*'] = true; | ||
} | ||
} | ||
s = selTemp.join(''); | ||
now[s] = now[s] || {}; | ||
now = now[s]; | ||
i--; | ||
_p += priority(prev, s); | ||
} | ||
@@ -155,2 +204,3 @@ //伪类都存在_:对象下,是个数组 | ||
case ']': | ||
//TODO: 选择器和属性很特殊,可以交叉:div[attr].class[attr] | ||
var list = []; | ||
@@ -182,2 +232,3 @@ var item; | ||
if(!prev || prev.type() != Token.SELECTOR) { | ||
now['_*'] = true; | ||
now['*'] = now['*'] || {}; | ||
@@ -187,6 +238,38 @@ now = now['*']; | ||
else { | ||
var selTemp = []; | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
while(prev && prev.type() == Token.SELECTOR) { | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
i--; | ||
} | ||
sort(selTemp, function(a, b) { | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = selTemp[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(selTemp.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(selTemp.length > 1) { | ||
if(selTemp[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
else { | ||
now['_*'] = true; | ||
} | ||
} | ||
s = selTemp.join(''); | ||
now[s] = now[s] || {}; | ||
now = now[s]; | ||
_p += priority(prev, s); | ||
} | ||
@@ -238,2 +321,3 @@ //属性都存在_[对象下,是个数组 | ||
break; | ||
//TODO: attr和pseudo混杂的情况 | ||
} | ||
@@ -240,0 +324,0 @@ break; |
@@ -1,3 +0,3 @@ | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("serialize")?_1.serialize:_1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
@@ -4,0 +4,0 @@ var Token = homunculus.getClass('token', 'css'); |
@@ -1,2 +0,2 @@ | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
@@ -3,0 +3,0 @@ var Token = homunculus.getClass('token', 'jsx'); |
@@ -1,4 +0,4 @@ | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("join")?_1.join:_1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("sort")?_2.sort:_2.hasOwnProperty("default")?_2["default"]:_2}(); | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("default")?_2["default"]:_2}(); | ||
@@ -54,3 +54,2 @@ var Token = homunculus.getClass('token', 'css'); | ||
function record(sel, idx, styles, res) { | ||
var first = sel[0]; | ||
var _p = 0; | ||
@@ -76,6 +75,22 @@ var now = res; | ||
sort(list, function(a, b) { | ||
return a < b; | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = list[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(list.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(list[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
s = list.join(''); | ||
} | ||
else if(s == '*') { | ||
now['_*'] = true; | ||
} | ||
now[s] = now[s] || {}; | ||
@@ -95,2 +110,3 @@ now = now[s]; | ||
if(!prev || prev.type() != Token.SELECTOR) { | ||
now['_*'] = true; | ||
now['*'] = now['*'] || {}; | ||
@@ -100,7 +116,40 @@ now = now['*']; | ||
else if(prev) { | ||
var selTemp = []; | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
//可能有多个tag.class#id:pseudo | ||
while(prev && prev.type() == Token.SELECTOR) { | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
i--; | ||
} | ||
sort(selTemp, function(a, b) { | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = selTemp[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(selTemp.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(selTemp.length > 1) { | ||
if(selTemp[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
else { | ||
now['_*'] = true; | ||
} | ||
} | ||
s = selTemp.join(''); | ||
now[s] = now[s] || {}; | ||
now = now[s]; | ||
i--; | ||
_p += priority(prev, s); | ||
} | ||
@@ -155,2 +204,3 @@ //伪类都存在_:对象下,是个数组 | ||
case ']': | ||
//TODO: 选择器和属性很特殊,可以交叉:div[attr].class[attr] | ||
var list = []; | ||
@@ -182,2 +232,3 @@ var item; | ||
if(!prev || prev.type() != Token.SELECTOR) { | ||
now['_*'] = true; | ||
now['*'] = now['*'] || {}; | ||
@@ -187,6 +238,38 @@ now = now['*']; | ||
else { | ||
var selTemp = []; | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
while(prev && prev.type() == Token.SELECTOR) { | ||
s = prev.content(); | ||
selTemp.push(s); | ||
_p += priority(prev, s); | ||
prev = prev.prev(); | ||
i--; | ||
} | ||
sort(selTemp, function(a, b) { | ||
return a != '*' && a < b || b == '*'; | ||
}); | ||
var star = selTemp[0] == '*'; | ||
//*开头有几种组合,记录之 | ||
if(star) { | ||
if(selTemp.length > 2) { | ||
now['_*.#'] = true; | ||
} | ||
else if(selTemp.length > 1) { | ||
if(selTemp[1][0] == '.') { | ||
now['_*.'] = true; | ||
} | ||
else { | ||
now['_*#'] = true; | ||
} | ||
} | ||
else { | ||
now['_*'] = true; | ||
} | ||
} | ||
s = selTemp.join(''); | ||
now[s] = now[s] || {}; | ||
now = now[s]; | ||
_p += priority(prev, s); | ||
} | ||
@@ -238,2 +321,3 @@ //属性都存在_[对象下,是个数组 | ||
break; | ||
//TODO: attr和pseudo混杂的情况 | ||
} | ||
@@ -240,0 +324,0 @@ break; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
1404
139280
30