stylecow-plugin-msfilter-transform
Advanced tools
Comparing version 4.0.1 to 4.1.0
45
index.js
@@ -31,15 +31,15 @@ require('sylvester'); | ||
case 90: | ||
stylecow.utils.addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1)'); | ||
addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1)'); | ||
break; | ||
case 180: | ||
stylecow.utils.addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=2)'); | ||
addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=2)'); | ||
break; | ||
case 270: | ||
stylecow.utils.addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=3)'); | ||
addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=3)'); | ||
break; | ||
case 360: | ||
stylecow.utils.addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=4)'); | ||
addMsFilter(block, 'progid:DXImageTransform.Microsoft.BasicImage(rotation=4)'); | ||
break; | ||
@@ -57,3 +57,3 @@ | ||
if (args[0] == -1) { | ||
stylecow.utils.addMsFilter(block, 'flipH'); | ||
addMsFilter(block, 'flipH'); | ||
} else { | ||
@@ -66,3 +66,3 @@ matrix.push(getMatrix(fn.name, args)); | ||
if (args[0] == -1) { | ||
stylecow.utils.addMsFilter(block, 'flipV'); | ||
addMsFilter(block, 'flipV'); | ||
} else { | ||
@@ -75,3 +75,3 @@ matrix.push(getMatrix(fn.name, args)); | ||
if (args[0] == -1 && args[1] == -1) { | ||
stylecow.utils.addMsFilter(block, 'flipH, flipV'); | ||
addMsFilter(block, 'flipH, flipV'); | ||
} else { | ||
@@ -101,3 +101,3 @@ matrix.push(getMatrix(fn.name, args)); | ||
stylecow.utils.addMsFilter(block, 'progid:DXImageTransform.Microsoft.Matrix(sizingMethod="auto expand", M11 = ' + m.elements[0][0] + ', M12 = ' + m.elements[0][1] + ', M21 = ' + m.elements[1][0] + ', M22 = ' + m.elements[1][1] + ')'); | ||
addMsFilter(block, 'progid:DXImageTransform.Microsoft.Matrix(sizingMethod="auto expand", M11 = ' + m.elements[0][0] + ', M12 = ' + m.elements[0][1] + ', M21 = ' + m.elements[1][0] + ', M22 = ' + m.elements[1][1] + ')'); | ||
} | ||
@@ -107,2 +107,31 @@ | ||
}); | ||
function addMsFilter (block, filter) { | ||
var declaration = block.getChild({ | ||
type: 'Declaration', | ||
name: 'filter', | ||
vendor: 'ms' | ||
}); | ||
if (!declaration) { | ||
return block.push(stylecow.parse('-ms-filter: ' + filter, 'Declaration', 'createMsFilter')); | ||
} | ||
if (declaration.is({string: '-ms-filter: none;'})) { | ||
return declaration | ||
.get({ | ||
type: 'Keyword', | ||
name: 'none' | ||
}) | ||
.replaceWith((new stylecow.String()).setName(filter)); | ||
} | ||
var string = declaration.get('String'); | ||
if (string.name) { | ||
string.name += ',' + filter; | ||
} else { | ||
string.name = filter; | ||
} | ||
} | ||
}; | ||
@@ -109,0 +138,0 @@ |
{ | ||
"name": "stylecow-plugin-msfilter-transform", | ||
"description": "Stylecow plugin to add ms filters emulating some 2d transforms: rotate(), scale(), skew(), matrix(), etc", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"author": "Oscar Otero <oom@oscarotero.com>", | ||
@@ -18,3 +18,3 @@ "homepage": "https://github.com/stylecow/stylecow-plugin-msfilter-transform", | ||
"mocha": "^2.2.5", | ||
"stylecow": "6.*" | ||
"stylecow-core": "^1.0.1" | ||
}, | ||
@@ -21,0 +21,0 @@ "scripts": { |
var assert = require('assert'); | ||
var stylecow = require('stylecow'); | ||
var stylecow = require('stylecow-core'); | ||
@@ -4,0 +4,0 @@ stylecow |
25595
865