From 529d86a58a134457ee67b584177c3398ab606928 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 17 Jan 2016 23:22:01 +0100 Subject: [PATCH 001/244] API overhaul --- dist/j2c.amd.js | 188 ++++++++-------- dist/j2c.amd.min.js | 1 + dist/j2c.commonjs.js | 188 ++++++++-------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 188 ++++++++-------- dist/j2c.global.js | 188 ++++++++-------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1730 -> 1703 bytes src/helpers.js | 5 +- src/main.js | 188 ++++++++-------- test/test.js | 435 ++++++++++++++++++++------------------ 11 files changed, 690 insertions(+), 695 deletions(-) create mode 100644 dist/j2c.amd.min.js diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 608baea6..839d2a5f 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -7,6 +7,7 @@ define(function () { 'use strict'; var OBJECT = type.call(emptyObject); var ARRAY = type.call(emptyArray); var STRING = type.call(''); + var FUNCTION = type.call(type); /*/-inline-/*/ // function cartesian(a, b, res, i, j) { // res = []; @@ -276,122 +277,117 @@ define(function () { 'use strict'; } } - var scope_root = '_j2c_' + - Math.floor(Math.random() * 0x100000000).toString(36) + '_' + - Math.floor(Math.random() * 0x100000000).toString(36) + '_' + - Math.floor(Math.random() * 0x100000000).toString(36) + '_' + - Math.floor(Math.random() * 0x100000000).toString(36) + '_'; - var counter = 0; - function j2c(res) { - res = res || {} - var extensions = [] - - function finalize(buf, i) { - for (i = 0; i< extensions.length; i++) buf = extensions[i](buf) || buf - return buf.join('') + function flatIter (f) { + return function iter(arg) { + if (type.call(arg) === ARRAY) for (var i= 0 ; i < arg.length; i ++) iter(arg[i]) + else f(arg) } + } - res.use = function() { - var args = arguments - for (var i = 0; i < args.length; i++){ - extensions.push(args[i]) + function j2c() { + var postprocessors = [] + var locals = {} + var sheets = [] + var index = {} + + var instance = { + flatIter: flatIter, + names: locals, + scopeRoot: '__j2c-' + + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + + Math.floor(Math.random() * 0x100000000).toString(36), + sheets: sheets, + use: function() { + _use(emptyArray.slice.call(arguments)) + return instance } - return res } - /*/-statements-/*/ - res.sheet = function(ns, statements) { - if (arguments.length === 1) { - statements = ns; ns = {} + + var registerLocals= flatIter(function(ns) { + for (var k in ns) if (!( k in locals )) locals[k] = ns[k] + }) + + var registerPostprocessor = flatIter(function(pp) { + postprocessors.push(pp) + }) + + var _use = flatIter(function(plugin) { + if (type.call(plugin) === FUNCTION) plugin = plugin(instance) + if (!plugin) return + for (var k in plugin) if (own.call(plugin, k)) switch(k) { + case 'namespace': registerLocals(plugin[k]); break + case 'postprocess': registerPostprocessor(plugin[k]); break + default: if (!( k in instance )) instance[k] = plugin[k] + } + }) + + _use(emptyArray.slice.call(arguments)) + + function postprocess(buf, res, i) { + for (i = 0; i< postprocessors.length; i++) buf = postprocessors[i](buf) || buf + return buf.join('') + } + + instance.remove = function (sheet) { + if (!( sheet in index )) return + index[sheet]-- + if (!index[sheet]) { + sheets.splice(sheets.indexOf(sheet), 0) + delete index[sheet] + return true } - var - suffix = scope_root + counter++, - locals = {}, - k, buf = [] - // pick only non-numeric keys since `(NaN != NaN) === true` - for (k in ns) if (k-0 != k-0 && own.call(ns, k)) { - locals[k] = ns[k] + } + var state = { + e: function extend(parent, child) { + var nameList = locals[child] + locals[child] = + nameList.slice(0, nameList.lastIndexOf(' ') + 1) + + parent + ' ' + + nameList.slice(nameList.lastIndexOf(' ') + 1) + }, + l: function localize(match, space, global, dot, name) { + if (global) return space + global + if (!locals[name]) locals[name] = name + instance.scopeRoot + return space + dot + locals[name].match(/\S+$/) } + } + + /*/-statements-/*/ + instance.sheet = function(statements, buf) { sheet( - statements, buf, '', '', emptyArray /*vendors*/, - 1, // local - { - e: function extend(parent, child) { - var nameList = locals[child] - locals[child] = - nameList.slice(0, nameList.lastIndexOf(' ') + 1) + - parent + ' ' + - nameList.slice(nameList.lastIndexOf(' ') + 1) - }, - l: function localize(match, space, global, dot, name) { - if (global) { - return space + global - } - if (!locals[name]) locals[name] = name + suffix - return space + dot + locals[name].match(/\S+$/) - } - } + statements, buf = [], + '', '', // prefix and rawPRefix + emptyArray, // vendors + 1, // local, by default + state ) - /*jshint -W053 */ - buf = new String(finalize(buf)) - /*jshint +W053 */ - for (k in locals) if (own.call(locals, k)) buf[k] = locals[k] + buf = postprocess(buf) + if (buf in index) { + index[buf]++ + } else { + index[buf] = 1 + sheets.push(buf) + } return buf } /*/-statements-/*/ - res.inline = function (locals, decl, buf) { - if (arguments.length === 1) { - decl = locals; locals = {} - } + instance.inline = function (decl, buf) { declarations( decl, buf = [], - '', // prefix + '', // prefix emptyArray, // vendors - 1, - { - l: function localize(match, space, global, dot, name) { - if (global) return space + global - if (!locals[name]) return name - return space + dot + locals[name] - } - }) - return finalize(buf) - } - - res.prefix = function(val, vendors) { - return cartesian( - vendors.map(function(p){return '-' + p + '-'}).concat(['']), - [val] + 1, //local + state ) + return postprocess(buf) } - return res - } - - j2c.global = function(x) { - return ':global(' + x + ')' - } - j2c.kv = kv - function kv (k, v, o) { - o = {} - o[k] = v - return o + return instance } - j2c.at = function at (rule, params, block) { - if ( - arguments.length < 3 - ) { - var _at = at.bind.apply(at, [null].concat([].slice.call(arguments,0))) - _at.toString = function(){return '@' + rule + ' ' + params} - return _at - } - else return kv('@' + rule + ' ' + params, block) - } - - j2c(j2c) - delete j2c.use - return j2c; }); \ No newline at end of file diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js new file mode 100644 index 00000000..0941fc2c --- /dev/null +++ b/dist/j2c.amd.min.js @@ -0,0 +1 @@ +define(function(){"use strict";function e(e,n,r,l,s,a){l=[];for(a in n)if(f.call(n,a))for(s in e)f.call(e,s)&&l.push(t(e[s],n[a],r));return l}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){return"-"+e.toLowerCase()}function r(e,t,l,s,a,o,i,c,g){if(null!=e)if(/\$/.test(l))for(g in l=l.split("$"))f.call(l,g)&&r(e,t,l[g],s,a,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;i`I$ej>3Idf=C7rm9j!?AL3h+HIQE4W4BZHRkp1RS4CI-&Db;pO6t z3CF~N+j5O|9gI0k_EhZH+Zthvk0n?ZtW&3e=XV)@V2NOIW!D*xA`BwuyckTy*-|t5 zF>6n4Q?LdoiQuX&mE03HP{|0#?z7BWF~gPk=t?~2Ph5$2S1O(Ih+kjoyl`n(#cH|} zw!4lP=z0%yfth%ing103RluyoiG(d%p_AZ$ao z=ih(qeOJBUFJCIAus$F%jQPwlSJ9lku~ z@x44Tz90K!nXJrg1nkivnbmofuurUnbdtf1>-mc!>oQKBv!=OGxO3mV;#DwQ$Y;lr zN~vt@#m8L69-g>V(!wO5{mZ+zzb7v3%N4IbgPI=wuNw9(eNx4xpvJ^j4NAYMC1Dr- zGqe9FJQv9o*Nfze?Q@6*Ax`bTlLaN@`;`Ex_o$OSwDyBBpJHfuBmi5#QiN?6*pevX)IrubFkqudreRf&r zyGTY^Z$%C+?NxXzQH@Gh3O11cLIX%88?c>^HC5veeyNrN&ftI@WZ5-dV}@7hh_7_W zJADIqW)KK;eh1mtizOE#M}?4%vdpLxm2Gc#cFer5Zq9o(IHn#PQ@h#>j;V_-t1~z- z(x9NfzHX^~g7<>#SP;uC2m+g+OU=&7&!Yu)JM|XYa3b^LiMWQGC^zEyu@=<6u}r6w zw52e0etCv4MfA#WNI}5!^r8dxELI?b= z4QcelOYAzu|Mw|k){I$`3IdOqbo8j{;9H^6mvv7j)vGo?8i;a!I+1NoFDg#Yvh|&D z`y(M)$hj?`C$(Xq7PY2~Vk6utW4BtB%$P7;U##~%cB{oT#eBHT31{Cz2-3ku?OFa*QFhYQ45>LQ z;+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#%^Y*HuXYScU}%TQrY?pIo6Vnj_nD509X& zyJWENQ{x!!bqW_x4|KJ73%TMBNu7W9%w2y53@G_dFt4fVqtjh^%}(ca$(8kRG+jpD zNzkeMuhSF9PlH>lUIpKU%!a0x{M*plA+!_GRBkxv8)iXH9nF+vOLkJxAtB)o$P3PRxg*|%n&62vVhjGpm&6IerjkZFZ=-=ObptA znzC2Yf<3=X7t1A^1GZe=5{XK(yD|>P-#J>f;?b6_NH12yT;gmcqZ+)1)miHzs92Xj zle?Q}#(H~lay2zldwK0&s=|>>*2@;x&)(KAy!Z zo_J>%0LKVI0A1bz`*vc61r7~3+WI2qG$;eEd zD~rRR%Tf{?RG`o>qYg+#B>1M>4C;2Ot0pv4^~;il4j> zEpH(XwTCAd*f7qr&Ux*eXRY(SLhWK8loX0z1%b%XrvDcWNKZHp@Q*moTpWmba?z}L zU}E?E1P?NB4{_xj;m}Q;HAlk>@rBMsOuZ9OeZH->-#hM80Qw^g1v#@Q_1$m-fpcP~ zD$!3r&0PBM)MgY`FD~Z7t<=t=90ppeJ8($>F9%k=KdIl0K5}Efk|XW;9%}wDJlAgI z?Vq8R$cg?u{gl-I2;a3I{oq$-4^bgC#Ps#cx3Ay6`Nzw*Z(g*kFp=+c3Exqpjp)@I z9Qc2STVx9)(MNzq9WwNpu=b##HoDlq0Qr4>q#FLQi8j355K|cTp62TPtFDp_-9=lW zb`d)s a': {'@extend':'.bat'}}) - expect(css.bat).to.be(undefined) - expect('' + css).to.contain('@-error-no-class-to-extend-in "p > a";') + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'p > a': {'@extend':'.bat'}}) + expect(names.bat).to.be(undefined) + expect(css).to.contain('@-error-no-class-to-extend-in "p > a";') }) test("extend doesn't extend into global selectors", function() { // @extend thus extends the last local class in the stream - var css = j2c.sheet({'.bit :global(.bot)': {'@extend':'.bat'}}) - expect(css.bit).to.contain('bit_j2c_') - expect(css.bat).to.be(undefined) - expect(css.bot).to.be(undefined) - expect(css.bit).not.to.contain(css.bat + ' ') + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'.bit :global(.bot)': {'@extend':'.bat'}}) + expect(names.bit).to.contain('bit__j2c-') + expect(names.bat).to.be(undefined) + expect(names.bot).to.be(undefined) + expect(names.bit).not.to.contain(names.bat + ' ') expect('' + css).to.contain('@-error-cannot-extend-in-global-context ".bit :global(.bot)";') }) @@ -1036,39 +1051,39 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ////////////////////////////// test('one plugin that does nothing', function() { - check(''+j2c().use(function(){}).sheet( + check(j2c().use({postprocess: function(){}}).sheet( {p: {foo: 'bar'}} ), 'p{foo:bar;}') }) test('one plugin that mutates the buffer', function() { - check(''+j2c().use( - function(buf){ + check(j2c().use( + {postprocess: function(buf){ buf[0] = 'li' - } + }} ).sheet( {p: {foo: 'bar'}} ), 'li{foo:bar;}') }) test('one plugin that returns a new buffer', function() { - check(''+j2c().use( - function(){ + check(j2c().use( + {postprocess: function(){ return ['li{foo:bar;}'] - } + }} ).sheet( {p: {foo: 'bar'}} ), 'li{foo:bar;}') }) test('two plugins that mutate the buffer', function() { - check(''+j2c().use( - function(buf){ + check(j2c().use( + {postprocess: function(buf){ buf[0]=buf[0].replace('p', 'a') - }, - function(buf){ + }}, + {postprocess: function(buf){ buf[0]=buf[0].replace('a', 'i') - } + }} ).sheet( {p: {fop: 'bar'}} ), 'i{fop:bar;}') From 13fde2a0c0f26c1100fc0e46d209cd569e3047f3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 17 Jan 2016 23:47:23 +0100 Subject: [PATCH 002/244] Add back the default instance. --- dist/j2c.amd.js | 5 ++++- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 5 ++++- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 5 ++++- dist/j2c.global.js | 5 ++++- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1703 -> 1737 bytes src/main.js | 7 +++++-- test/test.js | 24 +++++++++++++----------- 10 files changed, 37 insertions(+), 20 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 839d2a5f..857ecc60 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -317,7 +317,7 @@ define(function () { 'use strict'; if (type.call(plugin) === FUNCTION) plugin = plugin(instance) if (!plugin) return for (var k in plugin) if (own.call(plugin, k)) switch(k) { - case 'namespace': registerLocals(plugin[k]); break + case 'names': registerLocals(plugin[k]); break case 'postprocess': registerPostprocessor(plugin[k]); break default: if (!( k in instance )) instance[k] = plugin[k] } @@ -388,6 +388,9 @@ define(function () { 'use strict'; return instance } + var _j2c = j2c() + 'sheet|sheets|inline|remove|names|flatIter'.split('|').map(function(m){j2c[m] = _j2c[m]}) + return j2c; }); \ No newline at end of file diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 0941fc2c..9c2f1ea4 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,r,l,s,a){l=[];for(a in n)if(f.call(n,a))for(s in e)f.call(e,s)&&l.push(t(e[s],n[a],r));return l}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){return"-"+e.toLowerCase()}function r(e,t,l,s,a,o,i,c,g){if(null!=e)if(/\$/.test(l))for(g in l=l.split("$"))f.call(l,g)&&r(e,t,l[g],s,a,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;irfA-3YXe%QY$gS9oqzKZi#aK=LMT_%?34)f z>8uV;V1orZc3WaHiKdV9WO2AHXMGSQUN%D_Sxo3@=! zMrTc`=$4a;MzFlb6rr}Iu^F_Ai1r#oxKC3ff0YNSekPhmXgH^wbq)$FF~b#Jqa#2d zcAVc7)S@w6^nX@r569ZVp$nbrEoUYQZ$s2$qv85w(g~ffOD`AYl-o!gn5j0=u7k0l z>7MW%eOpHep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JHfuBmi5#QiN?6*pevX)IrubFkqudreRf&rJ#CssjU;%p^nHF(C58kH`B>RI(YzPm_9S#L!S zF6~u#EK!Y0R|+4>j%$UA)lcxDg? zbbbff*NY_=B1eUgj!cP6w7+=%>cy*x3zy-KAv&|yLc{C}^jB&_bFo5j9HTk0*{z<^r-3JTcOgIbx$VMt2RFxh;n{9k!?;dDo)R`^__A1BOzJH zxhBit%uw_26Vm@r*mtbg}CcB{oT#eBHT31{Cz2-3ku?OFa*QFhYQ45>LQ;+VLf zS=$)grN}>dAd85E%Zh!1rwbH^J4gf&sg?z9Gr75g4CzmtvbHYd#}R`Lf};;O2Y%Kv zpt~0Bj_3rM4g02(?n--fk0TbrDC&1Txd#I0LWzIjp0A~6Hqt5ZZGVcEc2ndgf@IbQ z6DBqik(-BZ#nCfeyo1t$0m?pNVYl Date: Sun, 17 Jan 2016 23:54:56 +0100 Subject: [PATCH 003/244] `sheets` and `remove` belong to a museum... err... a plugin. --- dist/j2c.amd.js | 18 ------------------ dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 18 ------------------ dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 18 ------------------ dist/j2c.global.js | 18 ------------------ dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1737 -> 1661 bytes src/main.js | 18 ------------------ test/test.js | 1 - 10 files changed, 3 insertions(+), 94 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 857ecc60..40eaaff8 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -287,8 +287,6 @@ define(function () { 'use strict'; function j2c() { var postprocessors = [] var locals = {} - var sheets = [] - var index = {} var instance = { flatIter: flatIter, @@ -298,7 +296,6 @@ define(function () { 'use strict'; Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36), - sheets: sheets, use: function() { _use(emptyArray.slice.call(arguments)) return instance @@ -330,15 +327,6 @@ define(function () { 'use strict'; return buf.join('') } - instance.remove = function (sheet) { - if (!( sheet in index )) return - index[sheet]-- - if (!index[sheet]) { - sheets.splice(sheets.indexOf(sheet), 0) - delete index[sheet] - return true - } - } var state = { e: function extend(parent, child) { var nameList = locals[child] @@ -364,12 +352,6 @@ define(function () { 'use strict'; state ) buf = postprocess(buf) - if (buf in index) { - index[buf]++ - } else { - index[buf] = 1 - sheets.push(buf) - } return buf } /*/-statements-/*/ diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 9c2f1ea4..8ea0f342 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,r,s,l,a){s=[];for(a in n)if(f.call(n,a))for(l in e)f.call(e,l)&&s.push(t(e[l],n[a],r));return s}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){return"-"+e.toLowerCase()}function r(e,t,s,l,a,i,o,c,g){if(null!=e)if(/\$/.test(s))for(g in s=s.split("$"))f.call(s,g)&&r(e,t,s[g],l,a,i);else switch(u.call(e=e.valueOf())){case h:for(o=0;ot?iwFP!000001I<@kkK4Ev{ws=L7-CGxNgAYx6u~L_v_;!2nz!1TfR>MJ zZYa_q>2U(f|9uZB$&#Fz1=9ARn8A!B@?7|x?_BuEbnx4oGOtduv|P!ET*8xqz*x;o z8)p6Y03x80YAUFqj9f&%F0xALhy`2*lJF|3l9CA#Nn9pw#kdt9-DjYN%;zFGp3EV# z5v)x?<(d^#6Ow7LCoKbUy_v%u)KW<<-IAQoqvgXo-kfK}Vzx{y7#msC7^X33t#rI) zyV#tzu>k?4#Sh`aHqCNA+G`UHN5M*n@bjJmAx#4dJ6M$w^cF*uhs3JCt25}oG6NAA z_G#~(hk`1~X-W6wf)L1)5HE6YXe>9qm!gGZ@8A%*NX$`i8-=rw^wwVGc zB^d}8i8Ht5Av$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;K%6f|;Ai>Dg0l_qDAoYOK% zu>G02q2Mly{O1l-5S=oyqMzWi1scO0R0YUVLj!vl-`qiU^fykq>j}ki6g}(y(I=Y) zK6mJ=ZallgDuqGAyy>LdwjST3n8xrF_otpbbHe;WiT}DiyQO9(RvE;amoDVIEO-os ztWP9_O{`-azXuY{|gFV=CvO zjN>e_ztEt%&u3_kSU{o!q?`%*w0JcV-^q5x2#9X6WVTdPc7F#S9eobr8eTR;zdeXQ z6!@vkXGn^UvdnV5d#)_EyJsjy_|U)XpuQL1-!4`Kl*SIW(1F(aRBpYGt*2k>Xy5kr fE$ll<`^49rrB<<|C|Zs=hi diff --git a/src/main.js b/src/main.js index 9cf018fa..2084337c 100644 --- a/src/main.js +++ b/src/main.js @@ -12,8 +12,6 @@ function flatIter (f) { export default function j2c() { var postprocessors = [] var locals = {} - var sheets = [] - var index = {} var instance = { flatIter: flatIter, @@ -23,7 +21,6 @@ export default function j2c() { Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36), - sheets: sheets, use: function() { _use(emptyArray.slice.call(arguments)) return instance @@ -55,15 +52,6 @@ export default function j2c() { return buf.join('') } - instance.remove = function (sheet) { - if (!( sheet in index )) return - index[sheet]-- - if (!index[sheet]) { - sheets.splice(sheets.indexOf(sheet), 0) - delete index[sheet] - return true - } - } var state = { e: function extend(parent, child) { var nameList = locals[child] @@ -89,12 +77,6 @@ export default function j2c() { state ) buf = postprocess(buf) - if (buf in index) { - index[buf]++ - } else { - index[buf] = 1 - sheets.push(buf) - } return buf } /*/-statements-/*/ diff --git a/test/test.js b/test/test.js index 4805104c..32a5b966 100644 --- a/test/test.js +++ b/test/test.js @@ -1092,6 +1092,5 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} // TODO // test .use -// test .remove and .sheets // test the default `j2c` instance as well From 1be3c469478895b296a97c91af62d960106f3c0a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 26 Jan 2016 23:42:56 +0100 Subject: [PATCH 004/244] Add the filter interface --- dist/j2c.amd.js | 81 +++++++++++++++++++++++++++----------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 81 +++++++++++++++++++++++++++----------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 81 +++++++++++++++++++++++++++----------- dist/j2c.global.js | 81 +++++++++++++++++++++++++++----------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1661 -> 1738 bytes src/at-rules.js | 37 +++++++++++------ src/declarations.js | 4 +- src/main.js | 31 +++++++++++++-- src/sheet.js | 12 +++--- 12 files changed, 290 insertions(+), 124 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 40eaaff8..179af9d0 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -107,10 +107,10 @@ define(function () { 'use strict'; /*/-statements-/*/ // vendorify for (kk = 0; kk < vendors.length; kk++) - buf.push('-', vendors[kk], '-', k, k ? ':': '', o, ';\n') + buf.d('-', vendors[kk], '-', k, k ? ':': '', o, ';\n') /*/-statements-/*/ - buf.push(k, k ? ':': '', o, ';\n') + buf.d(k, k ? ':': '', o, ';\n') } } @@ -140,10 +140,10 @@ define(function () { 'use strict'; if (/^@(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { - buf.push(k, ' ', v[kk], ';\n') + buf.a(k, ' ', v[kk], ';\n') } } else { - buf.push(k, ' ', v, ';\n') + buf.a(k, ' ', v, ';\n') } } else if (/^@keyframes /.test(k)) { k = local ? k.replace( @@ -153,13 +153,13 @@ define(function () { 'use strict'; ) : k // add a @-webkit-keyframes block too. - buf.push('@-webkit-', k.slice(1), ' {\n') + buf.a('@-webkit-', k.slice(1), ' {\n') sheet(v, buf, '', '', ['webkit']) - buf.push('}\n') + buf.c('}\n') - buf.push(k, ' {\n') + buf.a(k, ' {\n') sheet(v, buf, '', '', vendors, local, ns) - buf.push('}\n') + buf.c('}\n') } else if (/^@extends?$/.test(k)) { @@ -169,11 +169,11 @@ define(function () { 'use strict'; /*eslint-enable no-cond-assign*/ if (k == null || !local) { // we're in a @global{} block - buf.push('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') + buf.a('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') return } else if (/^@extends?$/.test(k)) { // no class in the selector - buf.push('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix), ';\n') + buf.a('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix), ';\n') return } ns.e( @@ -184,7 +184,17 @@ define(function () { 'use strict'; ) } else if (/^@(?:font-face$|viewport$|page )/.test(k)) { - sheet(v, buf, k, k, emptyArray) + if (type.call(v) === ARRAY) { + for (kk = 0; kk < v.length; kk++) { + buf.a(k, ' {\n') + declarations(v[kk], buf, '', vendors, local, ns) + buf.c('}\n') + } + } else { + buf.a(k, ' {\n') + declarations(v, buf, '', vendors, local, ns) + buf.c('}\n') + } } else if (/^@global$/.test(k)) { sheet(v, buf, prefix, rawPrefix, vendors, 0, ns) @@ -193,12 +203,12 @@ define(function () { 'use strict'; sheet(v, buf, prefix, rawPrefix, vendors, 1, ns) } else if (/^@(?:media |supports |document )./.test(k)) { - buf.push(k, ' {\n') + buf.a(k, ' {\n') sheet(v, buf, prefix, rawPrefix, vendors, local, ns) - buf.push('}\n') + buf.c('}\n') } else { - buf.push('@-error-unsupported-at-rule ', JSON.stringify(k), ';\n') + buf.a('@-error-unsupported-at-rule ', JSON.stringify(k), ';\n') } } @@ -232,19 +242,19 @@ define(function () { 'use strict'; if (prefix && /^[-\w$]+$/.test(k)) { if (!inDeclaration) { inDeclaration = 1 - buf.push(( prefix || '*' ), ' {\n') + buf.s(( prefix || '*' ), ' {\n') } declarations(v, buf, k, vendors, local, ns) } else if (/^@/.test(k)) { // Handle At-rules - inDeclaration = (inDeclaration && buf.push('}\n') && 0) + inDeclaration = (inDeclaration && buf.c('}\n') && 0) at(k, v, buf, prefix, rawPrefix, vendors, local, ns) } else { // selector or nested sub-selectors - inDeclaration = (inDeclaration && buf.push('}\n') && 0) + inDeclaration = (inDeclaration && buf.c('}\n') && 0) sheet(v, buf, (kk = /,/.test(prefix) || prefix && /,/.test(k)) ? @@ -266,14 +276,14 @@ define(function () { 'use strict'; ) } } - if (inDeclaration) buf.push('}\n') + if (inDeclaration) buf.c('}\n') break case STRING: - buf.push( + buf.s( ( prefix || ':-error-no-selector' ) , ' {\n' ) declarations(statements, buf, '', vendors, local, ns) - buf.push('}\n') + buf.c('}\n') } } @@ -285,6 +295,7 @@ define(function () { 'use strict'; } function j2c() { + var filters = [] var postprocessors = [] var locals = {} @@ -306,6 +317,10 @@ define(function () { 'use strict'; for (var k in ns) if (!( k in locals )) locals[k] = ns[k] }) + var registerFilter = flatIter(function(filter) { + filters.push(filter) + }) + var registerPostprocessor = flatIter(function(pp) { postprocessors.push(pp) }) @@ -316,12 +331,30 @@ define(function () { 'use strict'; for (var k in plugin) if (own.call(plugin, k)) switch(k) { case 'names': registerLocals(plugin[k]); break case 'postprocess': registerPostprocessor(plugin[k]); break + case 'filter': registerFilter(plugin[k]); break default: if (!( k in instance )) instance[k] = plugin[k] } }) _use(emptyArray.slice.call(arguments)) + + function makeBuf() { + var buf + function push() { + emptyArray.push.apply(buf.b, arguments) + } + buf = { + b: [], // buf + a: push, // at-rules + s: push, // selector + d: push, // declaration + c: push // close + } + // for (var i = 0; i < filters.length; i++) buf = filters[i](buf) + return buf + } + function postprocess(buf, res, i) { for (i = 0; i< postprocessors.length; i++) buf = postprocessors[i](buf) || buf return buf.join('') @@ -345,26 +378,26 @@ define(function () { 'use strict'; /*/-statements-/*/ instance.sheet = function(statements, buf) { sheet( - statements, buf = [], + statements, buf = makeBuf(), '', '', // prefix and rawPRefix emptyArray, // vendors 1, // local, by default state ) - buf = postprocess(buf) + buf = postprocess(buf.b) return buf } /*/-statements-/*/ instance.inline = function (decl, buf) { declarations( decl, - buf = [], + buf = makeBuf(), '', // prefix emptyArray, // vendors 1, //local state ) - return postprocess(buf) + return postprocess(buf.b) } return instance diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 8ea0f342..fead9e56 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,r,l,s,a){l=[];for(a in n)if(f.call(n,a))for(s in e)f.call(e,s)&&l.push(t(e[s],n[a],r));return l}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){return"-"+e.toLowerCase()}function r(e,t,l,s,a,o,i,c,g){if(null!=e)if(/\$/.test(l))for(g in l=l.split("$"))f.call(l,g)&&r(e,t,l[g],s,a,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;i@46-w;aaDMQP=ZDbXQ=tv?FPaH|KN6M`7sd#v(e&W)uHEej9 zoAx+-aMwq47n(_jk;M$Zk-cIz6bwBB9I&Xpnb1vhhA$dLt%S< zAU*MW&wDUvA(YIcXq&4Q&zEGWUlL2fbV~7YNo$;L-|390FsEl4eo{g@@s!Q(dIRb^ zQ*fz;eeOX-PUp$OuVD3A7(b=VV%h7ydpBeLOP{hGI(B!PcaGhmV@KA=6d*dJ73>TJgg z4Tg490LPG)orWgK)={HGo6B3%*<7N{GPLS^&u3;)rk#OJW$35~vl%M&-vtf&2q97<7bxt8q9rG51j7>{I*1+qkNqUWjQD4_q%-~T zh6d2l+VPp-ivhXT^AU_Ei(6bKRR~`oBbvr|%5w2KjoZwUBv98c1Z`=0RATM5hiFn@ z#-&syXk-UM1`QrTrli3^g!ktU?|%zzZkJoJxknux+|OF|tTL&BEazGWMhzOjrXmaB zf+utHj{CxuH|UUaLHCp3ai+j zt=TcYte*0+Vpiyo>Q;6Rsn8*~W>KXV@-Azp+t>6w>%^^9lgXpbq(U5ySa6QX4b!0} z3MhJ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$1VD}$PAJ{zx*0y zKZ>>ZP9?_YgKrk(&a6hjUL2BHmDdS;gA&V0h9|DpZ;Py}IC&0D^Foo1zK@FUg5f}I zbu5{b%Eqnwn9I0@CoYw=_z}_m+viXJOkCNQdtQA4+yjESupjQ*jO z1Sb4h+5ad#H_2VBH_2VJZz&ptB(?vYE^HxJ7rZu0D#S9bP}!_` zwra@$_*0S;&*pPB25dfmMMYH8-NZSPKC{($_0cw8(oU_yxy1QOZ)V5}A~kAVG^$qh z&v18>jH=$Ao?Y3i$ylQrwXPI>p#KXCsFiNfcRsdMk6-xIEJvJ?fE{GnJznDo@6%Dd z(xLA31K=%!7(mB6tiG*UI#D@lgltr0Mw6)Yv)zrDdEea}do>bM55&~2HzP51(N%Ro zfsqA;^Y#5m-4^&(ksT|7+@d1%38&QTR{UDD&~Inn;uub4ez{VSUn;@uFBWvlsBhS* zq^49y_?J>P4ZnQBIUk4Ge=vJUDxuKk+c)puzJK@UH}BuQ^j~p8*{K@mN}PK?`$UfZ z^p3ds@c&zi;*BL8-C#Pbj#1h6@HTQx?|m^en9|~Ur7CBW_R@#cwqvmWC$TcfwJmS} zwgt8hoY1C1-GBvd?Rd8~kOmxS&N%Mj0P5}o*f;L1jfZYaNLLJPTLeQN&M;MxcVmwL1_57XX)z=Me4AXkz-k51rTrp~EL%XbGy<}uOTg!GE)1be;x zMeg7m-b-9(UA!g>Sm4v5-}U4k>{XFcA?YA-4lHvSdp^@-k^F`6KWS` z;lAUr-~d~0K4WDkc);78GBF1LJ6v$bw@TmmTne?rS&7Z`fZZ?mSxZI2rQi~tmenKK zPOua6naN#JmTvuoLw(OyTH(uqnNMf=tHwiU`yFZ1u>|Yhp?@yj*xx;4veR?_a>DwV z|9m;#=2&_ Date: Thu, 28 Jan 2016 10:38:37 +0100 Subject: [PATCH 005/244] Correctly handle comas in complex selectors. Close #20 --- dist/j2c.amd.js | 46 ++++++++++++++++++++++++++++---------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 46 ++++++++++++++++++++++++++++---------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 46 ++++++++++++++++++++++++++++---------- dist/j2c.global.js | 46 ++++++++++++++++++++++++++++---------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1738 -> 1874 bytes scripts/regexps.js | 27 ++++++++++++++++++++++ src/sheet.js | 43 ++++++++++++++++++++++++++--------- test/test.js | 33 +++++++++++++++++++++++++++ 11 files changed, 232 insertions(+), 61 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 179af9d0..ef296223 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -212,6 +212,28 @@ define(function () { 'use strict'; } } + // This will split a coma-separated selector list into individual selectors, + // ignoring comas in strings and in :pseudo-selectors(parameter, lists). + // regexp generated by scripts/regexps.js then trimmed by hand + var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'/g + + function splitSelector(selector) { + var indices = [], res = [], inParen = 0, match, i + while(match = selectorTokenizer.exec(selector)) { + switch(match[0]){ + case '(': inParen++; break + case ')': inParen--; break + case ',': if (inParen) break; indices.push(match.index) + } + } + for (i = indices.length; i--;){ + res.unshift(selector.slice(indices[i] + 1)) + selector = selector.slice(0, indices[i]) + } + res.unshift(selector) + return res + } + /** * Add rulesets and other CSS statements to the sheet. * @@ -258,18 +280,18 @@ define(function () { 'use strict'; sheet(v, buf, (kk = /,/.test(prefix) || prefix && /,/.test(k)) ? - cartesian(prefix.split(','), ( local ? - k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l - ) : k - ).split(','), prefix).join(',') : + cartesian(splitSelector(prefix), splitSelector( local ? + k.replace( + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + ) : k + ), prefix).join(',') : concat(prefix, ( local ? - k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l - ) : k - ), prefix), + k.replace( + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + ) : k + ), prefix), kk ? - cartesian(rawPrefix.split(','), k.split(','), rawPrefix).join(',') : + cartesian(splitSelector(rawPrefix), splitSelector(k), rawPrefix).join(',') : concat(rawPrefix, k, rawPrefix), vendors, local, ns @@ -339,7 +361,7 @@ define(function () { 'use strict'; _use(emptyArray.slice.call(arguments)) - function makeBuf() { + function makeBuf(inline) { var buf function push() { emptyArray.push.apply(buf.b, arguments) @@ -351,7 +373,7 @@ define(function () { 'use strict'; d: push, // declaration c: push // close } - // for (var i = 0; i < filters.length; i++) buf = filters[i](buf) + for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) return buf } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index fead9e56..8afe2e8c 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,l,a,s){l=[];for(s in t)if(u.call(t,s))for(a in e)u.call(e,a)&&l.push(n(e[a],t[s],r));return l}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){return"-"+e.toLowerCase()}function r(e,n,l,a,s,o,i,c,h){if(null!=e)if(/\$/.test(l))for(h in l=l.split("$"))u.call(l,h)&&r(e,n,l[h],a,s,o);else switch(f.call(e=e.valueOf())){case g:for(i=0;ivF%irNwljzJs>V=5D_ z`6jFn>#!C|O1;O%`2}+wrEc7VV646TxKrbR&{k6Im<}bV! zgpTKo*Up=QRZOy+74!rX=z~%(QsJy|z3R2(tvL#34xaL;-YaQIa23$rHXP*hdB=2F zWG!Es2<1F+FKxafht7lzx#HWH#N>4d7o9$vJK&Cf|{2(GF^w#bYxmZxJT*_=z zl_qN=_}9c!?PF*Imn?8q?@HM^Y;>hylDgMC^=!r~$;p*uDxbKL?5>nM;S2fjQp3ij zUK>&H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MW&wDUvA(YIcXq&4Q&zEGWUlL2fbV~7YNo$;L-|390FsEl4eo{g@@s!Q(dIRb^ zQ*fz;eeOX-PUp$OuVD3A7(b=VV%h7ydpBeLOP{hGI(B!PcaGhmV@KA=6d*dJ73>TJgg z4Tg490LPG)orWgK)={HGo6B3%*<7N{GPLS^&u3;)rk#OJW$35~vl%M&-vtf&2q97<7bxt8q9rG51j7>{I*1+qkNqUWjQD4_q%-~T zh6d2l+VPp-ivhXT^AU_Ei(6bKRR~`oBbvr|%5w2KjoZwUBv98c1Z`=0RATM5hiFn@ z#-&syXk-UM1`QrTrli3^g!ktU?|%zzZkJoJxknux+|OF|tTL&BEazGWMhzOjrXmaB zf+utHj{CxuH|UUaLHCp3ai+j zt=TcYte*0+Vpiyo>Q;6Rsn8*~W>KXV@-Azp+t>6w>%^^9lgXpbq(U5ySa6QX4b!0} z3MhJ9Rc5+o+a#w|v`87pQmFB> z#!nW(`H3Ff8Y=&=!**3amF;gy8A)m616ZX zcIhU?>c_SZHp%AJ1$J)tV2+RGst0oeW5F_Zh5aga(6;->viQJ~@vXs7+U8x;va@*O9;rwSBKM!hbP2MM`kt?jd zr-rN+#n?e9+h*_@>lJo6<|ny^FL>v&J;n5fPGO2q({9z1YtAgcP|{qVha2tOOl5?Q zPZPWkg?%tkW~Rl|j$@l-v79YGV11!@z%JNu^$x%cmv_|A%eQ5*KyT5u9nG+m z?=gubh7{ontrMY;xsWj4KA2~d9q+ccd+{#Y>~yg$Y(!@^wl{cf>8Q?1eA#jRzLLKe zc$C82BZ*rY3Cqp)IkQ}BpD|sqRrj*7MEv#|u}?5Dw#fJnm)d>nx;bWDz+N4pc2ump gG~{>XqkiH(s1}eWd;G%KP-m3>7fjg>J1!9b0L+h88UO$Q diff --git a/scripts/regexps.js b/scripts/regexps.js index d29ec6cb..57c0d0d0 100644 --- a/scripts/regexps.js +++ b/scripts/regexps.js @@ -65,3 +65,30 @@ var selector = flags('g', sequence( )) console.log('selector / @global\n', selector) + +var selectorTokenizer = flags('g', + either( + /[(),]/, + sequence( + '"', + greedy('*', + either( + /\\./, + /[^"\n]/ + ) + ), + '"' + ), + sequence( + "'", + greedy('*', + either( + /\\./, + /[^'\n]/ + ) + ), + "'" + ) + ) +) +console.log('selectorTokenizer = ', selectorTokenizer) diff --git a/src/sheet.js b/src/sheet.js index 4a07e1a1..b929403d 100644 --- a/src/sheet.js +++ b/src/sheet.js @@ -1,7 +1,30 @@ +/*eslint no-cond-assign: 0*/ import {type, ARRAY, OBJECT, STRING, cartesian, concat} from './helpers' import {declarations} from './declarations' import {at} from './at-rules' +// This will split a coma-separated selector list into individual selectors, +// ignoring comas in strings and in :pseudo-selectors(parameter, lists). +// regexp generated by scripts/regexps.js then trimmed by hand +var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'/g + +function splitSelector(selector) { + var indices = [], res = [], inParen = 0, match, i + while(match = selectorTokenizer.exec(selector)) { + switch(match[0]){ + case '(': inParen++; break + case ')': inParen--; break + case ',': if (inParen) break; indices.push(match.index) + } + } + for (i = indices.length; i--;){ + res.unshift(selector.slice(indices[i] + 1)) + selector = selector.slice(0, indices[i]) + } + res.unshift(selector) + return res +} + /** * Add rulesets and other CSS statements to the sheet. * @@ -48,18 +71,18 @@ export function sheet(statements, buf, prefix, rawPrefix, vendors, local, ns) { sheet(v, buf, (kk = /,/.test(prefix) || prefix && /,/.test(k)) ? - cartesian(prefix.split(','), ( local ? - k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l - ) : k - ).split(','), prefix).join(',') : + cartesian(splitSelector(prefix), splitSelector( local ? + k.replace( + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + ) : k + ), prefix).join(',') : concat(prefix, ( local ? - k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l - ) : k - ), prefix), + k.replace( + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + ) : k + ), prefix), kk ? - cartesian(rawPrefix.split(','), k.split(','), rawPrefix).join(',') : + cartesian(splitSelector(rawPrefix), splitSelector(k), rawPrefix).join(',') : concat(rawPrefix, k, rawPrefix), vendors, local, ns diff --git a/test/test.js b/test/test.js index 32a5b966..25c277c9 100644 --- a/test/test.js +++ b/test/test.js @@ -371,6 +371,15 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ) }) + test('convert CamelCase', function() { + check( + j2c().sheet({p: { + fooFoo: 'bar' + }}), + 'p{foo-foo:bar}' + ) + }) + test('number values', function() { check( j2c().sheet({p: { @@ -494,6 +503,30 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ) }) + test("don't split on comas inside strings ...", function() { + check(j2c().sheet({ + 'a[foo="bar,baz"]': { + ' p': {qux: 5} + } + }), 'a[foo="bar,baz"] p {qux: 5}') + }) + + test("... nor split on comas inside parentheses ...", function() { + check(j2c().sheet({ + 'a:any(p, ul)': { + ' p': {qux: 5} + } + }), 'a:any(p, ul) p {qux: 5}') + }) + + test("... but split in between", function(){ + check(j2c().sheet({ + 'a[foo="bar,baz"], a:any(p, ul)': { + ' p': {qux: 5} + } + }), 'a[foo="bar,baz"] p, a:any(p, ul) p {qux: 5}') + }) + ///////////////////////////////// From 5c204ee98a84e9772c8d2f507b0e404767bb1f9c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 28 Jan 2016 10:45:42 +0100 Subject: [PATCH 006/244] Also ignore comas in selector comments (see #20) --- dist/j2c.amd.js | 2 +- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 2 +- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 2 +- dist/j2c.global.js | 2 +- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1874 -> 1889 bytes scripts/regexps.js | 5 +++++ src/sheet.js | 2 +- test/test.js | 16 ++++++++++++---- 11 files changed, 25 insertions(+), 12 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index ef296223..ebdd7dc2 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -215,7 +215,7 @@ define(function () { 'use strict'; // This will split a coma-separated selector list into individual selectors, // ignoring comas in strings and in :pseudo-selectors(parameter, lists). // regexp generated by scripts/regexps.js then trimmed by hand - var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'/g + var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g function splitSelector(selector) { var indices = [], res = [], inParen = 0, match, i diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 8afe2e8c..d7222707 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(g.call(t,s))for(l in e)g.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){return"-"+e.toLowerCase()}function r(e,n,a,l,s,o,i,c,f){if(null!=e)if(/\$/.test(a))for(f in a=a.split("$"))g.call(a,f)&&r(e,n,a[f],l,s,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;i0tO_*WOO|sC%Uj9`X&UaSQL4ebmxzF#2d4T@b>jNptmc@E z=d{z#nSxeS(3}?J3?@(qDPP3gT4R~^TC&z0g*69@Sy1n#Fc{4d>21S+e6i@5CPmir zB@vg_6DMKv9X@nsjCpWm^1we7m=JQ#L9^K|v;stY8;N&3kX&ueE)t$cfMp`GQB@MH zHD{kAN3{<@8*qsSS9Puwt;0rFaw>>@&11)Aypot)NyOrbD~aw(xfSk-hnE^QuJzjR zf*qvkuER!meFArZnq*u_{^kFk!KxwjMcp)rDN!=(9AB}LqZhFNYz&L`y=k2FI$bF+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zWhW`;bVeU{DipWBT4Caf`5r1pqnlTI@sFyqaq#5}hAvDPf8%x+6{>>Zw{PCRegE!H zZ{ELq@?HZu#iw|lV1CwuD$dn2}m!}dM;a%5>Y Date: Thu, 28 Jan 2016 22:16:56 +0100 Subject: [PATCH 007/244] Extend now works with selector lists. Closes #17. --- dist/j2c.amd.js | 98 ++++++++++++++++++++++---------------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 98 ++++++++++++++++++++++---------------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 98 ++++++++++++++++++++++---------------- dist/j2c.global.js | 98 ++++++++++++++++++++++---------------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1889 -> 1922 bytes src/at-rules.js | 47 ++++++++++-------- src/helpers.js | 33 ++++++++++++- src/sheet.js | 23 +-------- test/test.js | 73 +++++++++++++++++++++++++--- 12 files changed, 353 insertions(+), 221 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index ebdd7dc2..f31fff5b 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -37,6 +37,37 @@ define(function () { 'use strict'; ) || a + b } + // "Tokenizes" the selectors into parts relevant for the next function. + // Strings and comments are matched, but ignored afterwards. + var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g + + /** + * This will split a coma-separated selector list into individual selectors, + * ignoring comas in strings and in :pseudo-selectors(parameter, lists). + * regexp generated by scripts/regexps.js then trimmed by hand + * @param {string} selector + * @return {string[]} + */ + + function splitSelector(selector) { + var indices = [], res = [], inParen = 0, match, i + /*eslint-disable no-cond-assign*/ + while(match = selectorTokenizer.exec(selector)) { + /*eslint-enable no-cond-assign*/ + switch(match[0]){ + case '(': inParen++; break + case ')': inParen--; break + case ',': if (inParen) break; indices.push(match.index) + } + } + for (i = indices.length; i--;){ + res.unshift(selector.slice(indices[i] + 1)) + selector = selector.slice(0, indices[i]) + } + res.unshift(selector) + return res + } + function decamelize(match) { return '-' + match.toLowerCase() } @@ -136,7 +167,7 @@ define(function () { 'use strict'; */ function at(k, v, buf, prefix, rawPrefix, vendors, local, ns){ - var kk + var kk, i if (/^@(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { @@ -162,27 +193,32 @@ define(function () { 'use strict'; buf.c('}\n') } else if (/^@extends?$/.test(k)) { - - /*eslint-disable no-cond-assign*/ - // pick the last class to be extended - while (kk = findClass.exec(rawPrefix)) k = kk[4] - /*eslint-enable no-cond-assign*/ - if (k == null || !local) { - // we're in a @global{} block - buf.a('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') - return - } else if (/^@extends?$/.test(k)) { - // no class in the selector - buf.a('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix), ';\n') + if (!local) { + buf.c('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') return } - ns.e( - type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l) - }).join(' ') : v.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l), - k - ) - + rawPrefix = splitSelector(rawPrefix) + for(i = 0; i < rawPrefix.length; i++) { + /*eslint-disable no-cond-assign*/ + // pick the last class to be extended + while (kk = findClass.exec(rawPrefix[i])) k = kk[4] + /*eslint-enable no-cond-assign*/ + if (k == null) { + // the last class is a :global(.one) + buf.c('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix[i]), ';\n') + continue + } else if (/^@extends?$/.test(k)) { + // no class in the selector, therefore `k` hasn't been overwritten. + buf.c('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix[i]), ';\n') + continue + } + ns.e( + type.call(v) == ARRAY ? v.map(function (parent) { + return parent.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l) + }).join(' ') : v.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l), + k + ) + } } else if (/^@(?:font-face$|viewport$|page )/.test(k)) { if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { @@ -212,28 +248,6 @@ define(function () { 'use strict'; } } - // This will split a coma-separated selector list into individual selectors, - // ignoring comas in strings and in :pseudo-selectors(parameter, lists). - // regexp generated by scripts/regexps.js then trimmed by hand - var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g - - function splitSelector(selector) { - var indices = [], res = [], inParen = 0, match, i - while(match = selectorTokenizer.exec(selector)) { - switch(match[0]){ - case '(': inParen++; break - case ')': inParen--; break - case ',': if (inParen) break; indices.push(match.index) - } - } - for (i = indices.length; i--;){ - res.unshift(selector.slice(indices[i] + 1)) - selector = selector.slice(0, indices[i]) - } - res.unshift(selector) - return res - } - /** * Add rulesets and other CSS statements to the sheet. * diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index d7222707..ea645fa1 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(g.call(t,s))for(l in e)g.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){return"-"+e.toLowerCase()}function r(e,n,a,l,s,o,i,c,f){if(null!=e)if(/\$/.test(a))for(f in a=a.split("$"))g.call(a,f)&&r(e,n,a[f],l,s,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;iiso%4O+d?( z&4!``lC~3A{_j1cuAXsPq}_+b%y^{3%lXdz93P2vetTUcL z z19jL0igH?LAh^D0+tqTmSA>!_oD|dp@(xpk+Lroa;;KE0&IbDt)FO<$ASO1lVxHW` zBB?_9g%+?YM(V_L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JlG6hg7FDo$(2zN*b$S2?d?fA@I55E9UW!u{1&KM*rXv-=0fF_koIeW zadKZN&xGJOmO1~iEQYx+7=nRNZ+O}b2PlC(}gW;d(!CS3ykF@_Y}Sr$3FHtw@-S~E48m(`Is4$4iR#!x>u bH&4vXBH>wlgpZ32X5juOxGMO#RuTXJXCQ@a diff --git a/src/at-rules.js b/src/at-rules.js index 02eeb2f8..d5850c0f 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -1,4 +1,4 @@ -import {type, ARRAY} from './helpers' +import {type, ARRAY, splitSelector} from './helpers' import {sheet} from './sheet' import {declarations} from './declarations' @@ -23,7 +23,7 @@ var findClass = /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g */ export function at(k, v, buf, prefix, rawPrefix, vendors, local, ns){ - var kk + var kk, i if (/^@(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { @@ -49,27 +49,32 @@ export function at(k, v, buf, prefix, rawPrefix, vendors, local, ns){ buf.c('}\n') } else if (/^@extends?$/.test(k)) { - - /*eslint-disable no-cond-assign*/ - // pick the last class to be extended - while (kk = findClass.exec(rawPrefix)) k = kk[4] - /*eslint-enable no-cond-assign*/ - if (k == null || !local) { - // we're in a @global{} block - buf.a('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') - return - } else if (/^@extends?$/.test(k)) { - // no class in the selector - buf.a('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix), ';\n') + if (!local) { + buf.c('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') return } - ns.e( - type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l) - }).join(' ') : v.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l), - k - ) - + rawPrefix = splitSelector(rawPrefix) + for(i = 0; i < rawPrefix.length; i++) { + /*eslint-disable no-cond-assign*/ + // pick the last class to be extended + while (kk = findClass.exec(rawPrefix[i])) k = kk[4] + /*eslint-enable no-cond-assign*/ + if (k == null) { + // the last class is a :global(.one) + buf.c('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix[i]), ';\n') + continue + } else if (/^@extends?$/.test(k)) { + // no class in the selector, therefore `k` hasn't been overwritten. + buf.c('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix[i]), ';\n') + continue + } + ns.e( + type.call(v) == ARRAY ? v.map(function (parent) { + return parent.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l) + }).join(' ') : v.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l), + k + ) + } } else if (/^@(?:font-face$|viewport$|page )/.test(k)) { if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { diff --git a/src/helpers.js b/src/helpers.js index 830a6607..916c5517 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -36,6 +36,37 @@ function concat(a, b, selectorP) { /&/.test(b) && /* never falsy */ b.replace(/&/g, a) ) || a + b } + +// "Tokenizes" the selectors into parts relevant for the next function. +// Strings and comments are matched, but ignored afterwards. +var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g + +/** + * This will split a coma-separated selector list into individual selectors, + * ignoring comas in strings and in :pseudo-selectors(parameter, lists). + * regexp generated by scripts/regexps.js then trimmed by hand + * @param {string} selector + * @return {string[]} + */ + +function splitSelector(selector) { + var indices = [], res = [], inParen = 0, match, i + /*eslint-disable no-cond-assign*/ + while(match = selectorTokenizer.exec(selector)) { + /*eslint-enable no-cond-assign*/ + switch(match[0]){ + case '(': inParen++; break + case ')': inParen--; break + case ',': if (inParen) break; indices.push(match.index) + } + } + for (i = indices.length; i--;){ + res.unshift(selector.slice(indices[i] + 1)) + selector = selector.slice(0, indices[i]) + } + res.unshift(selector) + return res +} /* /-statements-/*/ -export {emptyObject, emptyArray, type, own, OBJECT, ARRAY, STRING, FUNCTION, cartesian, concat} \ No newline at end of file +export {emptyObject, emptyArray, type, own, OBJECT, ARRAY, STRING, FUNCTION, cartesian, concat, splitSelector} \ No newline at end of file diff --git a/src/sheet.js b/src/sheet.js index 42bb8ce2..2a9b3913 100644 --- a/src/sheet.js +++ b/src/sheet.js @@ -1,29 +1,8 @@ -/*eslint no-cond-assign: 0*/ -import {type, ARRAY, OBJECT, STRING, cartesian, concat} from './helpers' +import {type, ARRAY, OBJECT, STRING, cartesian, concat, splitSelector} from './helpers' import {declarations} from './declarations' import {at} from './at-rules' -// This will split a coma-separated selector list into individual selectors, -// ignoring comas in strings and in :pseudo-selectors(parameter, lists). -// regexp generated by scripts/regexps.js then trimmed by hand -var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g -function splitSelector(selector) { - var indices = [], res = [], inParen = 0, match, i - while(match = selectorTokenizer.exec(selector)) { - switch(match[0]){ - case '(': inParen++; break - case ')': inParen--; break - case ',': if (inParen) break; indices.push(match.index) - } - } - for (i = indices.length; i--;){ - res.unshift(selector.slice(indices[i] + 1)) - selector = selector.slice(0, indices[i]) - } - res.unshift(selector) - return res -} /** * Add rulesets and other CSS statements to the sheet. diff --git a/test/test.js b/test/test.js index 083fb99f..264286f9 100644 --- a/test/test.js +++ b/test/test.js @@ -1033,40 +1033,44 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('local extend', function() { var _j2c = j2c(), names = _j2c.names - _j2c.sheet({'.bit': {'@extend':'.bat'}}) + var css = _j2c.sheet({'.bit': {'@extend':'.bat'}}) expect(names.bit).to.contain('bit__j2c-') expect(names.bat).to.contain('bat__j2c-') expect(names.bat).not.to.contain('bit__j2c-') expect(names.bit).to.contain(names.bat + ' ') + expect(css).to.be('') }) test('global extend', function() { var _j2c = j2c(), names = _j2c.names - _j2c.sheet({'.bit': {'@extend':':global(.bat)'}}) + var css = _j2c.sheet({'.bit': {'@extend':':global(.bat)'}}) expect(names.bit).to.contain('bit__j2c-') expect(names.bit).to.contain('bat ') + expect(css).to.be('') }) test('two local extends', function() { var _j2c = j2c(), names = _j2c.names - _j2c.sheet({'.bit': {'@extends':['.bat', '.bot']}}) + var css = _j2c.sheet({'.bit': {'@extends':['.bat', '.bot']}}) expect(names.bit).to.contain('bit__j2c-') expect(names.bat).to.contain('bat__j2c-') expect(names.bot).to.contain('bot__j2c-') expect(names.bat).not.to.contain('bit__j2c-') expect(names.bot).not.to.contain('bit__j2c-') expect(names.bit).to.contain(names.bat + ' ' + names.bot + ' ') + expect(css).to.be('') }) test('extend applies only to the last class in the selector', function() { var _j2c = j2c(), names = _j2c.names - _j2c.sheet({'.bot p .bit': {'@extend':'.bat'}}) + var css = _j2c.sheet({'.bot p .bit': {'@extend':'.bat'}}) expect(names.bit).to.contain('bit__j2c-') expect(names.bat).to.contain('bat__j2c-') expect(names.bot).to.contain('bot__j2c-') expect(names.bat).not.to.contain('bit__j2c-') expect(names.bit).to.contain(names.bat + ' ') expect(names.bot).not.to.contain(names.bat + ' ') + expect(css).to.be('') }) test("if we can't find a class to extend, pass @extend as a property", function() { @@ -1076,7 +1080,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} expect(css).to.contain('@-error-no-class-to-extend-in "p > a";') }) - test("extend doesn't extend into global selectors", function() { + test("@extend doesn't extend into global selectors", function() { // @extend thus extends the last local class in the stream var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit :global(.bot)': {'@extend':'.bat'}}) @@ -1084,7 +1088,64 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} expect(names.bat).to.be(undefined) expect(names.bot).to.be(undefined) expect(names.bit).not.to.contain(names.bat + ' ') - expect('' + css).to.contain('@-error-cannot-extend-in-global-context ".bit :global(.bot)";') + expect(css).to.contain('@-error-cannot-extend-in-global-context ".bit :global(.bot)";') + }) + + test("@extend doesn't work global context", function() { + // @extend thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'@global': {'.bit .bot': {'@extend':'.bat'}}}) + expect(names.bit).to.be(undefined) + expect(names.bat).to.be(undefined) + expect(names.bot).to.be(undefined) + expect(css).to.contain('@-error-cannot-extend-in-global-context ".bit .bot";') + }) + + test('@extend with a list of classes', function() { + // @extend thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'.bit,.bot': {'@extend':'.bat'}}) + expect(names.bit).to.contain('bit__j2c-') + expect(names.bat).to.contain('bat__j2c-') + expect(names.bot).to.contain('bot__j2c-') + expect(names.bit).to.contain(names.bat + ' ') + expect(names.bot).to.contain(names.bat + ' ') + expect(css).to.be('') + }) + + test('@extend with a list of classes with complex selectors', function() { + // @extend thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'[foo=","].bit,/*,*/.bot': {'@extend':'.bat'}}) + expect(names.bit).to.contain('bit__j2c-') + expect(names.bat).to.contain('bat__j2c-') + expect(names.bot).to.contain('bot__j2c-') + expect(names.bit).to.contain(names.bat + ' ') + expect(names.bot).to.contain(names.bat + ' ') + expect(css).to.be('') + }) + + test('@extend with a list of selectors, one of them ending with a global class', function() { + // @extend thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'.bit,.bot:global(.but)': {'@extend':'.bat'}}) + expect(names.bit).to.contain('bit__j2c-') + expect(names.bat).to.contain('bat__j2c-') + expect(names.bot).to.contain('bot__j2c-') + expect(names.but).to.be(undefined) + expect(names.bit).to.contain(names.bat + ' ') + expect(names.bot).not.to.contain(names.bat + ' ') + expect(css).to.contain('@-error-cannot-extend-in-global-context ".bot:global(.but)";') + }) + + test('@extend with a list of selectors, one of them devoid of class', function() { + // @extend thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'p a ul li,.bot': {'@extend':'.bat'}}) + expect(names.bat).to.contain('bat__j2c-') + expect(names.bot).to.contain('bot__j2c-') + expect(names.bot).to.contain(names.bat + ' ') + expect(css).to.contain('@-error-no-class-to-extend-in "p a ul li";') }) ////////////////////////////// From 7a564d353471c434255f8cb619669f5b77bed831 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Fri, 29 Jan 2016 02:32:20 +0100 Subject: [PATCH 008/244] Rename @extend @composes and constrain the context where it can be used to better match its semantics. Close #17. --- README.md | 38 ++++++------ dist/j2c.amd.js | 71 ++++++++++------------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 71 ++++++++++------------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 71 ++++++++++------------- dist/j2c.global.js | 71 ++++++++++------------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1922 -> 1901 bytes src/at-rules.js | 49 +++++++--------- src/main.js | 2 +- src/sheet.js | 20 +++---- test/test.js | 119 ++++++++++++++++++++++---------------- 13 files changed, 250 insertions(+), 268 deletions(-) diff --git a/README.md b/README.md index 1e3d8d02..5a94bbb5 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ In `sheet` mode, `j2c` follows a [**'local by default'**](https://medium.com/see Like SASS, LESS and Stylus, `j2c` supports: - mixins -- `@extend` - nested selectors (in `sheet` mode) +- `@composes`, and `@extends`-like mechanism All standard CSS at-rules are available out of the box, most importantly: @@ -58,7 +58,7 @@ The [home page](http://j2c.py.gy) has a few interactive demos. - [For building a style sheet: `j2c.sheet(rules)`](#for-building-a-style-sheet-j2csheetrules) - [Combining multiple selectors](#combining-multiple-selectors) - [At-rules](#at-rules) - - [Mixins and @extend](#mixins-and-extend) + - [Mixins and @composes](#mixins-and-composes) - [CSS Hacks](#css-hacks) - [Inserting a stylesheet in a document](#inserting-the-stylesheet-in-the-document) - [Isomorphic app support](#isomorphic-app-support) @@ -383,43 +383,43 @@ becomes For `@keyframes` rules, a `@-webkit-keyframes` block is automatically created with auto-prefixed property names. -#### Mixins and `@extend` +#### Mixins and `@coposes` -Mixins and `@extend` make `j2c` sheets composable. Both techniques can be combined. +Mixins and `@composes` make `j2c` sheets composable. Both techniques can be combined. ##### Mixins and source objects composition For mixins, arrays works the same way at the selector level as they do at the property/value one. You can therefore use the [method described in the "inline" section](#mixins) to create mixins, that can return either at-rules, selectors, properties or a mix thereof. -##### `@extend` +##### `@composes` -`j2c` also supports a SASS-like `@extend`, more powerful in some regards, but more limited in others. +`j2c` also supports `@composes`, which works a bit like the SASS`@extend`, more powerful in some regards, but more limited in others. The limitation is that it can only deal with classes. Specifically: ```JS -namespace = j2c.sheet({ - '.red': {color: '#f00'} -}) - -sheet = j2c.sheet(namespace, { +sheet = j2c.sheet({ + '.red': { + color: '#f00' + }, '.great': { fontSize: '3em' }, - '.greatRed': { - '@extend': ['.great', '.red'] // you can also pass a single class + // `scarlet` here is the target of the composition, `great` and `red` are the sources. + '.scarlet': { + '@composes': ['.great', '.red'] // you can also pass a single class } }) ``` -`sheet.greatRed` is now defined as `'great_j2c... red_j2c... greatRed_j2c...'` (class names truncated for readability). +`sheet.scarlet` is now defined as `'great__j2c-xxx red__j2c-xxx scarlet__j2c-xxx'` (class names truncated for readability). The extra power comes from the fact that you can inherit from arbitrary classes, not just j2c-defined ones: ```JS sheet = j2c.sheet(namespace, { '.myButton': { - '@extend': ':global(.button)', // coming, say, form Bootstrap + '@composes': ':global(.button)', // coming, say, form Bootstrap color: theme.highlight } }) @@ -427,13 +427,9 @@ sheet = j2c.sheet(namespace, { Here, `sheet.myButton` is `'button myButton_j2c...'`. -While `@extend` can import from arbitrary classes, it only imports into local ones. - -`@extend` works fine with nested selectors. If there are more than one class in a selector, `@extend` applies to the last (right-most) one. - -###### Invalid uses +While the `@composes` sources can be arbitrary classes, the target must be a local one. It will not work in global context. -If the last or only selector is a `:global(.klass)`, in `@global` context, or in the absence of a class in the selector, `@extend` is turned into a `at-extend` property and inserted as-is in the sheet. +`@composes` doesn't support nested selectors, and doesn't work in conditional at rules. Its target must lie at the first nesting level. #### CSS Hacks diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index f31fff5b..ea45afb7 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -146,8 +146,6 @@ define(function () { 'use strict'; } } - var findClass = /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g - /** * Hanldes at-rules * @@ -157,7 +155,7 @@ define(function () { 'use strict'; * @param {string[]} v - Either parameters for block-less rules or their block * for the others. * @param {string} prefix - the current selector or a prefix in case of nested rules - * @param {string} rawPrefix - as above, but without localization transformations + * @param {string} composes - as above, but without localization transformations * @param {string} vendors - a list of vendor prefixes * @Param {boolean} local - are we in @local or in @global scope? * @param {object} ns - helper functions to populate or create the @local namespace @@ -166,8 +164,8 @@ define(function () { 'use strict'; * @param {function} ns.l - @local helper */ - function at(k, v, buf, prefix, rawPrefix, vendors, local, ns){ - var kk, i + function at(k, v, buf, prefix, composes, vendors, local, ns){ + var i, kk if (/^@(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { @@ -185,38 +183,35 @@ define(function () { 'use strict'; // add a @-webkit-keyframes block too. buf.a('@-webkit-', k.slice(1), ' {\n') - sheet(v, buf, '', '', ['webkit']) + sheet(v, buf, '', 1, ['webkit']) buf.c('}\n') buf.a(k, ' {\n') - sheet(v, buf, '', '', vendors, local, ns) + sheet(v, buf, '', 1, vendors, local, ns) buf.c('}\n') - } else if (/^@extends?$/.test(k)) { + } else if (/^@composes$/.test(k)) { if (!local) { - buf.c('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix), ';\n') + buf.a('@-error-at-composes-in-at-global;\n') + return + } + if (!composes) { + buf.a('@-error-at-composes-no-nesting;\n') return } - rawPrefix = splitSelector(rawPrefix) - for(i = 0; i < rawPrefix.length; i++) { - /*eslint-disable no-cond-assign*/ - // pick the last class to be extended - while (kk = findClass.exec(rawPrefix[i])) k = kk[4] - /*eslint-enable no-cond-assign*/ + composes = splitSelector(composes) + for(i = 0; i < composes.length; i++) { + k = /^\s*\.(\w+)\s*$/.exec(composes[i]) if (k == null) { // the last class is a :global(.one) - buf.c('@-error-cannot-extend-in-global-context ', JSON.stringify(rawPrefix[i]), ';\n') - continue - } else if (/^@extends?$/.test(k)) { - // no class in the selector, therefore `k` hasn't been overwritten. - buf.c('@-error-no-class-to-extend-in ', JSON.stringify(rawPrefix[i]), ';\n') + buf.a('@-error-at-composes-bad-target ', JSON.stringify(composes[i]), ';\n') continue } - ns.e( + ns.c( type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l) - }).join(' ') : v.replace(/()(?::global\(\s*(\.[-\w]+)\s*\)|()\.([-\w]+))/, ns.l), - k + return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, ns.l) + }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, ns.l), + k[1] ) } } else if (/^@(?:font-face$|viewport$|page )/.test(k)) { @@ -233,14 +228,14 @@ define(function () { 'use strict'; } } else if (/^@global$/.test(k)) { - sheet(v, buf, prefix, rawPrefix, vendors, 0, ns) + sheet(v, buf, prefix, 1, vendors, 0, ns) } else if (/^@local$/.test(k)) { - sheet(v, buf, prefix, rawPrefix, vendors, 1, ns) + sheet(v, buf, prefix, 1, vendors, 1, ns) } else if (/^@(?:media |supports |document )./.test(k)) { buf.a(k, ' {\n') - sheet(v, buf, prefix, rawPrefix, vendors, local, ns) + sheet(v, buf, prefix, 1, vendors, local, ns) buf.c('}\n') } else { @@ -254,22 +249,22 @@ define(function () { 'use strict'; * @param {array|string|object} statements - a source object or sub-object. * @param {string[]} buf - the buffer in which the final style sheet is built * @param {string} prefix - the current selector or a prefix in case of nested rules - * @param {string} rawPrefix - as above, but without localization transformations + * @param {string} composes - the potential target of a @composes rule, if any. * @param {string} vendors - a list of vendor prefixes * @Param {boolean} local - are we in @local or in @global scope? * @param {object} ns - helper functions to populate or create the @local namespace - * and to @extend classes - * @param {function} ns.e - @extend helper + * and to @composes classes + * @param {function} ns.e - @composes helper * @param {function} ns.l - @local helper */ - function sheet(statements, buf, prefix, rawPrefix, vendors, local, ns) { - var k, kk, v, inDeclaration + function sheet(statements, buf, prefix, composes, vendors, local, ns) { + var k, v, inDeclaration switch (type.call(statements)) { case ARRAY: for (k = 0; k < statements.length; k++) - sheet(statements[k], buf, prefix, rawPrefix, vendors, local, ns) + sheet(statements[k], buf, prefix, composes, vendors, local, ns) break case OBJECT: @@ -285,7 +280,7 @@ define(function () { 'use strict'; // Handle At-rules inDeclaration = (inDeclaration && buf.c('}\n') && 0) - at(k, v, buf, prefix, rawPrefix, vendors, local, ns) + at(k, v, buf, prefix, composes, vendors, local, ns) } else { // selector or nested sub-selectors @@ -293,7 +288,7 @@ define(function () { 'use strict'; inDeclaration = (inDeclaration && buf.c('}\n') && 0) sheet(v, buf, - (kk = /,/.test(prefix) || prefix && /,/.test(k)) ? + (/,/.test(prefix) || prefix && /,/.test(k)) ? cartesian(splitSelector(prefix), splitSelector( local ? k.replace( /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l @@ -304,9 +299,7 @@ define(function () { 'use strict'; /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l ) : k ), prefix), - kk ? - cartesian(splitSelector(rawPrefix), splitSelector(k), rawPrefix).join(',') : - concat(rawPrefix, k, rawPrefix), + composes || prefix ? '' : k, vendors, local, ns ) @@ -397,7 +390,7 @@ define(function () { 'use strict'; } var state = { - e: function extend(parent, child) { + c: function composes(parent, child) { var nameList = locals[child] locals[child] = nameList.slice(0, nameList.lastIndexOf(' ') + 1) + diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index ea645fa1..65ae0e2f 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,o){a=[];for(o in t)if(g.call(t,o))for(l in e)g.call(e,l)&&a.push(n(e[l],t[o],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=m.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return"-"+e.toLowerCase()}function a(e,n,t,l,o,s,i,c,f){if(null!=e)if(/\$/.test(t))for(f in t=t.split("$"))g.call(t,f)&&a(e,n,t[f],l,o,s);else switch(u.call(e=e.valueOf())){case h:for(i=0;iWu)YWt8w&*@A2KGq2p7WjW+x@M;t5Knk@p`^dmv!h)l!_eBn}1+^?dc%7KczbAx>co@2)I5+`0?ICoAsz&{~ zH7?*I0#p98Y=r&?h~|-L9qZ6XQ`3@iTF{)FL2h-F@=Ywz+N*T1g6YhiTO!0Js4H0* z&%JR887YyY?Yl#hJnPOSk&wu=4##6p6Hw{I5Cb^e_X!-C z@N5#5%%FC5AxN`W7#~!%ROKBZC#nj{3BDGwJ!Vpg&s5?ue?cYQt5o3SK7XpzIB_l4 zR^;p`O|Oob==cTb2x5|HB>DUDmkdTVp>OK8b(ty-42`o?>>%7XF$eCCgZSRI7QJ3p z3Wpt7<&BO#THX=UEgtdKVYrj!hRM`R>st?9Eb|FGrlf`G{++C78Ax&=!LMbZ?D2%I z9!CM%N28gl3w$0y1fP|0;x=OQwJ>f*C}KI@{rGW3-CLK?91NR3$ic8V7*+*a5AdK8 zfyD<-`PvQP&!vL8QL0=L;i4DDFB6ZYrJM#Mj4VdauIMg83O{}X?Getp0*TtnBEEJu2NDiX(gOO72#y?aoD)H{$`2gq^Paj8mn*&wDR#BAznyc6TA_?Byw z!mjGrh>KTX_K;9IjC*i3qwoWf#7r>cW4!f3x!q-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Z@@D5_sF6$q*u zpvx)ua3+FHye_`E=T*N4B(La}5vNs$#t5yPc3T&RiVE$Za60VW3b`qV%`h4(k;zI> z^}CztHXu5X2Tq?`hK^<#^JMMG;dZ>kr!GrYc#DsC5nmT*d0mt%Fi7<5z0*|WaU==(+nJkt| zHR@@(yvN+D@bL;3if-+z?Zw_US>dsgwXK1OM+Rt3JwwOZ+pVkbiM1@8C29a+GIa%& zaaLF(0cGufaV^}6w-#w(kOG_HnoR-vgQZ>@@s%p(Hrqsl1)?bv4vn@uizVYm5KG;K zc)Dy>lhrKa&Dwo!t3&T(dWv}Ci4vSlKIp;8q-hX5oyxqAXpnHufx!?npIc^cX1*zH z(;bqg;a?%rHkinrjX{MjmRl^7^CmKle0+B;S zg=XUVknScnYS#8o*5qt$^JH!EZEAe`1g$YN>t@gZhk1fzKA;FR4x0UxX-(}$FoYV2 z^Vzbgm2PBRPzCGz=j$co;4N;{TrCYViDhnv2sX)oflc33YHW){a-NyO;5~QFYP1+z zRqAm@g@7SS|7d1i81GD<0%NRCeR%SRT{rh!Fu!8beG@T#Ij|PKj=*pvxAr4>LVTFo zhG0Ng_|i9YXuXUsSJ_9XGYAA6f(>@>Db>^WAi!a~zcz1RE!6kDC6shXrZN#Ge*iiL z13YJf-aby|$NRJ6NgLaRiRjYA_8}=oSI0Ye*%S5QBz}<~iqv1hAA2_{jQ{n|rSZ4^ z8PWwl4KD|Tt7Me|=e%{Hgk)LRrjKq0w!L%Pmm}q+rMzsjRd$zVD*Kq a': {'@extend':'.bat'}}) + var css = _j2c.sheet({'p > a': {'@composes':'.bat'}}) + expect(css).to.contain('@-error-at-composes-bad-target "p > a";') expect(names.bat).to.be(undefined) - expect(css).to.contain('@-error-no-class-to-extend-in "p > a";') }) - test("@extend doesn't extend into global selectors", function() { - // @extend thus extends the last local class in the stream + test("@composes can't target global selectors", function() { + // @composes thus extends the last local class in the stream var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'.bit :global(.bot)': {'@extend':'.bat'}}) + var css = _j2c.sheet({'.bit :global(.bot)': {'@composes':'.bat'}}) + expect(css).to.contain('@-error-at-composes-bad-target ".bit :global(.bot)";') expect(names.bit).to.contain('bit__j2c-') expect(names.bat).to.be(undefined) expect(names.bot).to.be(undefined) - expect(names.bit).not.to.contain(names.bat + ' ') - expect(css).to.contain('@-error-cannot-extend-in-global-context ".bit :global(.bot)";') + expect(names.bit).not.to.contain(' ') }) - test("@extend doesn't work global context", function() { - // @extend thus extends the last local class in the stream + test("@composes doesn't work global context", function() { + // @composes thus extends the last local class in the stream var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'@global': {'.bit .bot': {'@extend':'.bat'}}}) + var css = _j2c.sheet({'@global': {'.bit .bot': {'@composes':'.bat'}}}) + expect(css).to.contain('@-error-at-composes-in-at-global;') expect(names.bit).to.be(undefined) expect(names.bat).to.be(undefined) expect(names.bot).to.be(undefined) - expect(css).to.contain('@-error-cannot-extend-in-global-context ".bit .bot";') }) - test('@extend with a list of classes', function() { - // @extend thus extends the last local class in the stream + test('@composes with a list of classes', function() { + // @composes thus extends the last local class in the stream var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'.bit,.bot': {'@extend':'.bat'}}) - expect(names.bit).to.contain('bit__j2c-') - expect(names.bat).to.contain('bat__j2c-') - expect(names.bot).to.contain('bot__j2c-') - expect(names.bit).to.contain(names.bat + ' ') - expect(names.bot).to.contain(names.bat + ' ') + var css = _j2c.sheet({'.bit,.bot': {'@composes':'.bat'}}) expect(css).to.be('') - }) - - test('@extend with a list of classes with complex selectors', function() { - // @extend thus extends the last local class in the stream - var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'[foo=","].bit,/*,*/.bot': {'@extend':'.bat'}}) expect(names.bit).to.contain('bit__j2c-') expect(names.bat).to.contain('bat__j2c-') expect(names.bot).to.contain('bot__j2c-') expect(names.bit).to.contain(names.bat + ' ') expect(names.bot).to.contain(names.bat + ' ') - expect(css).to.be('') }) - test('@extend with a list of selectors, one of them ending with a global class', function() { - // @extend thus extends the last local class in the stream + // test('@composes with a list of classes with complex selectors', function() { + // // @composes thus extends the last local class in the stream + // var _j2c = j2c(), names = _j2c.names + // var css = _j2c.sheet({'[foo=","].bit,/*,*/.bot': {'@composes':'.bat'}}) + // expect(css).to.be('') + // expect(names.bit).to.contain('bit__j2c-') + // expect(names.bat).to.contain('bat__j2c-') + // expect(names.bot).to.contain('bot__j2c-') + // expect(names.bit).to.contain(names.bat + ' ') + // expect(names.bot).to.contain(names.bat + ' ') + // }) + + test('@composes with a list of selectors, one of them ending with a global class', function() { + // @composes thus extends the last local class in the stream var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'.bit,.bot:global(.but)': {'@extend':'.bat'}}) + var css = _j2c.sheet({'.bit,.bot:global(.but)': {'@composes':'.bat'}}) + expect(css).to.contain('@-error-at-composes-bad-target ".bot:global(.but)";') expect(names.bit).to.contain('bit__j2c-') expect(names.bat).to.contain('bat__j2c-') expect(names.bot).to.contain('bot__j2c-') expect(names.but).to.be(undefined) expect(names.bit).to.contain(names.bat + ' ') expect(names.bot).not.to.contain(names.bat + ' ') - expect(css).to.contain('@-error-cannot-extend-in-global-context ".bot:global(.but)";') }) - test('@extend with a list of selectors, one of them devoid of class', function() { - // @extend thus extends the last local class in the stream + test('@composes with a list of selectors, one of them devoid of class', function() { + // @composes thus extends the last local class in the stream var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'p a ul li,.bot': {'@extend':'.bat'}}) + var css = _j2c.sheet({'p a ul li,.bot': {'@composes':'.bat'}}) + expect(css).to.contain('@-error-at-composes-bad-target "p a ul li";') expect(names.bat).to.contain('bat__j2c-') expect(names.bot).to.contain('bot__j2c-') expect(names.bot).to.contain(names.bat + ' ') - expect(css).to.contain('@-error-no-class-to-extend-in "p a ul li";') }) + test('@composes target must be at the first level', function() { + // @composes thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'.bit': {'& &': {'@composes':'.bat'}}}) + expect(css).to.contain('@-error-at-composes-no-nesting;') + expect(names.bat).to.be(undefined) + expect(names.bit).to.contain('bit__j2c-') + expect(names.bit).not.to.contain(' ') + }) + + test('@composes in conditional at-rules fails', function() { + // @composes thus extends the last local class in the stream + var _j2c = j2c(), names = _j2c.names + var css = _j2c.sheet({'@media screen': {'.bit': {'@composes':'.bat'}}}) + expect(css).to.contain('@-error-at-composes-no-nesting;') + expect(names.bat).to.be(undefined) + expect(names.bit).to.contain('bit__j2c-') + expect(names.bit).not.to.contain(' ') + }) + + + ////////////////////////////// /**/ suite('Plugins: ') /**/ ////////////////////////////// From ee947c6ac752cf878c41a6d28d280ee00efc63dc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 30 Jan 2016 10:07:24 +0100 Subject: [PATCH 009/244] Tolerate global() function without ':' --- scripts/regexps.js | 45 ++++++++++++++++++++++++++++++++++++++++++--- src/at-rules.js | 2 +- src/declarations.js | 2 +- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/scripts/regexps.js b/scripts/regexps.js index 54e5601d..fb8e4d27 100644 --- a/scripts/regexps.js +++ b/scripts/regexps.js @@ -11,7 +11,8 @@ var animation = sequence( capture(), either( sequence( - ':global(', + /:?/, + 'global(', /\s*/, capture(/[-\w]+/), /\s*/, @@ -23,13 +24,14 @@ var animation = sequence( ) ) ) -console.log('anumation / animation-name\n', animation) +console.log('animation / animation-name\n', animation) var keyframes = sequence( capture(' '), either( sequence( - ':global(', + /:?/, + 'global(', /\s*/, capture(/[-\w]+/), /\s*/, @@ -66,6 +68,43 @@ var selector = flags('g', sequence( console.log('selector / @global\n', selector) +var composes = sequence( + capture(''), + either( + sequence( + /:?/, + 'global(', + /\s*\.?/, + capture(/[-\w]+/), + /\s*/, + ')' + ), + sequence( + capture(''), + /\.?/, + capture(/[-\w]+/) + ) + ) +) + +// /() +// (?: +// :? +// global\( +// \s* +// \.? +// ([-\w]+) +// \s* +// \) +// | +// () +// \. +// ([-\w]+) +// ) +// / + +console.log('@composes\n', composes) + var selectorTokenizer = flags('g', either( /[(),]/, diff --git a/src/at-rules.js b/src/at-rules.js index b4f62654..f964fdb9 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -33,7 +33,7 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ } else if (/^@keyframes /.test(k)) { k = local ? k.replace( // generated by script/regexps.js - /( )(?::global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l ) : k // add a @-webkit-keyframes block too. diff --git a/src/declarations.js b/src/declarations.js index 68d1f392..9cb52278 100644 --- a/src/declarations.js +++ b/src/declarations.js @@ -56,7 +56,7 @@ export function declarations(o, buf, prefix, vendors, local, ns, /*var*/ k, v, k if (local && (k == 'animation-name' || k == 'animation')) { o = o.split(',').map(function (o) { - return o.replace(/()(?::global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) + return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) }).join(',') } if (/^animation|^transition/.test(k)) vendors = ['webkit'] From 27972e81badf8b3aa6d1e7369d8cae6cbf1f0863 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 30 Jan 2016 10:24:52 +0100 Subject: [PATCH 010/244] Accept vendor-prefixed at-rules as input --- dist/j2c.amd.js | 24 ++++++++++++------------ dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 24 ++++++++++++------------ dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 24 ++++++++++++------------ dist/j2c.global.js | 24 ++++++++++++------------ dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1901 -> 1918 bytes src/at-rules.js | 20 ++++++++++---------- test/test.js | 38 +++++++++++++++++++++++++++----------- 10 files changed, 88 insertions(+), 72 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index ea45afb7..d67d1036 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -124,7 +124,7 @@ define(function () { 'use strict'; if (local && (k == 'animation-name' || k == 'animation')) { o = o.split(',').map(function (o) { - return o.replace(/()(?::global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) + return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) }).join(',') } if (/^animation|^transition/.test(k)) vendors = ['webkit'] @@ -166,7 +166,7 @@ define(function () { 'use strict'; function at(k, v, buf, prefix, composes, vendors, local, ns){ var i, kk - if (/^@(?:namespace|import|charset)$/.test(k)) { + if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { buf.a(k, ' ', v[kk], ';\n') @@ -174,18 +174,18 @@ define(function () { 'use strict'; } else { buf.a(k, ' ', v, ';\n') } - } else if (/^@keyframes /.test(k)) { + } else if (/^@(?:-[-\w]+-)?keyframes /.test(k)) { k = local ? k.replace( // generated by script/regexps.js - /( )(?::global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l ) : k - // add a @-webkit-keyframes block too. - - buf.a('@-webkit-', k.slice(1), ' {\n') - sheet(v, buf, '', 1, ['webkit']) - buf.c('}\n') - + // add a @-webkit-keyframes block if no explicit prefix is present. + if (/^@keyframes/.test(k)) { + buf.a('@-webkit-', k.slice(1), ' {\n') + sheet(v, buf, '', 1, ['webkit']) + buf.c('}\n') + } buf.a(k, ' {\n') sheet(v, buf, '', 1, vendors, local, ns) buf.c('}\n') @@ -214,7 +214,7 @@ define(function () { 'use strict'; k[1] ) } - } else if (/^@(?:font-face$|viewport$|page )/.test(k)) { + } else if (/^@(?:-[-\w]+-)?(?:font-face$|viewport$|page )/.test(k)) { if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { buf.a(k, ' {\n') @@ -233,7 +233,7 @@ define(function () { 'use strict'; } else if (/^@local$/.test(k)) { sheet(v, buf, prefix, 1, vendors, 1, ns) - } else if (/^@(?:media |supports |document )./.test(k)) { + } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { buf.a(k, ' {\n') sheet(v, buf, prefix, 1, vendors, local, ns) buf.c('}\n') diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 65ae0e2f..e847e8c0 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(p.call(t,s))for(l in e)p.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=w.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return"-"+e.toLowerCase()}function a(e,n,t,l,s,o,i,c,f){if(null!=e)if(/\$/.test(t))for(f in t=t.split("$"))p.call(t,f)&&a(e,n,t[f],l,s,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;iiwFP!000001I<`lkK4Kt{ws>GaKsfY@1_SSBCX&QeL6+k6wO;DZ9vhK ztrMCODB3=O<^SFp>gru@?+?YoUWwP4Z@#(t$h7mz2Obv(#Z6f$kDT2@Bb>(Qk{dS~ z#vS1aYN)1+O4^V!i<2xWD(y8+sT@Pf!m9($r1T6-6P%GaBS=3is3eO83+h9&^OPqN znNgE88P$YDT9|`Y4!exk!3wIVA?JR|EEeACIa#KsyUf2^1x7T+Q*fdiE``>WUgm7G zY!3Od5mImi1Fo;ycD0zTRe=_@WL$VKyrqJWwiUjbZZ)1DXO#U2uqf0Q)TF2@mGMKQ z;ye()3J$9x(ws`eL6zhoBWKPU;d*W;eLu>zVBaG+EJ1jkn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Al;;6*0uYp%`{&zJfFXU+E5{(_yo`SAjV2rztD1YRrpRYX z>;c<&c~^vVB$~_$PIS4@A}+5|>e!2QrMvwnA*9GeWl*%M43Z_?J=tWsu1etC{>hx4 z&265{P23j9?E{prP*7tt0EBrW$-IeBWNZfePSBbfIz7*dIPd=;=bB2FT+}eXe?FfV z64>H~yQ`_8Z?KnRq0cA%FRi^yIrTZ=?e12HimH8qvTqQTKiqMoyx5i nhw>y^OUrf$N$$`pwlB1bJP}#Eg|7=bCY=5sFV3w=DG~qx2DPkk diff --git a/src/at-rules.js b/src/at-rules.js index f964fdb9..409cfcfe 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -22,7 +22,7 @@ import {declarations} from './declarations' export function at(k, v, buf, prefix, composes, vendors, local, ns){ var i, kk - if (/^@(?:namespace|import|charset)$/.test(k)) { + if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { buf.a(k, ' ', v[kk], ';\n') @@ -30,18 +30,18 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ } else { buf.a(k, ' ', v, ';\n') } - } else if (/^@keyframes /.test(k)) { + } else if (/^@(?:-[-\w]+-)?keyframes /.test(k)) { k = local ? k.replace( // generated by script/regexps.js /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l ) : k - // add a @-webkit-keyframes block too. - - buf.a('@-webkit-', k.slice(1), ' {\n') - sheet(v, buf, '', 1, ['webkit']) - buf.c('}\n') - + // add a @-webkit-keyframes block if no explicit prefix is present. + if (/^@keyframes/.test(k)) { + buf.a('@-webkit-', k.slice(1), ' {\n') + sheet(v, buf, '', 1, ['webkit']) + buf.c('}\n') + } buf.a(k, ' {\n') sheet(v, buf, '', 1, vendors, local, ns) buf.c('}\n') @@ -70,7 +70,7 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ k[1] ) } - } else if (/^@(?:font-face$|viewport$|page )/.test(k)) { + } else if (/^@(?:-[-\w]+-)?(?:font-face$|viewport$|page )/.test(k)) { if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { buf.a(k, ' {\n') @@ -89,7 +89,7 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ } else if (/^@local$/.test(k)) { sheet(v, buf, prefix, 1, vendors, 1, ns) - } else if (/^@(?:media |supports |document )./.test(k)) { + } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { buf.a(k, ' {\n') sheet(v, buf, prefix, 1, vendors, local, ns) buf.c('}\n') diff --git a/test/test.js b/test/test.js index 2a206c85..38cbb725 100644 --- a/test/test.js +++ b/test/test.js @@ -727,9 +727,9 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('@keyframes', function(){ check( - j2c().sheet({p: {'@keyframes :global(qux)': { - ' from': {foo: 'bar'}, - ' to': {foo: 'baz'} + j2c().sheet({p: {'@keyframes global(qux)': { + from: {foo: 'bar'}, + to: {foo: 'baz'} }}}), '@-webkit-keyframes qux{from{-webkit-foo:bar;foo:bar}to{-webkit-foo:baz;foo:baz}}' + '@keyframes qux{from{foo:bar}to{foo:baz}}' @@ -744,9 +744,25 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} }) - ////////////////////////////////////////////////// + ///////////////////////////////////////////// + /**/ suite('At-rules with prefixes: ') /**/ + ///////////////////////////////////////////// + + + test('@-webkit-keyframes', function(){ + check( + j2c().sheet({p: {'@-webkit-keyframes global(qux)': { + from: {foo: 'bar'}, + to: {foo: 'baz'} + }}}), + '@-webkit-keyframes qux{from{foo:bar}to{foo:baz}}' + ) + }) + + + ///////////////////////////////////////////////// /**/ suite('At-rules with array values: ') /**/ - ////////////////////////////////////////////////// + ///////////////////////////////////////////////// test('@font-face with a 1-element array', function(){ @@ -833,7 +849,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('a global @keyframes', function() { var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({'@keyframes :global(bit)': {}}) + var css = _j2c.sheet({'@keyframes global(bit)': {}}) expect(names.bit).to.be(undefined) expect(css).to.contain('@keyframes bit {') }) @@ -854,7 +870,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('a global animation', function() { var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({p: {animation: ':global(bit) 1sec'}}) + var css = _j2c.sheet({p: {animation: 'global(bit) 1sec'}}) expect(names.bit).to.be(undefined) expect(css).to.contain('animation:bit ') }) @@ -883,7 +899,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('two animation-name, one global', function() { var _j2c = j2c(), names = _j2c.names - var css = _j2c.sheet({p: {animation_name: 'bit, :global(bat)'}}) + var css = _j2c.sheet({p: {animation_name: 'bit, global(bat)'}}) expect(names.bit.slice(0, 9)).to.be('bit__j2c-') expect(names.bat).to.be(undefined) expect(css).to.contain('animation-name:' + names.bit +', bat;') @@ -1041,7 +1057,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} expect(css).to.be('') }) - test('global extend', function() { + test('@composes with a global source', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {'@composes':':global(.bat)'}}) expect(names.bit).to.contain('bit__j2c-') @@ -1049,7 +1065,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} expect(css).to.be('') }) - test('two local extends', function() { + test('two local @composes', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {'@composes':['.bat', '.bot']}}) expect(css).to.be('') @@ -1061,7 +1077,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} expect(names.bit).to.contain(names.bat + ' ' + names.bot + ' ') }) - test('extend applies only to the last class in the selector', function() { + test('@compose only accepts single class selectors as target', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bot p .bit': {'@composes':'.bat'}}) expect(css).to.contain('@-error-at-composes-bad-target ".bot p .bit";') From da96b028c730451b24b321bdf29d67f3a9f2d1b2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 30 Jan 2016 22:59:06 +0100 Subject: [PATCH 011/244] Fix and test the filter interface for inline styles --- src/main.js | 9 +++++---- test/test.js | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main.js b/src/main.js index 8266dbfa..fa26d607 100644 --- a/src/main.js +++ b/src/main.js @@ -51,9 +51,6 @@ export default function j2c() { } }) - _use(emptyArray.slice.call(arguments)) - - function makeBuf(inline) { var buf function push() { @@ -66,7 +63,7 @@ export default function j2c() { d: push, // declaration c: push // close } - for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) + for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) || buf return buf } @@ -115,6 +112,10 @@ export default function j2c() { return postprocess(buf.b) } + // wait for the instance to be fully built before + // registering plugins. + _use(emptyArray.slice.call(arguments)) + return instance } diff --git a/test/test.js b/test/test.js index 38cbb725..8220962d 100644 --- a/test/test.js +++ b/test/test.js @@ -313,7 +313,24 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ), 'moo:bar;') }) - + test('a declaration filter', function() { + function filter(j2c) { + expect(j2c).to.be.an(Object) + expect(j2c.inline).to.be.a(Function) + return {filter: function(buf) { + expect(buf).to.be.an(Object) + expect(buf.d).to.be.a(Function) + var d = buf.d + buf.d = function(prop, col, value, semi) { + d('p'+prop, col, 'v'+value, semi) + } + }} + } + check( + j2c(filter).inline({foo:'bar'}), + 'pfoo:vbar;' + ) + }) // ///////////////////////////////// // /**/ suite('j2c().prefix: ') /**/ From c039de0686c61eb5616d96bcc787dc5085a33765 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 30 Jan 2016 22:59:51 +0100 Subject: [PATCH 012/244] Review, clean up and tighten the inline test suite --- test/test.js | 221 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 167 insertions(+), 54 deletions(-) diff --git a/test/test.js b/test/test.js index 8220962d..f95a58fa 100644 --- a/test/test.js +++ b/test/test.js @@ -13,13 +13,7 @@ function normalize(s) { return postcss.process(s).css } function check(result, expected){ result = normalize(result) - - // since you can't rely on the order of JS object keys, sometimes, several "expected" - // values must be provided. - // expected = (expected instanceof Array ? expected : [expected]).map(function(s){ - // return normalize(s) - // }) - expect(normalize(expected)).to.contain(result) + expect(normalize(expected)).to.be(result) } function randStr() { @@ -65,53 +59,84 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('two properties', function() { checkinline( {foo: 'bar', baz: 'qux'}, - 'foo:bar;baz:qux;' + 'foo:bar; baz:qux;' ) }) test('two properties, ensure order', function() { - check(j2c().inline({foo: 'bar', baz: 'qux'}), 'foo:bar;\nbaz:qux;') + checkinline( + {foo: 'bar', baz: 'qux'}, + 'foo:bar; baz:qux;' + ) }) - test('array of values', function() { checkinline( {foo:['bar', 'baz']}, - 'foo:bar;foo:baz;' + 'foo:bar; foo:baz;' ) }) - test('sub-properties', function(){ + test('one sub-property', function(){ checkinline( {foo: {bar: 'baz'}}, - 'foo-bar:baz;' + 'foo-bar: baz;' ) }) - test('multiple sub-properties', function(){ + test('two declrations at the top level', function() { checkinline( - {foo: {bar$qux: 'baz'}}, - 'foo-bar:baz;foo-qux:baz;' + {foo: 'qux', baz: 'qux'}, + 'foo:qux;baz:qux;' ) }) - test('multiple sub-properties, ensure order', function() { - check(j2c().inline({foo$baz: 'qux'}), 'foo:qux;\nbaz:qux;') + test('two sub-properties', function(){ + checkinline( + {foo: {bar: 'baz', qux: 'baz'}}, + 'foo-bar:baz; foo-qux:baz;' + ) }) + test('two sub-properties with a sub-sub-property', function(){ + checkinline( + {foo: {bar: {qux: 'quux'}, baz: {qix: 'qiix'}}}, + 'foo-bar-qux:quux; foo-baz-qix:qiix;' + ) + }) + test('$ operator in sub-property and sub-sub-property', function(){ + checkinline( + {foo: {bar: {qux: 'fred', quux: 'frod'}, baz: {qix: 'frad', qiix: 'frud'}}}, + 'foo-bar-qux:fred; foo-bar-quux:frod; foo-baz-qix:frad; foo-baz-qiix:frud;' + ) + }) + + test('$ operator at the top level', function() { + checkinline( + {foo$baz: 'qux'}, + 'foo:qux;baz:qux;' + ) + }) - test('multiple sub-properties with a sub-sub-property', function(){ + test('$ operator in sub-properties', function(){ + checkinline( + {foo: {bar$qux: 'baz'}}, + 'foo-bar:baz; foo-qux:baz;' + ) + }) + + test('$ operator in a sub-property with a sub-sub-property', function(){ checkinline( {foo: {bar$baz: {qux: 'quux'}}}, - 'foo-bar-qux:quux;foo-baz-qux:quux;' + 'foo-bar-qux:quux; foo-baz-qux:quux;' ) }) - test('multiple sub-properties with two sub-sub-properties', function(){ + test('$ operator in sub-property and sub-sub-property', function(){ checkinline( {foo: {bar$baz: {qux$quux: 'fred'}}}, - 'foo-bar-qux:fred;foo-bar-quux:fred;foo-baz-qux:fred;foo-baz-quux:fred;' + 'foo-bar-qux:fred; foo-bar-quux:fred; foo-baz-qux:fred; foo-baz-quux:fred;' ) }) @@ -167,7 +192,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('CSS *Hack', function() { // tested manually because the crass normalization // outputs an empty string. - check(j2c().inline({'*foo': 'bar'}), '*foo:bar;') + checkinline( + {'*foo': 'bar'}, + '*foo:bar;' + ) }) test('CSS _Hack', function() { @@ -178,10 +206,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} }) test('custom obj.valueOf', function() { - var bar = {valueOf:function(){return 'bar'}} + var bar = {valueOf:function(){return 'theBAR'}} checkinline( {foo:bar}, - 'foo:bar;' + 'foo:theBAR;' ) }) @@ -212,19 +240,55 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ) }) - test('null value', function() { + test('null leafs in array', function() { checkinline( - null, + {foo:[null]}, '' ) }) + test('undefined leafs in array', function() { + checkinline( + {foo:[void 8]}, + '' + ) + }) + + test('null leafs in array, preceded by value', function() { + checkinline( + {foo:['bar', null]}, + 'foo:bar;' + ) + }) + + test('undefined leafs in array, preceded by value', function() { + checkinline( + {foo:['bar', void 8]}, + 'foo:bar;' + ) + }) + + test('null leafs in arry, followed by a value', function() { + checkinline( + {foo:[null, 'bar']}, + 'foo:bar;' + ) + }) + + test('undefined leafs in arry, followed by a value', function() { + checkinline( + {foo:[void 8, 'bar']}, + 'foo:bar;' + ) + }) + test('undefined value', function() { checkinline( void 8, '' ) }) + test('null in Array', function() { checkinline( [null], @@ -239,24 +303,69 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ) }) + test('null in Array followed by object', function() { + checkinline( + [null, {foo:'bar'}], + 'foo:bar;' + ) + }) + + test('undefined in Array followed by object', function() { + checkinline( + [void 8, {foo:'bar'}], + 'foo:bar;' + ) + }) + + test('object followed by null in Array', function() { + checkinline( + [{foo:'bar'}, null], + 'foo:bar;' + ) + }) + + test('object followed by undefined in Array', function() { + checkinline( + [{foo:'bar'}, void 8], + 'foo:bar;' + ) + }) + + + //////////////////////////////////////// /**/ suite('Inline namespaces: ') /**/ //////////////////////////////////////// test('namespaced animation', function() { - var result = j2c({names: {foo:'theFoo'}}).inline({animation:'foo 1sec'}) - check(result, webkitify('animation:theFoo 1sec;')) + check( + j2c( + {names: {foo:'theFoo'}} + ).inline( + {animation:'foo 1sec'} + ), + webkitify('animation:theFoo 1sec;') + ) }) test('namespaced animation-name', function() { - var result = j2c({names: {foo:'theFoo'}}).inline({animation_name:'foo'}) - check(result, webkitify('animation-name:theFoo;')) + check( + j2c( + {names: {foo:'theFoo'}} + ).inline( + {animation_name:'foo'} + ), + webkitify('animation-name:theFoo;') + ) }) test('namespaced and non-namespaced animation-name', function() { var _j2c = j2c({names: {foo:'theFoo'}}) var result = _j2c.inline({animation_name:'foo, bar'}) - check(result, webkitify('animation-name:theFoo, ' + _j2c.names.bar + ';')) + check( + result, + webkitify('animation-name:theFoo, ' + _j2c.names.bar + ';') + ) }) test('two namespaced animations', function() { @@ -265,7 +374,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} ).inline( {animation:'foo 1sec, bar 2sec'} ) - check(result, webkitify('animation:theFoo 1sec, theBar 2sec;')) + check( + result, + webkitify('animation:theFoo 1sec, theBar 2sec;') + ) }) @@ -448,12 +560,13 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('mixing definitions and sub-selectors', function() { check( - j2c().sheet({'@global': {p: { - foo: 'bar', - ' .foo': {bar: 'baz'} - }}}), - - ['p .foo{bar:baz} p {foo:bar}', 'p {foo:bar} p .foo{bar:baz}'] + j2c().sheet({'@global': { + p: { + foo: 'bar', + ' .foo': {bar: 'baz'} + } + }}), + 'p {foo:bar} p .foo{bar:baz}' ) }) @@ -538,10 +651,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('... nor split on comas inside parentheses ...', function() { check(j2c().sheet({ - 'a:any(p, ul)': { - ' p': {qux: 5} + 'p:any(a, ul)': { + ' li': {qux: 5} } - }), 'a:any(p, ul) p {qux: 5}') + }), 'p:any(a, ul) li {qux: 5}') }) test('... but split in between', function(){ @@ -686,9 +799,9 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('standard at-rule with text value', function() { check( - j2c().sheet({p: { + j2c().sheet({ '@import': "'bar'" - }}), + }), "@import 'bar';" ) @@ -718,10 +831,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('Array of at-rules with text values', function() { check( - j2c().sheet({p: [ + j2c().sheet([ {'@import': "'bar'"}, {'@import': "'baz'"} - ]}), + ]), "@import 'bar'; @import 'baz';" ) }) @@ -737,23 +850,23 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('@font-face', function(){ check( - j2c().sheet({p: {'@font-face': {foo: 'bar'}}}), + j2c().sheet({'@font-face': {foo: 'bar'}}), '@font-face{foo:bar}' ) }) test('@keyframes', function(){ check( - j2c().sheet({p: {'@keyframes global(qux)': { + j2c().sheet({'@keyframes global(qux)': { from: {foo: 'bar'}, to: {foo: 'baz'} - }}}), + }}), '@-webkit-keyframes qux{from{-webkit-foo:bar;foo:bar}to{-webkit-foo:baz;foo:baz}}' + '@keyframes qux{from{foo:bar}to{foo:baz}}' ) }) - test('invalid @foo becomes at-foo property', function(){ + test('invalid @foo becomes @-error-unsupported-at-rule "@foo"', function(){ check( j2c().sheet({'@foo': 'bar'}), '@-error-unsupported-at-rule "@foo";' @@ -768,10 +881,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('@-webkit-keyframes', function(){ check( - j2c().sheet({p: {'@-webkit-keyframes global(qux)': { + j2c().sheet({'@-webkit-keyframes global(qux)': { from: {foo: 'bar'}, to: {foo: 'baz'} - }}}), + }}), '@-webkit-keyframes qux{from{foo:bar}to{foo:baz}}' ) }) @@ -784,14 +897,14 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('@font-face with a 1-element array', function(){ check( - j2c().sheet({p: {'@font-face':[{foo: 'bar'}]}}), + j2c().sheet({'@font-face':[{foo: 'bar'}]}), '@font-face{foo:bar}' ) }) test('@font-face with a 2-elements array', function(){ check( - j2c().sheet({p: {'@font-face':[{foo: 'bar'}, {foo: 'baz'}]}}), + j2c().sheet({'@font-face':[{foo: 'bar'}, {foo: 'baz'}]}), '@font-face{foo:bar}@font-face{foo:baz}' ) }) From 197649d7b50b25c538e35d632f92c43a31ac6707 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 30 Jan 2016 23:34:53 +0100 Subject: [PATCH 013/244] More test refactoring --- dist/j2c.amd.js | 9 +++++---- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 9 +++++---- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 9 +++++---- dist/j2c.global.js | 9 +++++---- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1918 -> 1917 bytes test/test.js | 30 ++++++++++++++++-------------- 9 files changed, 39 insertions(+), 33 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index d67d1036..35b21013 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -365,9 +365,6 @@ define(function () { 'use strict'; } }) - _use(emptyArray.slice.call(arguments)) - - function makeBuf(inline) { var buf function push() { @@ -380,7 +377,7 @@ define(function () { 'use strict'; d: push, // declaration c: push // close } - for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) + for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) || buf return buf } @@ -429,6 +426,10 @@ define(function () { 'use strict'; return postprocess(buf.b) } + // wait for the instance to be fully built before + // registering plugins. + _use(emptyArray.slice.call(arguments)) + return instance } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index e847e8c0..d040cfdb 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(p.call(t,s))for(l in e)p.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=b.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return"-"+e.toLowerCase()}function a(e,n,t,l,s,o,i,c,f){if(null!=e)if(/\$/.test(t))for(f in t=t.split("$"))p.call(t,f)&&a(e,n,t[f],l,s,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;i2_tlnY zB4d>@8&@eal!ivyz0nhX?w^AlOfySQ?UJ2N$>KSlC&#;VcDL}YtSr%RqZiDjF@>40 z_1eO^jVu)xlECzaNlNQl&h+rAC6b;{_5;A8QD0D#p{`6t z5221$zWhxJ*cH<1m|Fp=#1APw30_H$c!8SD!j+NyYv^Vu%*^NG8Ri85m7>j*Y2om5 zy_UbxGd^u2<148*b{kqaOS!+-)i%#SHosCi2ybGW&K@acGU}!t7)}mA4reGE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cJIN2P$r^{z=@gbj?~g}`T_QYut-+?%{7nxnwK!_#inFV+Z<{{pmEww#SeR-j6;Iy zB=43-$y*Nf!fH?mbSH}qT2LRPcx^H<+G~uQji-m0No#uQ;$}`a^cY=dY<-=jbFfYR zG?p+q*anVD^6cug>pX4uVXoC=6Wg_r++J0CIiPTaBzKG-Ar&}q77tW})`*6T`D6kW);4%(Y>dUncN$hrh!KK$qY2oSQ2<9(OK`lfcX3d4t>kKRhhkE zOHcM1>wC8nZxWcefMEVB?{??&Exc;^|ySW_~t8hZVJz zN(kj8uWIqvsxqPb?HjamP}l#7nO#uG3NHTX!>6AT3> z|9ijrNU%iy|K3HRDGg^$Y7f}nE4uomBhh45aH7kFmT`5JY{%BF>jdmS2_Z!$DuW(C zWspYc_QfXCHE9Cpb}#1iY;ONzZsN8;Zl9pIg8CeL3n0u3N#;F?B4cmaHu*U&u{PztVJ-k+3@yAAu{V&Vf+B; zIP~nYRO0q_Hs9Xw9d}yaF43b4^zB1jj#P(QvkZ2u`EpW!(V&VpKY))tjY{NS|6Cy7 z`ez6i^fbI22+iYF0yk%^3yC64gEo0~Q?Tv5+rA%1-rJG)ZMsVDle9^{X7}s#K3ze+ z*u)S{dz4&@QER`Owo|#)VqYCaYiZdIA;}#&&-O;=$rF*q8~D1QW5Vfw2h${Aba)Z~ E0Gi9U{{R30 diff --git a/test/test.js b/test/test.js index f95a58fa..585e0853 100644 --- a/test/test.js +++ b/test/test.js @@ -429,9 +429,11 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} function filter(j2c) { expect(j2c).to.be.an(Object) expect(j2c.inline).to.be.a(Function) + return {filter: function(buf) { expect(buf).to.be.an(Object) expect(buf.d).to.be.a(Function) + var d = buf.d buf.d = function(prop, col, value, semi) { d('p'+prop, col, 'v'+value, semi) @@ -931,15 +933,15 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('a local class', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') }) test('two local classes', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5}, '.bat': {bar:6}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') - expect(names.bit.slice(4)).to.be(names.bat.slice(4)) + expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bat).to.be('bat' + _j2c.scopeRoot) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') expect(css).to.contain('.' + names.bat + ' {\nbar:6;\n}') }) @@ -947,7 +949,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('a local and a global class', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5}, ':global(.bat)': {bar:6}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(names.bat).to.be(undefined) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') expect(css).to.contain('.bat {\nbar:6;\n}') @@ -956,7 +958,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('a local wrapping a global block', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {'@global': {'.bat': {foo:5}}}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(names.bat).to.be(undefined) expect(css).to.contain('.' + names.bit + '.bat {\nfoo:5;\n}') }) @@ -964,8 +966,8 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('two local classes, nested', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5, '.bat': {bar:6}}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') - expect(names.bit.slice(4)).to.be(names.bat.slice(4)) + expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bat).to.be('bat' + _j2c.scopeRoot) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') expect(css).to.contain('.' + names.bit +'.' + names.bat + ' {\nbar:6;\n}') }) @@ -973,7 +975,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('@keyframes', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'@keyframes bit': {}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(css).to.contain('@keyframes ' + names.bit +' {') }) @@ -994,7 +996,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('one animation', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation: 'bit 1sec'}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(css).to.contain('animation:' + names.bit +' ') }) @@ -1015,22 +1017,22 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('one animation-name', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit'}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(css).to.contain('animation-name:' + names.bit +';') }) test('two animation-name', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit, bat'}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') - expect(names.bit.slice(4)).to.be(names.bat.slice(4)) + expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bat).to.be('bat' + _j2c.scopeRoot) expect(css).to.contain('animation-name:' + names.bit +', ' + names.bat) }) test('two animation-name, one global', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit, global(bat)'}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(names.bat).to.be(undefined) expect(css).to.contain('animation-name:' + names.bit +', bat;') }) @@ -1038,7 +1040,7 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} test('a nested @global at-rule', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {'@global': {'.bat': {'foo':6}}}}) - expect(names.bit.slice(0, 9)).to.be('bit__j2c-') + expect(names.bit).to.be('bit' + _j2c.scopeRoot) expect(names.bat).to.be(undefined) expect(css).to.contain( names.bit +'.bat {') }) From 74e02cacb44c0881fa6e920a89a0e363d5d55cc3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 31 Jan 2016 01:29:45 +0100 Subject: [PATCH 014/244] Homogenize buffer output (makes nicer filters) and test sheet filters --- dist/j2c.amd.js | 28 ++++++++++++------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 28 ++++++++++++------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 28 ++++++++++++------- dist/j2c.global.js | 28 ++++++++++++------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1917 -> 1958 bytes src/at-rules.js | 22 ++++++++++----- src/declarations.js | 2 +- src/main.js | 4 +-- test/test.js | 55 ++++++++++++++++++++++++++++++++++++-- 12 files changed, 151 insertions(+), 50 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 35b21013..511a22d6 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -138,7 +138,7 @@ define(function () { 'use strict'; /*/-statements-/*/ // vendorify for (kk = 0; kk < vendors.length; kk++) - buf.d('-', vendors[kk], '-', k, k ? ':': '', o, ';\n') + buf.d('-' + vendors[kk] +'-' + k, k ? ':': '', o, ';\n') /*/-statements-/*/ buf.d(k, k ? ':': '', o, ';\n') @@ -165,7 +165,7 @@ define(function () { 'use strict'; */ function at(k, v, buf, prefix, composes, vendors, local, ns){ - var i, kk + var i, kk, params if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { @@ -180,13 +180,15 @@ define(function () { 'use strict'; /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l ) : k + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) // add a @-webkit-keyframes block if no explicit prefix is present. if (/^@keyframes/.test(k)) { - buf.a('@-webkit-', k.slice(1), ' {\n') + buf.a('@-webkit-'+k.slice(1), ' ', params, ' {\n') sheet(v, buf, '', 1, ['webkit']) buf.c('}\n') } - buf.a(k, ' {\n') + buf.a(k, ' ', params, ' {\n') sheet(v, buf, '', 1, vendors, local, ns) buf.c('}\n') @@ -215,14 +217,20 @@ define(function () { 'use strict'; ) } } else if (/^@(?:-[-\w]+-)?(?:font-face$|viewport$|page )/.test(k)) { + if (/ /.test(k)) { + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) + } else { + params = '' + } if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { - buf.a(k, ' {\n') + buf.a(k, params && ' ', params, ' {\n') declarations(v[kk], buf, '', vendors, local, ns) buf.c('}\n') } } else { - buf.a(k, ' {\n') + buf.a(k, params && ' ', params, ' {\n') declarations(v, buf, '', vendors, local, ns) buf.c('}\n') } @@ -234,7 +242,9 @@ define(function () { 'use strict'; sheet(v, buf, prefix, 1, vendors, 1, ns) } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { - buf.a(k, ' {\n') + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) + buf.a(k, ' ', params, ' {\n') sheet(v, buf, prefix, 1, vendors, local, ns) buf.c('}\n') @@ -404,7 +414,7 @@ define(function () { 'use strict'; /*/-statements-/*/ instance.sheet = function(statements, buf) { sheet( - statements, buf = makeBuf(), + statements, buf = makeBuf(false), '', '', // prefix and rawPRefix emptyArray, // vendors 1, // local, by default @@ -417,7 +427,7 @@ define(function () { 'use strict'; instance.inline = function (decl, buf) { declarations( decl, - buf = makeBuf(), + buf = makeBuf(true), '', // prefix emptyArray, // vendors 1, //local diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index d040cfdb..67dd9372 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(p.call(t,s))for(l in e)p.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=b.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return"-"+e.toLowerCase()}function a(e,n,t,l,s,o,i,c,f){if(null!=e)if(/\$/.test(t))for(f in t=t.split("$"))p.call(t,f)&&a(e,n,t[f],l,s,o);else switch(u.call(e=e.valueOf())){case h:for(i=0;ij><`m~F-Su}5zGyyGB zwl*{=P_(^)<^SGusH+`M+V1wD7}z86dd_#gbMt|l$**s-DBr8h7FrQ{^7fUORMr%k z^}=p^B8Xs?8OE7p6+Q7NPQzRqQcVgqv9!oZ>1SL@Vqu!%jKmp1+hM^Zold!5?yD_P zM8q;>Hm*`;C=HFUd!r`&++PPPm|~Wm+9^AolEq6rPmcHL?0(@}QCXtkL@$^NW3-vC z_mI!)6*$)7VLVZC^hPpBt zJ%%b;`QkT`!K#o}$HHcyO8l78Q^qUd5igLlS-3KSe+k_Pg^~GuJi@#Hppvv1GA$f_ zq1NIzdd915WPB;q#%@Ckdnxz#s@fJg$mUnF0O3t+)7cZHOhnz#Bg4S~$YBpDpd*M$hmrWt^M9r=YACy_>e}O~*l{$@T=AXo?jjA`?+5X{t{r-< ztPBp@@sjk8-CKSlhFb_F%O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A-3mpFO z^QV9MSTN{Ko_%W}XkGC&TEieKw4G-lp?ID z>3E4hip(2!#L&EgEICTDfrb?Kzql4|WjRQ`^t_-4DZEg2Y?WQmVcZqi5FxwT+8a3z z(gYl*xsVN)jk0ht3Us3i-@54D(#Q_(jZ8B@BlBcC8W}7Jh>cC!x-TF;enCLrGHz8y zBW!6hS7-aYEY&ygq!okE<$SE7XZKoYqSGqCT0hXNf}b_~h(MpiP9P2f@j)PtF(JqrtM^N9Qxkqv9gp_T63647mRkL=_e5 z6xsltLMCOKt3$Tw(L&L?kFK4+tL(5R0m;agSr`AO`(GkyUgO1J)?esbM3+6gsSI z-+F>m@XG#xEi80xSb#uxI+HW_nsvKw?m07c@ksLrhN0(Q>X{9|GCXw#;%UTZ(2R9# zhdOI!W;hR36@s-$K0~&kph4$NuzM?|9saxlFZB0UI0AD}j9)HeEsGWI#(}zX2Cp3gyVX_B%ta zwcijb*s&Yz(RPa%gi31<@b>l=-yh-DhB;nx}Uhui-JVU93UcM<>q D3FWQa diff --git a/src/at-rules.js b/src/at-rules.js index 409cfcfe..8d5fedf6 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -21,7 +21,7 @@ import {declarations} from './declarations' */ export function at(k, v, buf, prefix, composes, vendors, local, ns){ - var i, kk + var i, kk, params if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ for (kk = 0; kk < v.length; kk++) { @@ -36,13 +36,15 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l ) : k + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) // add a @-webkit-keyframes block if no explicit prefix is present. if (/^@keyframes/.test(k)) { - buf.a('@-webkit-', k.slice(1), ' {\n') + buf.a('@-webkit-'+k.slice(1), ' ', params, ' {\n') sheet(v, buf, '', 1, ['webkit']) buf.c('}\n') } - buf.a(k, ' {\n') + buf.a(k, ' ', params, ' {\n') sheet(v, buf, '', 1, vendors, local, ns) buf.c('}\n') @@ -71,14 +73,20 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ ) } } else if (/^@(?:-[-\w]+-)?(?:font-face$|viewport$|page )/.test(k)) { + if (/ /.test(k)) { + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) + } else { + params = '' + } if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { - buf.a(k, ' {\n') + buf.a(k, params && ' ', params, ' {\n') declarations(v[kk], buf, '', vendors, local, ns) buf.c('}\n') } } else { - buf.a(k, ' {\n') + buf.a(k, params && ' ', params, ' {\n') declarations(v, buf, '', vendors, local, ns) buf.c('}\n') } @@ -90,7 +98,9 @@ export function at(k, v, buf, prefix, composes, vendors, local, ns){ sheet(v, buf, prefix, 1, vendors, 1, ns) } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { - buf.a(k, ' {\n') + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) + buf.a(k, ' ', params, ' {\n') sheet(v, buf, prefix, 1, vendors, local, ns) buf.c('}\n') diff --git a/src/declarations.js b/src/declarations.js index 9cb52278..edc02199 100644 --- a/src/declarations.js +++ b/src/declarations.js @@ -70,7 +70,7 @@ export function declarations(o, buf, prefix, vendors, local, ns, /*var*/ k, v, k /*/-statements-/*/ // vendorify for (kk = 0; kk < vendors.length; kk++) - buf.d('-', vendors[kk], '-', k, k ? ':': '', o, ';\n') + buf.d('-' + vendors[kk] +'-' + k, k ? ':': '', o, ';\n') /*/-statements-/*/ buf.d(k, k ? ':': '', o, ';\n') diff --git a/src/main.js b/src/main.js index fa26d607..e1b85063 100644 --- a/src/main.js +++ b/src/main.js @@ -90,7 +90,7 @@ export default function j2c() { /*/-statements-/*/ instance.sheet = function(statements, buf) { sheet( - statements, buf = makeBuf(), + statements, buf = makeBuf(false), '', '', // prefix and rawPRefix emptyArray, // vendors 1, // local, by default @@ -103,7 +103,7 @@ export default function j2c() { instance.inline = function (decl, buf) { declarations( decl, - buf = makeBuf(), + buf = makeBuf(true), '', // prefix emptyArray, // vendors 1, //local diff --git a/test/test.js b/test/test.js index 585e0853..f035ed8f 100644 --- a/test/test.js +++ b/test/test.js @@ -430,9 +430,10 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} expect(j2c).to.be.an(Object) expect(j2c.inline).to.be.a(Function) - return {filter: function(buf) { + return {filter: function(buf, inline) { expect(buf).to.be.an(Object) expect(buf.d).to.be.a(Function) + expect(inline).to.be(true) var d = buf.d buf.d = function(prop, col, value, semi) { @@ -1359,9 +1360,59 @@ function webkitify(decl) {return '-webkit-' + decl + '\n' + decl} {p: {fop: 'bar'}} ), 'i{fop:bar;}') }) + + test('a sheet filter', function() { + function filter(j2c) { + expect(j2c).to.be.an(Object) + expect(j2c.sheet).to.be.a(Function) + + return {filter: function(buf, inline) { + expect(buf).to.be.an(Object) + expect(buf.a).to.be.a(Function) + expect(buf.b).to.be.a(Array) + expect(buf.c).to.be.a(Function) + expect(buf.d).to.be.a(Function) + expect(buf.s).to.be.a(Function) + expect(inline).to.be(false) + + return { + a: function(name, _, arg, term) { + expect(_).to.match(/^\s*$/) + expect(term).to.match(/[{;]/) + buf.a(name+'o', _, 'a'+arg, term) + }, + b: buf.b, + c: function(close) { + expect(close).to.contain('}') + buf.c(close) + }, + d: function(prop, col, value, semi) { + expect(col).to.match(/:/) + expect(semi).to.match(/;/) + buf.d('p'+prop, col, 'v'+value, semi) + }, + s: function(selector, brace) { + expect(brace).to.match(/\{/) + buf.s('h1, ' + selector, brace) + } + } + }} + } + check( + j2c(filter).sheet({'@global': { + '@import': 'foo', + p: {foo: 'bar'}, + '@keyframes foo': {from:{foo:'baz'}} + }}), + '@importo afoo;h1,p{pfoo:vbar}' + + '@-webkit-keyframeso afoo{0%,h1{p-webkit-foo:vbaz;pfoo:vbaz}}' + + '@keyframeso afoo{0%,h1{pfoo:vbaz}}' + ) + }) }) + + // TODO -// test .use // test the default `j2c` instance as well From 9647bf8d78d30196889350f05c14ab25d8080587 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 2 Feb 2016 01:08:27 +0100 Subject: [PATCH 015/244] Move the current prefix behavior to j2c-plugin-prefix-legacy. --- dist/j2c.amd.js | 73 ++++++++++++++------------------------ dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 73 ++++++++++++++------------------------ dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 73 ++++++++++++++------------------------ dist/j2c.global.js | 73 ++++++++++++++------------------------ dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1958 -> 1875 bytes src/at-rules.js | 32 +++++++---------- src/declarations.js | 21 ++++------- src/main.js | 4 +-- src/sheet.js | 16 ++++----- test/test.js | 29 ++++++++------- 13 files changed, 152 insertions(+), 248 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 511a22d6..375eac5b 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -79,26 +79,25 @@ define(function () { 'use strict'; * @param {string[]} buf - the buffer in which the final style sheet is built. * @param {string} prefix - the current property or a prefix in case of nested * sub-properties. - * @param {string} vendors - a list of vendor prefixes. - * @Param {boolean} local - are we in @local or in @global scope. + * @param {boolean} local - are we in @local or in @global scope. * @param {object} ns - helper functions to populate or create the @local namespace * and to @extend classes. * @param {function} ns.e - @extend helper. * @param {function} ns.l - @local helper. */ - function declarations(o, buf, prefix, vendors, local, ns, /*var*/ k, v, kk) { + function declarations(o, buf, prefix, local, ns, /*var*/ k, v, kk) { if (o==null) return if (/\$/.test(prefix)) { for (kk in (prefix = prefix.split('$'))) if (own.call(prefix, kk)) { - declarations(o, buf, prefix[kk], vendors, local, ns) + declarations(o, buf, prefix[kk], local, ns) } return } switch ( type.call(o = o.valueOf()) ) { case ARRAY: for (k = 0; k < o.length; k++) - declarations(o[k], buf, prefix, vendors, local, ns) + declarations(o[k], buf, prefix, local, ns) break case OBJECT: // prefix is falsy iif it is the empty string, which means we're at the root @@ -108,9 +107,9 @@ define(function () { 'use strict'; v = o[k] if (/\$/.test(k)) { for (kk in (k = k.split('$'))) if (own.call(k, kk)) - declarations(v, buf, prefix + k[kk], vendors, local, ns) + declarations(v, buf, prefix + k[kk], local, ns) } else { - declarations(v, buf, prefix + k, vendors, local, ns) + declarations(v, buf, prefix + k, local, ns) } } break @@ -127,20 +126,12 @@ define(function () { 'use strict'; return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) }).join(',') } - if (/^animation|^transition/.test(k)) vendors = ['webkit'] // '@' in properties also triggers the *ielte7 hack // Since plugins dispatch on the /^@/ for at-rules // we swap the at for an asterisk // http://browserhacks.com/#hack-6d49e92634f26ae6d6e46b3ebc10019a - k = k.replace(/^@/, '*') - /*/-statements-/*/ - // vendorify - for (kk = 0; kk < vendors.length; kk++) - buf.d('-' + vendors[kk] +'-' + k, k ? ':': '', o, ';\n') - /*/-statements-/*/ - buf.d(k, k ? ':': '', o, ';\n') } @@ -155,16 +146,15 @@ define(function () { 'use strict'; * @param {string[]} v - Either parameters for block-less rules or their block * for the others. * @param {string} prefix - the current selector or a prefix in case of nested rules - * @param {string} composes - as above, but without localization transformations - * @param {string} vendors - a list of vendor prefixes - * @Param {boolean} local - are we in @local or in @global scope? + * @param {string} composes - the potential target of a @composes rule, if any + * @param {boolean} local - are we in @local or in @global scope? * @param {object} ns - helper functions to populate or create the @local namespace * and to @extend classes * @param {function} ns.e - @extend helper * @param {function} ns.l - @local helper */ - function at(k, v, buf, prefix, composes, vendors, local, ns){ + function at(k, v, buf, prefix, composes, local, ns){ var i, kk, params if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { if(type.call(v) == ARRAY){ @@ -182,23 +172,18 @@ define(function () { 'use strict'; ) : k params = k.slice(k.indexOf(' ')+1) k = k.slice(0, k.indexOf(' ')) - // add a @-webkit-keyframes block if no explicit prefix is present. - if (/^@keyframes/.test(k)) { - buf.a('@-webkit-'+k.slice(1), ' ', params, ' {\n') - sheet(v, buf, '', 1, ['webkit']) - buf.c('}\n') - } + buf.a(k, ' ', params, ' {\n') - sheet(v, buf, '', 1, vendors, local, ns) + sheet(v, buf, '', 1, local, ns) buf.c('}\n') } else if (/^@composes$/.test(k)) { if (!local) { - buf.a('@-error-at-composes-in-at-global;\n') + buf.a('@-error-at-composes-in-at-global', '', '', ';\n') return } if (!composes) { - buf.a('@-error-at-composes-no-nesting;\n') + buf.a('@-error-at-composes-no-nesting', '', '', ';\n') return } composes = splitSelector(composes) @@ -206,7 +191,7 @@ define(function () { 'use strict'; k = /^\s*\.(\w+)\s*$/.exec(composes[i]) if (k == null) { // the last class is a :global(.one) - buf.a('@-error-at-composes-bad-target ', JSON.stringify(composes[i]), ';\n') + buf.a('@-error-at-composes-bad-target', ' ', JSON.stringify(composes[i]), ';\n') continue } ns.c( @@ -226,26 +211,26 @@ define(function () { 'use strict'; if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { buf.a(k, params && ' ', params, ' {\n') - declarations(v[kk], buf, '', vendors, local, ns) + declarations(v[kk], buf, '', local, ns) buf.c('}\n') } } else { buf.a(k, params && ' ', params, ' {\n') - declarations(v, buf, '', vendors, local, ns) + declarations(v, buf, '', local, ns) buf.c('}\n') } } else if (/^@global$/.test(k)) { - sheet(v, buf, prefix, 1, vendors, 0, ns) + sheet(v, buf, prefix, 1, 0, ns) } else if (/^@local$/.test(k)) { - sheet(v, buf, prefix, 1, vendors, 1, ns) + sheet(v, buf, prefix, 1, 1, ns) } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { params = k.slice(k.indexOf(' ')+1) k = k.slice(0, k.indexOf(' ')) buf.a(k, ' ', params, ' {\n') - sheet(v, buf, prefix, 1, vendors, local, ns) + sheet(v, buf, prefix, 1, local, ns) buf.c('}\n') } else { @@ -259,22 +244,21 @@ define(function () { 'use strict'; * @param {array|string|object} statements - a source object or sub-object. * @param {string[]} buf - the buffer in which the final style sheet is built * @param {string} prefix - the current selector or a prefix in case of nested rules - * @param {string} composes - the potential target of a @composes rule, if any. - * @param {string} vendors - a list of vendor prefixes - * @Param {boolean} local - are we in @local or in @global scope? + * @param {string} composes - the potential target of a @composes rule, if any + * @param {boolean} local - are we in @local or in @global scope? * @param {object} ns - helper functions to populate or create the @local namespace * and to @composes classes * @param {function} ns.e - @composes helper * @param {function} ns.l - @local helper */ - function sheet(statements, buf, prefix, composes, vendors, local, ns) { + function sheet(statements, buf, prefix, composes, local, ns) { var k, v, inDeclaration switch (type.call(statements)) { case ARRAY: for (k = 0; k < statements.length; k++) - sheet(statements[k], buf, prefix, composes, vendors, local, ns) + sheet(statements[k], buf, prefix, composes, local, ns) break case OBJECT: @@ -285,12 +269,12 @@ define(function () { 'use strict'; inDeclaration = 1 buf.s(( prefix || '*' ), ' {\n') } - declarations(v, buf, k, vendors, local, ns) + declarations(v, buf, k, local, ns) } else if (/^@/.test(k)) { // Handle At-rules inDeclaration = (inDeclaration && buf.c('}\n') && 0) - at(k, v, buf, prefix, composes, vendors, local, ns) + at(k, v, buf, prefix, composes, local, ns) } else { // selector or nested sub-selectors @@ -310,7 +294,6 @@ define(function () { 'use strict'; ) : k ), prefix), composes || prefix ? '' : k, - vendors, local, ns ) } @@ -321,7 +304,7 @@ define(function () { 'use strict'; buf.s( ( prefix || ':-error-no-selector' ) , ' {\n' ) - declarations(statements, buf, '', vendors, local, ns) + declarations(statements, buf, '', local, ns) buf.c('}\n') } } @@ -387,7 +370,7 @@ define(function () { 'use strict'; d: push, // declaration c: push // close } - for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) || buf + for (var i = 0; i < filters.length; i++) buf = filters[i](buf, inline) return buf } @@ -416,7 +399,6 @@ define(function () { 'use strict'; sheet( statements, buf = makeBuf(false), '', '', // prefix and rawPRefix - emptyArray, // vendors 1, // local, by default state ) @@ -429,7 +411,6 @@ define(function () { 'use strict'; decl, buf = makeBuf(true), '', // prefix - emptyArray, // vendors 1, //local state ) diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 67dd9372..b23e95c3 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(p.call(t,s))for(l in e)p.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=b.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return"-"+e.toLowerCase()}function a(e,n,t,l,s,i,o,c,f){if(null!=e)if(/\$/.test(t))for(f in t=t.split("$"))p.call(t,f)&&a(e,n,t[f],l,s,i);else switch(u.call(e=e.valueOf())){case h:for(o=0;ot2{fr5L4Qvy;BkT?*-7=?wESJnLPt^fS z%wv&K6IUtKgoK)#la>p18J>d^R8m9E-IiG{@%kxVCG~CU-L8GZD}yCSM8S${t@LWk zcB|^NT~%E0%)kQjWYesdle5y-yc8_s7?$^x6Vf!?ljExfb8@!2KLae%+6!h<2DTAqZsiMaLkI_Z62T4xuI29fcrQWOTG zTSUk}h{Afl6&V+)BT&eNWm${isiO#(^UTDFf6Ors7SqFj_SU}H;u!r(~*L( zBP;O`%7d>Le0&8Hya|HMUZ^b-2~MgzY@;gm2>h6k2KKvevZj?U$c6Ynt3o>Ygj!4n zSx+C<6x|_0rN0AQ)CL9c3sFu{m`Fq}Bcp_KzXn)3KG_J%X-W5?rPI>~&}!8_ydoR; zur^mEJku1%Qfbp<2c|1-Nbf1`9N1Auk|;Vj&y~QG@=^9oDS;{4x8y?$L}gs2oo=na zCR?-h7j*iCf628~YB4Inqii$9cJW8REdbnr)BO;{yiE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9m30!#9WpkE3ozIxv$YyU~4!k zUZoeOT^1s49~Kjat|PY=viCRT>!>hJI*ET76B2)vcsA^a znP&xMz^IA{6y)&##j$WI%Rus_=LJ1T;f1netL%affowQz zRAv;T7(8lWtV=vCjqDIEkZA^JWS(tDBZD;$v9U?pC;*6$Z_v<~jeD`t8}@9uYb1PL zmhvkk;uV9a>O8cfXLnm@qSGqCW+qUqg3lU0S)k5gClCjL_#hC+7#7)>rvQKeMwqU- zFgLoirg3=;?cf;JB{*zL2yPc)pQ9SndyQlkn=8|FSf?`-h^Jg~`;!$WD446o0w|#~ zU5bBbZ3FM~XJ}WUy7(KnTR)c?F8=ZD`yb!G`_tR^?;hMJ)S+v=gZ2U1n@=tTkRRSr zS4I9`?_$t+2ct&31#Cz1CUiDD8Y~NbbUw2zDlSTazI|=F9rsT{RFSbtq0dn%Bzd;E z+GLwXRN&n9YR-)2c2{!)y#>-vZ z%ak?~GkBVHt8T72GkI}I^9#!GqsCIrYyg(wsWT8yBR+#}vtv7yfHO10aVYo@tVQw( zvIPYVI&Xs2TOsW5`wiUCpI_k{nBxvhaIXnsPYmL(i4;Z&kWWJ{mW2|x58&Mak94%V z+xuN&BAOX`bdJ8gkFuWXPzh)LmRBE->K6l=8v7Oa*wQFN{ Date: Tue, 2 Feb 2016 17:53:42 +0100 Subject: [PATCH 016/244] Cleanup the at-rule handling --- dist/j2c.amd.js | 122 ++++++++++++++++++-------------------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 122 ++++++++++++++++++-------------------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 122 ++++++++++++++++++-------------------- dist/j2c.global.js | 122 ++++++++++++++++++-------------------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1875 -> 1906 bytes src/at-rules.js | 82 ++++++++++++------------- src/declarations.js | 18 +++--- src/sheet.js | 22 +++---- 11 files changed, 298 insertions(+), 318 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 375eac5b..d30bc902 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -80,24 +80,24 @@ define(function () { 'use strict'; * @param {string} prefix - the current property or a prefix in case of nested * sub-properties. * @param {boolean} local - are we in @local or in @global scope. - * @param {object} ns - helper functions to populate or create the @local namespace + * @param {object} state - helper functions to populate or create the @local namespace * and to @extend classes. - * @param {function} ns.e - @extend helper. - * @param {function} ns.l - @local helper. + * @param {function} state.e - @extend helper. + * @param {function} state.l - @local helper. */ - function declarations(o, buf, prefix, local, ns, /*var*/ k, v, kk) { + function declarations(o, buf, prefix, local, state, /*var*/ k, v, kk) { if (o==null) return if (/\$/.test(prefix)) { for (kk in (prefix = prefix.split('$'))) if (own.call(prefix, kk)) { - declarations(o, buf, prefix[kk], local, ns) + declarations(o, buf, prefix[kk], local, state) } return } switch ( type.call(o = o.valueOf()) ) { case ARRAY: for (k = 0; k < o.length; k++) - declarations(o[k], buf, prefix, local, ns) + declarations(o[k], buf, prefix, local, state) break case OBJECT: // prefix is falsy iif it is the empty string, which means we're at the root @@ -107,9 +107,9 @@ define(function () { 'use strict'; v = o[k] if (/\$/.test(k)) { for (kk in (k = k.split('$'))) if (own.call(k, kk)) - declarations(v, buf, prefix + k[kk], local, ns) + declarations(v, buf, prefix + k[kk], local, state) } else { - declarations(v, buf, prefix + k, local, ns) + declarations(v, buf, prefix + k, local, state) } } break @@ -123,7 +123,7 @@ define(function () { 'use strict'; if (local && (k == 'animation-name' || k == 'animation')) { o = o.split(',').map(function (o) { - return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) + return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, state.l) }).join(',') } // '@' in properties also triggers the *ielte7 hack @@ -148,34 +148,19 @@ define(function () { 'use strict'; * @param {string} prefix - the current selector or a prefix in case of nested rules * @param {string} composes - the potential target of a @composes rule, if any * @param {boolean} local - are we in @local or in @global scope? - * @param {object} ns - helper functions to populate or create the @local namespace + * @param {object} state - helper functions to populate or create the @local namespace * and to @extend classes - * @param {function} ns.e - @extend helper - * @param {function} ns.l - @local helper + * @param {function} state.e - @extend helper + * @param {function} state.l - @local helper */ - function at(k, v, buf, prefix, composes, local, ns){ + function at(k, v, buf, prefix, composes, local, state){ var i, kk, params - if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { - if(type.call(v) == ARRAY){ - for (kk = 0; kk < v.length; kk++) { - buf.a(k, ' ', v[kk], ';\n') - } - } else { - buf.a(k, ' ', v, ';\n') - } - } else if (/^@(?:-[-\w]+-)?keyframes /.test(k)) { - k = local ? k.replace( - // generated by script/regexps.js - /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, - ns.l - ) : k - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + if (/^@global$/.test(k)) { + sheet(v, buf, prefix, 1, 0, state) - buf.a(k, ' ', params, ' {\n') - sheet(v, buf, '', 1, local, ns) - buf.c('}\n') + } else if (/^@local$/.test(k)) { + sheet(v, buf, prefix, 1, 1, state) } else if (/^@composes$/.test(k)) { if (!local) { @@ -194,43 +179,54 @@ define(function () { 'use strict'; buf.a('@-error-at-composes-bad-target', ' ', JSON.stringify(composes[i]), ';\n') continue } - ns.c( + state.c( type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, ns.l) - }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, ns.l), + return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l) + }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l), k[1] ) } - } else if (/^@(?:-[-\w]+-)?(?:font-face$|viewport$|page )/.test(k)) { - if (/ /.test(k)) { - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + } else if (/^@(?:-[\w]+-)?(?:namespace|import|charset)$/.test(k)) { + if(type.call(v) == ARRAY){ + for (kk = 0; kk < v.length; kk++) { + buf.a(k, ' ', v[kk], ';\n') + } } else { - params = '' + buf.a(k, ' ', v, ';\n') } + } else if (/^@(?:-[\w]+-)?keyframes /.test(k)) { + k = local ? k.replace( + // generated by script/regexps.js + /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + state.l + ) : k + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) + + buf.a(k, ' ', params, ' {\n') + sheet(v, buf, '', 1, local, state) + buf.c('}\n') + + } else if (/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/.test(k)) { + params = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/)[1] || '' + k = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page)/)[0] if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { buf.a(k, params && ' ', params, ' {\n') - declarations(v[kk], buf, '', local, ns) + declarations(v[kk], buf, '', local, state) buf.c('}\n') } } else { buf.a(k, params && ' ', params, ' {\n') - declarations(v, buf, '', local, ns) + declarations(v, buf, '', local, state) buf.c('}\n') } - } else if (/^@global$/.test(k)) { - sheet(v, buf, prefix, 1, 0, ns) - - } else if (/^@local$/.test(k)) { - sheet(v, buf, prefix, 1, 1, ns) - - } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + } else if (/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/.test(k)) { + params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/)[1] + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)/)[0] buf.a(k, ' ', params, ' {\n') - sheet(v, buf, prefix, 1, local, ns) + sheet(v, buf, prefix, 1, local, state) buf.c('}\n') } else { @@ -246,19 +242,19 @@ define(function () { 'use strict'; * @param {string} prefix - the current selector or a prefix in case of nested rules * @param {string} composes - the potential target of a @composes rule, if any * @param {boolean} local - are we in @local or in @global scope? - * @param {object} ns - helper functions to populate or create the @local namespace + * @param {object} state - helper functions to populate or create the @local namespace * and to @composes classes - * @param {function} ns.e - @composes helper - * @param {function} ns.l - @local helper + * @param {function} state.e - @composes helper + * @param {function} state.l - @local helper */ - function sheet(statements, buf, prefix, composes, local, ns) { + function sheet(statements, buf, prefix, composes, local, state) { var k, v, inDeclaration switch (type.call(statements)) { case ARRAY: for (k = 0; k < statements.length; k++) - sheet(statements[k], buf, prefix, composes, local, ns) + sheet(statements[k], buf, prefix, composes, local, state) break case OBJECT: @@ -269,12 +265,12 @@ define(function () { 'use strict'; inDeclaration = 1 buf.s(( prefix || '*' ), ' {\n') } - declarations(v, buf, k, local, ns) + declarations(v, buf, k, local, state) } else if (/^@/.test(k)) { // Handle At-rules inDeclaration = (inDeclaration && buf.c('}\n') && 0) - at(k, v, buf, prefix, composes, local, ns) + at(k, v, buf, prefix, composes, local, state) } else { // selector or nested sub-selectors @@ -285,16 +281,16 @@ define(function () { 'use strict'; (/,/.test(prefix) || prefix && /,/.test(k)) ? cartesian(splitSelector(prefix), splitSelector( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l ) : k ), prefix).join(',') : concat(prefix, ( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l ) : k ), prefix), composes || prefix ? '' : k, - local, ns + local, state ) } } @@ -304,7 +300,7 @@ define(function () { 'use strict'; buf.s( ( prefix || ':-error-no-selector' ) , ' {\n' ) - declarations(statements, buf, '', local, ns) + declarations(statements, buf, '', local, state) buf.c('}\n') } } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index b23e95c3..245eb034 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(p.call(t,s))for(l in e)p.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=b.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return"-"+e.toLowerCase()}function a(e,n,t,l,s,o,i,c){if(null!=e)if(/\$/.test(t))for(c in t=t.split("$"))p.call(t,c)&&a(e,n,t[c],l,s);else switch(u.call(e=e.valueOf())){case h:for(o=0;o?3$11pRr79@J%LTIh@ zV$C-Tb678os6=jI!1Ha>Ea#K8HqfH3crFMGZ<(O9X@qabQza4fgt|WhEEeqrGa1^- zOne*JcpZq}MGmVXYL2DN!Ib1SqoL5NAgwht&*)Bx!3eZ>gq6bF#J_Uh^ z%6c{F1mxK^1Wo31>4TAuq^hOjNK(NR#n(J`LPm4c#2gi?7tB$eIXNEft4o81;i*m= zQSd`$Lj~{*1pEvH1oh}Rl6<%LcLt-JvMbXx9+%~wqdOLo?}c|2D`5LDi0@6~Fza+= zAZ*WTGKBKr>zNo&A(X7baJ8+}npY`F%?-h*%6tlsDQ#fBd#6iQ1riJy&zeT)!K$iq0Jv!%r5ia?t zq{t}if^k&_c^^NP#_?`t{}u_-VD*#-aPr86a>|66M??GHN@F6q%V_v2Y?#k2*IQu$ zu$jkx{Pgi(0bWaTTNYnB6gr+wTn?%%5_}VA@#lO9a4isP*dSlu}PivPIO04rY^>xtMr@rQfSm^Hl8oyd^L5>?5~6ivoKfNqWw@zbpv%-)3y$_CNFc7LxA;N}4zt zIG|pH>G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Mf8U}ol?Ib3wFB&k^EOkqBpTfc0d%?0B2u%W zKg@RRK;Zs?UK@*8rZ5V~6v{btWb;d=ozl47J6!GQ$=>m5Z{#+&+^%7Sg~Sdy0unsA z(quZCNHPqU-DK%p4U;2wDo*D~=n71!RmLmWKYYEP7XsLVg8gi(pGe%}5a2i)?FU1) z(K#EjwhEnFHd>fMhm{%X6GQ~7%y;t&=5Y^x^7>ORp1Dvld!+sEg>mBFNY4b|8J0Q+ zu{2^{<_~O#X3x`}U5D1rg0)UQL5Uz>K_5+U`oOsv|8oOg801&>3*2!7^|oz5ALtfp zXC!Tc0PQj;yrPi&4wfO>E z>?l-N?sY%smTTS5kSb{1f1IrE)-fhDZ4eZQB=MX02_@jyJJh@xR^GUkH%+om?&73M zKBae?C+MFhtTGQAvBA58tve(i?tu5 N{|7eJpB;4)000JonW6vy diff --git a/src/at-rules.js b/src/at-rules.js index f9c55fc5..fac9311c 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -13,34 +13,19 @@ import {declarations} from './declarations' * @param {string} prefix - the current selector or a prefix in case of nested rules * @param {string} composes - the potential target of a @composes rule, if any * @param {boolean} local - are we in @local or in @global scope? - * @param {object} ns - helper functions to populate or create the @local namespace + * @param {object} state - helper functions to populate or create the @local namespace * and to @extend classes - * @param {function} ns.e - @extend helper - * @param {function} ns.l - @local helper + * @param {function} state.e - @extend helper + * @param {function} state.l - @local helper */ -export function at(k, v, buf, prefix, composes, local, ns){ +export function at(k, v, buf, prefix, composes, local, state){ var i, kk, params - if (/^@(?:-[-\w]+-)?(?:namespace|import|charset)$/.test(k)) { - if(type.call(v) == ARRAY){ - for (kk = 0; kk < v.length; kk++) { - buf.a(k, ' ', v[kk], ';\n') - } - } else { - buf.a(k, ' ', v, ';\n') - } - } else if (/^@(?:-[-\w]+-)?keyframes /.test(k)) { - k = local ? k.replace( - // generated by script/regexps.js - /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, - ns.l - ) : k - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + if (/^@global$/.test(k)) { + sheet(v, buf, prefix, 1, 0, state) - buf.a(k, ' ', params, ' {\n') - sheet(v, buf, '', 1, local, ns) - buf.c('}\n') + } else if (/^@local$/.test(k)) { + sheet(v, buf, prefix, 1, 1, state) } else if (/^@composes$/.test(k)) { if (!local) { @@ -59,43 +44,54 @@ export function at(k, v, buf, prefix, composes, local, ns){ buf.a('@-error-at-composes-bad-target', ' ', JSON.stringify(composes[i]), ';\n') continue } - ns.c( + state.c( type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, ns.l) - }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, ns.l), + return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l) + }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l), k[1] ) } - } else if (/^@(?:-[-\w]+-)?(?:font-face$|viewport$|page )/.test(k)) { - if (/ /.test(k)) { - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + } else if (/^@(?:-[\w]+-)?(?:namespace|import|charset)$/.test(k)) { + if(type.call(v) == ARRAY){ + for (kk = 0; kk < v.length; kk++) { + buf.a(k, ' ', v[kk], ';\n') + } } else { - params = '' + buf.a(k, ' ', v, ';\n') } + } else if (/^@(?:-[\w]+-)?keyframes /.test(k)) { + k = local ? k.replace( + // generated by script/regexps.js + /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + state.l + ) : k + params = k.slice(k.indexOf(' ')+1) + k = k.slice(0, k.indexOf(' ')) + + buf.a(k, ' ', params, ' {\n') + sheet(v, buf, '', 1, local, state) + buf.c('}\n') + + } else if (/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/.test(k)) { + params = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/)[1] || '' + k = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page)/)[0] if (type.call(v) === ARRAY) { for (kk = 0; kk < v.length; kk++) { buf.a(k, params && ' ', params, ' {\n') - declarations(v[kk], buf, '', local, ns) + declarations(v[kk], buf, '', local, state) buf.c('}\n') } } else { buf.a(k, params && ' ', params, ' {\n') - declarations(v, buf, '', local, ns) + declarations(v, buf, '', local, state) buf.c('}\n') } - } else if (/^@global$/.test(k)) { - sheet(v, buf, prefix, 1, 0, ns) - - } else if (/^@local$/.test(k)) { - sheet(v, buf, prefix, 1, 1, ns) - - } else if (/^@(?:-[-\w]+-)?(?:media |supports |document )./.test(k)) { - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + } else if (/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/.test(k)) { + params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/)[1] + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)/)[0] buf.a(k, ' ', params, ' {\n') - sheet(v, buf, prefix, 1, local, ns) + sheet(v, buf, prefix, 1, local, state) buf.c('}\n') } else { diff --git a/src/declarations.js b/src/declarations.js index ebc13fae..0c5e6b0f 100644 --- a/src/declarations.js +++ b/src/declarations.js @@ -12,24 +12,24 @@ function decamelize(match) { * @param {string} prefix - the current property or a prefix in case of nested * sub-properties. * @param {boolean} local - are we in @local or in @global scope. - * @param {object} ns - helper functions to populate or create the @local namespace + * @param {object} state - helper functions to populate or create the @local namespace * and to @extend classes. - * @param {function} ns.e - @extend helper. - * @param {function} ns.l - @local helper. + * @param {function} state.e - @extend helper. + * @param {function} state.l - @local helper. */ -export function declarations(o, buf, prefix, local, ns, /*var*/ k, v, kk) { +export function declarations(o, buf, prefix, local, state, /*var*/ k, v, kk) { if (o==null) return if (/\$/.test(prefix)) { for (kk in (prefix = prefix.split('$'))) if (own.call(prefix, kk)) { - declarations(o, buf, prefix[kk], local, ns) + declarations(o, buf, prefix[kk], local, state) } return } switch ( type.call(o = o.valueOf()) ) { case ARRAY: for (k = 0; k < o.length; k++) - declarations(o[k], buf, prefix, local, ns) + declarations(o[k], buf, prefix, local, state) break case OBJECT: // prefix is falsy iif it is the empty string, which means we're at the root @@ -39,9 +39,9 @@ export function declarations(o, buf, prefix, local, ns, /*var*/ k, v, kk) { v = o[k] if (/\$/.test(k)) { for (kk in (k = k.split('$'))) if (own.call(k, kk)) - declarations(v, buf, prefix + k[kk], local, ns) + declarations(v, buf, prefix + k[kk], local, state) } else { - declarations(v, buf, prefix + k, local, ns) + declarations(v, buf, prefix + k, local, state) } } break @@ -55,7 +55,7 @@ export function declarations(o, buf, prefix, local, ns, /*var*/ k, v, kk) { if (local && (k == 'animation-name' || k == 'animation')) { o = o.split(',').map(function (o) { - return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, ns.l) + return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, state.l) }).join(',') } // '@' in properties also triggers the *ielte7 hack diff --git a/src/sheet.js b/src/sheet.js index 83536a6c..07456219 100644 --- a/src/sheet.js +++ b/src/sheet.js @@ -12,19 +12,19 @@ import {at} from './at-rules' * @param {string} prefix - the current selector or a prefix in case of nested rules * @param {string} composes - the potential target of a @composes rule, if any * @param {boolean} local - are we in @local or in @global scope? - * @param {object} ns - helper functions to populate or create the @local namespace + * @param {object} state - helper functions to populate or create the @local namespace * and to @composes classes - * @param {function} ns.e - @composes helper - * @param {function} ns.l - @local helper + * @param {function} state.e - @composes helper + * @param {function} state.l - @local helper */ -export function sheet(statements, buf, prefix, composes, local, ns) { +export function sheet(statements, buf, prefix, composes, local, state) { var k, v, inDeclaration switch (type.call(statements)) { case ARRAY: for (k = 0; k < statements.length; k++) - sheet(statements[k], buf, prefix, composes, local, ns) + sheet(statements[k], buf, prefix, composes, local, state) break case OBJECT: @@ -35,12 +35,12 @@ export function sheet(statements, buf, prefix, composes, local, ns) { inDeclaration = 1 buf.s(( prefix || '*' ), ' {\n') } - declarations(v, buf, k, local, ns) + declarations(v, buf, k, local, state) } else if (/^@/.test(k)) { // Handle At-rules inDeclaration = (inDeclaration && buf.c('}\n') && 0) - at(k, v, buf, prefix, composes, local, ns) + at(k, v, buf, prefix, composes, local, state) } else { // selector or nested sub-selectors @@ -51,16 +51,16 @@ export function sheet(statements, buf, prefix, composes, local, ns) { (/,/.test(prefix) || prefix && /,/.test(k)) ? cartesian(splitSelector(prefix), splitSelector( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l ) : k ), prefix).join(',') : concat(prefix, ( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, ns.l + /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l ) : k ), prefix), composes || prefix ? '' : k, - local, ns + local, state ) } } @@ -70,7 +70,7 @@ export function sheet(statements, buf, prefix, composes, local, ns) { buf.s( ( prefix || ':-error-no-selector' ) , ' {\n' ) - declarations(statements, buf, '', local, ns) + declarations(statements, buf, '', local, state) buf.c('}\n') } } From b8f663bc9e19cef2788967d1cd3ab6bd15a3deb5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 7 Feb 2016 01:27:24 +0100 Subject: [PATCH 017/244] Refactor the plugin API, isolate flatIter --- dist/j2c.amd.js | 65 ++++++++++++++++++-------------------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 65 ++++++++++++++++++-------------------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 65 ++++++++++++++++++-------------------- dist/j2c.global.js | 65 ++++++++++++++++++-------------------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1906 -> 1905 bytes package.json | 3 +- src/helpers.js | 31 +++++++++++++----- src/main.js | 45 ++++++++++---------------- test/test.js | 52 +++++++++++++++--------------- 12 files changed, 193 insertions(+), 204 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index d30bc902..1308b0df 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -1,13 +1,14 @@ define(function () { 'use strict'; - var emptyObject = {}; var emptyArray = []; + var emptyObject = {}; + var emptyString = ''; var type = emptyObject.toString; - var own = emptyObject.hasOwnProperty; - var OBJECT = type.call(emptyObject); var ARRAY = type.call(emptyArray); - var STRING = type.call(''); + var OBJECT = type.call(emptyObject); + var STRING = type.call(emptyString); var FUNCTION = type.call(type); + var own = emptyObject.hasOwnProperty; /*/-inline-/*/ // function cartesian(a, b, res, i, j) { // res = []; @@ -39,12 +40,14 @@ define(function () { 'use strict'; // "Tokenizes" the selectors into parts relevant for the next function. // Strings and comments are matched, but ignored afterwards. + // This is not a full tokenizers. It only recognizes comas, parentheses, + // strings and comments. + // regexp generated by scripts/regexps.js then trimmed by hand var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g /** * This will split a coma-separated selector list into individual selectors, - * ignoring comas in strings and in :pseudo-selectors(parameter, lists). - * regexp generated by scripts/regexps.js then trimmed by hand + * ignoring comas in strings, comments and in :pseudo-selectors(parameter, lists). * @param {string} selector * @return {string[]} */ @@ -67,6 +70,13 @@ define(function () { 'use strict'; res.unshift(selector) return res } + /* /-statements-/*/ + function flatIter (f) { + return function iter(arg) { + if (type.call(arg) === ARRAY) for (var i= 0 ; i < arg.length; i ++) iter(arg[i]) + else f(arg) + } + } function decamelize(match) { return '-' + match.toLowerCase() @@ -305,13 +315,6 @@ define(function () { 'use strict'; } } - function flatIter (f) { - return function iter(arg) { - if (type.call(arg) === ARRAY) for (var i= 0 ; i < arg.length; i ++) iter(arg[i]) - else f(arg) - } - } - function j2c() { var filters = [] var postprocessors = [] @@ -331,27 +334,25 @@ define(function () { 'use strict'; } } - var registerLocals= flatIter(function(ns) { - for (var k in ns) if (!( k in locals )) locals[k] = ns[k] - }) - - var registerFilter = flatIter(function(filter) { - filters.push(filter) - }) - - var registerPostprocessor = flatIter(function(pp) { - postprocessors.push(pp) - }) + var register = { + $names: flatIter(function(ns) { + for (var k in ns) if (!( k in locals )) locals[k] = ns[k] + }), + $filter: flatIter(function(filter) { + filters.push(filter) + }), + $postprocess: flatIter(function(pp) { + postprocessors.push(pp) + }) + } var _use = flatIter(function(plugin) { if (type.call(plugin) === FUNCTION) plugin = plugin(instance) if (!plugin) return - for (var k in plugin) if (own.call(plugin, k)) switch(k) { - case 'names': registerLocals(plugin[k]); break - case 'postprocess': registerPostprocessor(plugin[k]); break - case 'filter': registerFilter(plugin[k]); break - default: if (!( k in instance )) instance[k] = plugin[k] - } + for (var k in plugin) if (own.call(plugin, k)) if (/^\$/.test(k)){ + if (k in register) register[k](plugin[k]) + } else if (!( k in instance )) instance[k] = plugin[k] + }) function makeBuf(inline) { @@ -413,10 +414,6 @@ define(function () { 'use strict'; return postprocess(buf.b) } - // wait for the instance to be fully built before - // registering plugins. - _use(emptyArray.slice.call(arguments)) - return instance } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 245eb034..5fb5283c 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,a,r,s,l){r=[];for(l in n)if(p.call(n,l))for(s in e)p.call(e,s)&&r.push(t(e[s],n[l],a));return r}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){for(var t,n,a=[],r=[],s=0;t=b.exec(e);)switch(t[0]){case"(":s++;break;case")":s--;break;case",":if(s)break;a.push(t.index)}for(n=a.length;n--;)r.unshift(e.slice(a[n]+1)),e=e.slice(0,a[n]);return r.unshift(e),r}function a(e){return"-"+e.toLowerCase()}function r(e,t,n,s,l,o,c,i){if(null!=e)if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_{eD33Tf03r2 z;EJGNK_5-9dMAV(zjT2U2Km@9b8yEMRBmm%aL3kgcg7YI1ZbB-30IX;yu4la+i&Tx zx8M0yQX-NiMstC2eTd6}=B$R79XB73@@EZJYWoGa*iooN?sd-va;F#rGn diff --git a/package.json b/package.json index 95e7f6d3..446aac0e 100644 --- a/package.json +++ b/package.json @@ -41,14 +41,13 @@ "eslint": "^1.10.3", "expect.js": "0.3.1", "in-publish": "^2.0.0", - "jshint": "^2.8.0", "mocha": "^2.3.4", "mocha-lcov-reporter": "^1.0.0", "perfectionist": "^2.1.2", "postcss": "^5.0.14", "postcss-minify-params": "^1.0.4", "postcss-minify-selectors": "^2.0.2", - "rollup": "^0.24.0", + "rollup": "^0.25.2", "surgicate": "0.0.3", "uglify-js": "^2.6.0" } diff --git a/src/helpers.js b/src/helpers.js index 916c5517..66b5b91c 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,12 +1,13 @@ var - emptyObject = {}, emptyArray = [], + emptyObject = {}, + emptyString = '', type = emptyObject.toString, - own = emptyObject.hasOwnProperty, - OBJECT = type.call(emptyObject), ARRAY = type.call(emptyArray), - STRING = type.call(''), - FUNCTION = type.call(type) + OBJECT = type.call(emptyObject), + STRING = type.call(emptyString), + FUNCTION = type.call(type), + own = emptyObject.hasOwnProperty /*/-inline-/*/ // function cartesian(a, b, res, i, j) { @@ -39,12 +40,14 @@ function concat(a, b, selectorP) { // "Tokenizes" the selectors into parts relevant for the next function. // Strings and comments are matched, but ignored afterwards. +// This is not a full tokenizers. It only recognizes comas, parentheses, +// strings and comments. +// regexp generated by scripts/regexps.js then trimmed by hand var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g /** * This will split a coma-separated selector list into individual selectors, - * ignoring comas in strings and in :pseudo-selectors(parameter, lists). - * regexp generated by scripts/regexps.js then trimmed by hand + * ignoring comas in strings, comments and in :pseudo-selectors(parameter, lists). * @param {string} selector * @return {string[]} */ @@ -68,5 +71,17 @@ function splitSelector(selector) { return res } /* /-statements-/*/ +function flatIter (f) { + return function iter(arg) { + if (type.call(arg) === ARRAY) for (var i= 0 ; i < arg.length; i ++) iter(arg[i]) + else f(arg) + } +} -export {emptyObject, emptyArray, type, own, OBJECT, ARRAY, STRING, FUNCTION, cartesian, concat, splitSelector} \ No newline at end of file +export { + ARRAY, FUNCTION, OBJECT, STRING, + cartesian, concat, + emptyArray, emptyObject, + flatIter, own, + splitSelector, type +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 0250e0df..70fee68e 100644 --- a/src/main.js +++ b/src/main.js @@ -1,14 +1,7 @@ -import {own, emptyArray, type, ARRAY, FUNCTION} from './helpers' +import {own, flatIter, emptyArray, type, FUNCTION} from './helpers' import {sheet} from './sheet' import {declarations} from './declarations' -function flatIter (f) { - return function iter(arg) { - if (type.call(arg) === ARRAY) for (var i= 0 ; i < arg.length; i ++) iter(arg[i]) - else f(arg) - } -} - export default function j2c() { var filters = [] var postprocessors = [] @@ -28,27 +21,25 @@ export default function j2c() { } } - var registerLocals= flatIter(function(ns) { - for (var k in ns) if (!( k in locals )) locals[k] = ns[k] - }) - - var registerFilter = flatIter(function(filter) { - filters.push(filter) - }) - - var registerPostprocessor = flatIter(function(pp) { - postprocessors.push(pp) - }) + var register = { + $names: flatIter(function(ns) { + for (var k in ns) if (!( k in locals )) locals[k] = ns[k] + }), + $filter: flatIter(function(filter) { + filters.push(filter) + }), + $postprocess: flatIter(function(pp) { + postprocessors.push(pp) + }) + } var _use = flatIter(function(plugin) { if (type.call(plugin) === FUNCTION) plugin = plugin(instance) if (!plugin) return - for (var k in plugin) if (own.call(plugin, k)) switch(k) { - case 'names': registerLocals(plugin[k]); break - case 'postprocess': registerPostprocessor(plugin[k]); break - case 'filter': registerFilter(plugin[k]); break - default: if (!( k in instance )) instance[k] = plugin[k] - } + for (var k in plugin) if (own.call(plugin, k)) if (/^\$/.test(k)){ + if (k in register) register[k](plugin[k]) + } else if (!( k in instance )) instance[k] = plugin[k] + }) function makeBuf(inline) { @@ -110,10 +101,6 @@ export default function j2c() { return postprocess(buf.b) } - // wait for the instance to be fully built before - // registering plugins. - _use(emptyArray.slice.call(arguments)) - return instance } diff --git a/test/test.js b/test/test.js index b084379c..37bd5236 100644 --- a/test/test.js +++ b/test/test.js @@ -337,8 +337,8 @@ function randInt() { test('namespaced animation', function() { check( - j2c( - {names: {foo:'theFoo'}} + j2c().use( + {$names: {foo:'theFoo'}} ).inline( {animation:'foo 1sec'} ), @@ -348,8 +348,8 @@ function randInt() { test('namespaced animation-name', function() { check( - j2c( - {names: {foo:'theFoo'}} + j2c().use( + {$names: {foo:'theFoo'}} ).inline( {animation_name:'foo'} ), @@ -358,7 +358,7 @@ function randInt() { }) test('namespaced and non-namespaced animation-name', function() { - var _j2c = j2c({names: {foo:'theFoo'}}) + var _j2c = j2c().use({$names: {foo:'theFoo'}}) var result = _j2c.inline({animation_name:'foo, bar'}) check( result, @@ -367,8 +367,8 @@ function randInt() { }) test('two namespaced animations', function() { - var result = j2c( - {names: {foo:'theFoo', bar:'theBar'}} + var result = j2c().use( + {$names: {foo:'theFoo', bar:'theBar'}} ).inline( {animation:'foo 1sec, bar 2sec'} ) @@ -385,14 +385,14 @@ function randInt() { ///////////////////////////////////// test('one plugin that does nothing', function() { - check(j2c().use({postprocess: function(){}}).inline( + check(j2c().use({$postprocess: function(){}}).inline( {foo: 'bar'} ), 'foo:bar;') }) test('one plugin that mutates the buffer', function() { check(j2c().use( - {postprocess: function(buf){ + {$postprocess: function(buf){ buf[0] = buf[0].replace('f','k') }} ).inline( @@ -402,7 +402,7 @@ function randInt() { test('one plugin that returns a new buffer', function() { expect(j2c().use( - {postprocess: function(){ + {$postprocess: function(){ return ['hello:world;'] }} ).inline( @@ -412,10 +412,10 @@ function randInt() { test('two plugins that mutate the buffer', function() { check(j2c().use( - {postprocess: function(buf){ + {$postprocess: function(buf){ buf[0]=buf[0].replace('f', 'a') }}, - {postprocess: function(buf){ + {$postprocess: function(buf){ buf[0]=buf[0].replace('a', 'm') }} ).inline( @@ -428,7 +428,7 @@ function randInt() { expect(j2c).to.be.an(Object) expect(j2c.inline).to.be.a(Function) - return {filter: function(buf, inline) { + return {$filter: function(buf, inline) { expect(buf).to.be.an(Object) expect(buf.d).to.be.a(Function) expect(inline).to.be(true) @@ -442,7 +442,7 @@ function randInt() { }} } check( - j2c(filter).inline({foo:'bar'}), + j2c().use(filter).inline({foo:'bar'}), 'pfoo:vbar;' ) }) @@ -1133,7 +1133,7 @@ function randInt() { ///////////////////////////////// test('namespaced class', function() { - var _j2c = j2c({names: {foo: 'FOOO'}}), names = _j2c.names + var _j2c = j2c().use({$names: {foo: 'FOOO'}}), names = _j2c.names var css = _j2c.sheet( {'.foo': {foo: 'bar', baz: 'qux'}} ) @@ -1142,7 +1142,7 @@ function randInt() { }) test('namespaced class wrapping a global block', function() { - var _j2c = j2c({names: {foo: 'FOOO'}}), names = _j2c.names + var _j2c = j2c().use({$names: {foo: 'FOOO'}}), names = _j2c.names var css = _j2c.sheet( {'.foo': {'@global': {'.foo': {foo: 'bar', baz: 'qux'}}}} ) @@ -1151,7 +1151,7 @@ function randInt() { }) test('namespaced @keyframes', function(){ - var _j2c = j2c({names: {bit: 'BOT'}}), names = _j2c.names + var _j2c = j2c().use({$names: {bit: 'BOT'}}), names = _j2c.names var css = _j2c.sheet( {'@keyframes bit': {}} ) @@ -1160,7 +1160,7 @@ function randInt() { }) test('namespaced animation', function(){ - var _j2c = j2c({names: {bit: 'BOT'}}), names = _j2c.names + var _j2c = j2c().use({$names: {bit: 'BOT'}}), names = _j2c.names var css = _j2c.sheet( {p: {animation: 'bit 1sec'}} ) @@ -1169,7 +1169,7 @@ function randInt() { }) test('namespaced animation-name', function() { - var _j2c = j2c({names: {bit: 'BOT'}}), names = _j2c.names + var _j2c = j2c().use({$names: {bit: 'BOT'}}), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit'}}) expect(names.bit).to.be('BOT') check(css, 'p{animation-name:BOT;}') @@ -1322,14 +1322,14 @@ function randInt() { ////////////////////////////// test('one plugin that does nothing', function() { - check(j2c().use({postprocess: function(){}}).sheet( + check(j2c().use({$postprocess: function(){}}).sheet( {p: {foo: 'bar'}} ), 'p{foo:bar;}') }) test('one plugin that mutates the buffer', function() { check(j2c().use( - {postprocess: function(buf){ + {$postprocess: function(buf){ buf[0] = 'li' }} ).sheet( @@ -1339,7 +1339,7 @@ function randInt() { test('one plugin that returns a new buffer', function() { check(j2c().use( - {postprocess: function(){ + {$postprocess: function(){ return ['li{foo:bar;}'] }} ).sheet( @@ -1349,10 +1349,10 @@ function randInt() { test('two plugins that mutate the buffer', function() { check(j2c().use( - {postprocess: function(buf){ + {$postprocess: function(buf){ buf[0]=buf[0].replace('p', 'a') }}, - {postprocess: function(buf){ + {$postprocess: function(buf){ buf[0]=buf[0].replace('a', 'i') }} ).sheet( @@ -1365,7 +1365,7 @@ function randInt() { expect(j2c).to.be.an(Object) expect(j2c.sheet).to.be.a(Function) - return {filter: function(buf, inline) { + return {$filter: function(buf, inline) { expect(buf).to.be.an(Object) expect(buf.a).to.be.a(Function) expect(buf.b).to.be.a(Array) @@ -1398,7 +1398,7 @@ function randInt() { }} } check( - j2c(filter).sheet({'@global': { + j2c().use(filter).sheet({'@global': { '@import': 'foo', p: {foo: 'bar'}, '@keyframes foo': {from:{foo:'baz'}} From 6ac1f439924f4d61ef4f9db34d5e8c6c6be4c495 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 7 Feb 2016 01:28:19 +0100 Subject: [PATCH 018/244] Refactor at rules handling, Add @font-feature-values and friends --- dist/j2c.amd.js | 60 +++++++++++++++--------------------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 60 +++++++++++++++--------------------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 60 +++++++++++++++--------------------- dist/j2c.global.js | 60 +++++++++++++++--------------------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1905 -> 1889 bytes src/at-rules.js | 62 ++++++++++++++++---------------------- 9 files changed, 129 insertions(+), 179 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 1308b0df..7a4149db 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -165,7 +165,7 @@ define(function () { 'use strict'; */ function at(k, v, buf, prefix, composes, local, state){ - var i, kk, params + var i, params if (/^@global$/.test(k)) { sheet(v, buf, prefix, 1, 0, state) @@ -196,51 +196,41 @@ define(function () { 'use strict'; k[1] ) } + } else if (/^@(?:-[\w]+-)?(?:namespace|import|charset)$/.test(k)) { - if(type.call(v) == ARRAY){ - for (kk = 0; kk < v.length; kk++) { - buf.a(k, ' ', v[kk], ';\n') - } - } else { + flatIter(function(v) { buf.a(k, ' ', v, ';\n') - } - } else if (/^@(?:-[\w]+-)?keyframes /.test(k)) { - k = local ? k.replace( + })(v) + + } else if (/^@(?:-[\w]+-)?(?:font-face|viewport|swash|ornaments|annotation|stylistic|styleset|character-variant)$/.test(k)) { + flatIter(function(v) { + buf.a(k, '', '', ' {\n') + declarations(v, buf, '', local, state) + buf.c('}\n') + })(v) + + } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/.test(k)) { + + params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/)[1] + + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)/)[0] + + if (local && /^@(?:-[\w]+-)?keyframes/.test(k)) params = params.replace( // generated by script/regexps.js - /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + /()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, state.l - ) : k - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + ) buf.a(k, ' ', params, ' {\n') - sheet(v, buf, '', 1, local, state) - buf.c('}\n') - - } else if (/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/.test(k)) { - params = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/)[1] || '' - k = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page)/)[0] - if (type.call(v) === ARRAY) { - for (kk = 0; kk < v.length; kk++) { - buf.a(k, params && ' ', params, ' {\n') - declarations(v[kk], buf, '', local, state) - buf.c('}\n') - } - } else { - buf.a(k, params && ' ', params, ' {\n') + if (/@(?:-[\w]+-)?page/.test(k)) { declarations(v, buf, '', local, state) - buf.c('}\n') + } else { + sheet(v, buf, prefix, 1, local, state) } - - } else if (/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/.test(k)) { - params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/)[1] - k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)/)[0] - buf.a(k, ' ', params, ' {\n') - sheet(v, buf, prefix, 1, local, state) buf.c('}\n') } else { - buf.a('@-error-unsupported-at-rule ', JSON.stringify(k), ';\n') + buf.a('@-error-unsupported-at-rule', ' ', JSON.stringify(k), ';\n') } } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 5fb5283c..4d06c91a 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,l,s){a=[];for(s in t)if(b.call(t,s))for(l in e)b.call(e,l)&&a.push(n(e[l],t[s],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],l=0;n=d.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return a.unshift(e),a}function r(e){return function n(t){if(p.call(t)===g)for(var r=0;rG>O7fVIbIvsPd@s^Lu-Yijep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pu70a5#KyoK3bOqesXfoff25}={QdbZIf|b1X-6q2DM?g zHoq$fl3@Kj4sh}i3B@=PCLRgRe=Cjh_&z1!o3Pm%!!Whu27paG`j;=C{~p+jPwa~P zTZ=*)XCs$Gl|^jNS&%iJZR+SF)T|50Ri@7NOlfY&C?tmJ>JW4Vpn^lH2h%yEfDe zh^|)&9W>wL^K4b8O+Fz`?_H{bC-c3__pHKmE`?d-Fko6g75rqep4LaURhZu1_x7fjCLH*- zV70D}R(V}-WmX-yFrRuLHw+euEQEPCg0k?K#>PO>O_(;WL}vQSDn> z29-$o8kclJm$a3Yp=q|d(LpwPK#-~M^Y!U@(H_^BB)G0JNieE2J6hR7b0Rbw^#dUe zr2h-CkV*?^zV^JZ1!#3;>ewHLutT?-E^x(mgM~LrG#ea9G%Jn{qDEawhJk84Lyg`H zmI^lj1nhV$zxgTv&}!#GUXzRKzE>(bZ$dkSgobMTZSj|d=CbM!^x}tvsMB$Hef( zWu*Uy55)G@|KGbPrsZ%nJ-2{We$m{BO??>LitxT%(2bp^4NmH+k?Lp9W}I;UG!kCN zCdD9OQnW~Pnir*m`f96aW=ZZi(BPP(k{Q>}PhbPvg;vq^;?SpXdtse0bfa7&w{gXj zXS(%sj-9Mg%adU$Uptn3Hp`*0@6-+*2^r;Qy(w1HU3AU{_^hyV6JXZjl`~uPtp$Rd zY4hWC^D*ahJk2|LQMyju^O4XEHt(7Kd=mdquwR*PbQ&#V zpU|}SPUTZmouj;~lVx%nCp!6(-ma6|WQhvAjZg+#q&$aH?LKwg rm|ZJ=kWajJ8Buqo#Oub+`jxRWi+LJt@o}*U1?m3=&DcIG$r1nndTYgf diff --git a/src/at-rules.js b/src/at-rules.js index fac9311c..a9615222 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -1,4 +1,4 @@ -import {type, ARRAY, splitSelector} from './helpers' +import {type, ARRAY, splitSelector, flatIter} from './helpers' import {sheet} from './sheet' import {declarations} from './declarations' @@ -20,7 +20,7 @@ import {declarations} from './declarations' */ export function at(k, v, buf, prefix, composes, local, state){ - var i, kk, params + var i, params if (/^@global$/.test(k)) { sheet(v, buf, prefix, 1, 0, state) @@ -51,50 +51,40 @@ export function at(k, v, buf, prefix, composes, local, state){ k[1] ) } + } else if (/^@(?:-[\w]+-)?(?:namespace|import|charset)$/.test(k)) { - if(type.call(v) == ARRAY){ - for (kk = 0; kk < v.length; kk++) { - buf.a(k, ' ', v[kk], ';\n') - } - } else { + flatIter(function(v) { buf.a(k, ' ', v, ';\n') - } - } else if (/^@(?:-[\w]+-)?keyframes /.test(k)) { - k = local ? k.replace( + })(v) + + } else if (/^@(?:-[\w]+-)?(?:font-face|viewport|swash|ornaments|annotation|stylistic|styleset|character-variant)$/.test(k)) { + flatIter(function(v) { + buf.a(k, '', '', ' {\n') + declarations(v, buf, '', local, state) + buf.c('}\n') + })(v) + + } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/.test(k)) { + + params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/)[1] + + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)/)[0] + + if (local && /^@(?:-[\w]+-)?keyframes/.test(k)) params = params.replace( // generated by script/regexps.js - /( )(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + /()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, state.l - ) : k - params = k.slice(k.indexOf(' ')+1) - k = k.slice(0, k.indexOf(' ')) + ) buf.a(k, ' ', params, ' {\n') - sheet(v, buf, '', 1, local, state) - buf.c('}\n') - - } else if (/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/.test(k)) { - params = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page\b\s*(.+))/)[1] || '' - k = k.match(/^@(?:-[\w]+-)?(?:font-face$|viewport$|page)/)[0] - if (type.call(v) === ARRAY) { - for (kk = 0; kk < v.length; kk++) { - buf.a(k, params && ' ', params, ' {\n') - declarations(v[kk], buf, '', local, state) - buf.c('}\n') - } - } else { - buf.a(k, params && ' ', params, ' {\n') + if (/@(?:-[\w]+-)?page/.test(k)) { declarations(v, buf, '', local, state) - buf.c('}\n') + } else { + sheet(v, buf, prefix, 1, local, state) } - - } else if (/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/.test(k)) { - params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)\b\s*(.+)/)[1] - k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document)/)[0] - buf.a(k, ' ', params, ' {\n') - sheet(v, buf, prefix, 1, local, state) buf.c('}\n') } else { - buf.a('@-error-unsupported-at-rule ', JSON.stringify(k), ';\n') + buf.a('@-error-unsupported-at-rule', ' ', JSON.stringify(k), ';\n') } } From 130eead4874f475bba0a8c25766e406f623e06dd Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 7 Feb 2016 01:37:32 +0100 Subject: [PATCH 019/244] Simplified localization Regexp following the previous at-rule refactoring --- dist/j2c.amd.js | 20 ++++++++++---------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 20 ++++++++++---------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 20 ++++++++++---------- dist/j2c.global.js | 20 ++++++++++---------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1889 -> 1881 bytes src/at-rules.js | 6 +++--- src/declarations.js | 2 +- src/main.js | 6 +++--- src/sheet.js | 4 ++-- 12 files changed, 52 insertions(+), 52 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 7a4149db..42d9ab40 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -133,7 +133,7 @@ define(function () { 'use strict'; if (local && (k == 'animation-name' || k == 'animation')) { o = o.split(',').map(function (o) { - return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, state.l) + return o.replace(/:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l) }).join(',') } // '@' in properties also triggers the *ielte7 hack @@ -191,8 +191,8 @@ define(function () { 'use strict'; } state.c( type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l) - }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l), + return parent.replace(/:?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+)/, state.l) + }).join(' ') : v.replace(/:?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+)/, state.l), k[1] ) } @@ -212,12 +212,12 @@ define(function () { 'use strict'; } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/.test(k)) { params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/)[1] - + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)/)[0] if (local && /^@(?:-[\w]+-)?keyframes/.test(k)) params = params.replace( // generated by script/regexps.js - /()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + /:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l ) @@ -281,12 +281,12 @@ define(function () { 'use strict'; (/,/.test(prefix) || prefix && /,/.test(k)) ? cartesian(splitSelector(prefix), splitSelector( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l + /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l ) : k ), prefix).join(',') : concat(prefix, ( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l + /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l ) : k ), prefix), composes || prefix ? '' : k, @@ -374,10 +374,10 @@ define(function () { 'use strict'; parent + ' ' + nameList.slice(nameList.lastIndexOf(' ') + 1) }, - l: function localize(match, space, global, dot, name) { - if (global) return space + global + l: function localize(match, global, dot, name) { + if (global) return global if (!locals[name]) locals[name] = name + instance.scopeRoot - return space + dot + locals[name].match(/\S+$/) + return dot + locals[name].match(/\S+$/) } } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 4d06c91a..69a5adf4 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,r,a,s,o){a=[];for(o in n)if(b.call(n,o))for(s in e)b.call(e,s)&&a.push(t(e[s],n[o],r));return a}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){for(var t,n,r=[],a=[],s=0;t=d.exec(e);)switch(t[0]){case"(":s++;break;case")":s--;break;case",":if(s)break;r.push(t.index)}for(n=r.length;n--;)a.unshift(e.slice(r[n]+1)),e=e.slice(0,r[n]);return a.unshift(e),a}function r(e){return function t(n){if(p.call(n)===g)for(var r=0;rdo=F!eB1dqFe%eLb6wS9vnt+xm zTe~!6kkn`gmj8PXsi)o9w%cNXBAJPFb$NLo=f3j7)a=LiS(H~YGes$Va`r0CXWFPD zGv2zV&$!R2q>3`CX-Up3iqmyoD!-f+awbWU``aL6LiiG&iT$GO7fw1dr<%;?EI3vA z;2WREI;Ao$Q>qAAD{d+!XY4Xu2M%heBT0{xT=2|*;4MtktmYG56DWQXEaN`Nd&&uE8on^&tRY_ z)zRbHM7x0h%rkJUiLMKi!IbzhCFhK3?)hG*7mM{)arV>NQ3xo@<&;9b5U$dsC8^FG zK_PeiXL7Mu%SZ)+%e^_QCC(BSR8k*`93Ba@D4@KGWx9AGgz~5-JyJ^?9XXyMbmCQI z?dy0Zu7;bT)TxUfiK1vvdM_y0tv<HP*F~wb%{uIbiHd*8eL~u>&Gw-cFJPzm#Ctmh?1aErq`jJC62{pvgeLR3T);?| z2BHP~ma7#$O)*!xz%w8TIHEZ@TijOkx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?`%appDyHzVT-$=%{s+s04u z7MCfm!G{6%7WW%yI63(a=hJiX)=sc}i01Q0TKU$O(IgVR#U-53CGBM87(13g7wgk49HwYU!)rXG;RF#oS_2Z%iO_s{Brfp`#PmYyjx`j+W8N4dp2pzKHQM~#pM4;8qRjMWzH@~h_ zeBMNMjE@Y}_}StokIZG&kGKq2W8;X+fHf7%gk>;}4>PrTV>xN(^~aU`#Dd60ARVMPjeZ!W9f%?zP z?88D-Q2gEdkKcX#@cZ{4KRh_9Vscv@FxO({{^}~y|J?^-C)EG%QxyAVG}%A9fYpB4 zE;ns|7}E-PUoNzW&-ZPd)YULDY;WyA?*3FL_$o0OMsbtj3ZwT$DO{+pj>>i$#pa3yWmH13U#i*PA>S zDz22Y{|gw`^R)?Ngdnrb#hPU?3-WLPFb4QQ1(x1lxan8)WH@l?3k2MI&dvCr2xu7O z+Z|6Kj(1O_8&sa?j(}ur&BMAJE3_yjfBU%Zk3W*(>~PZ6V`)pVu%%eX;5f#`fKf!a zOKC~yp?}70x$mFRx=#J`kV-G59ZI@Z;`NJL b^Ty(qCp?Q^@atj=3ex`pt`h&73labTQ!dS~ diff --git a/src/at-rules.js b/src/at-rules.js index a9615222..3ba308df 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -46,8 +46,8 @@ export function at(k, v, buf, prefix, composes, local, state){ } state.c( type.call(v) == ARRAY ? v.map(function (parent) { - return parent.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l) - }).join(' ') : v.replace(/()(?::?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+))/, state.l), + return parent.replace(/:?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+)/, state.l) + }).join(' ') : v.replace(/:?global\(\s*\.?([-\w]+)\s*\)|()\.([-\w]+)/, state.l), k[1] ) } @@ -72,7 +72,7 @@ export function at(k, v, buf, prefix, composes, local, state){ if (local && /^@(?:-[\w]+-)?keyframes/.test(k)) params = params.replace( // generated by script/regexps.js - /()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, + /:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l ) diff --git a/src/declarations.js b/src/declarations.js index 0c5e6b0f..024e2a3a 100644 --- a/src/declarations.js +++ b/src/declarations.js @@ -55,7 +55,7 @@ export function declarations(o, buf, prefix, local, state, /*var*/ k, v, kk) { if (local && (k == 'animation-name' || k == 'animation')) { o = o.split(',').map(function (o) { - return o.replace(/()(?::?global\(\s*([-\w]+)\s*\)|()([-\w]+))/, state.l) + return o.replace(/:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l) }).join(',') } // '@' in properties also triggers the *ielte7 hack diff --git a/src/main.js b/src/main.js index 70fee68e..183211d4 100644 --- a/src/main.js +++ b/src/main.js @@ -71,10 +71,10 @@ export default function j2c() { parent + ' ' + nameList.slice(nameList.lastIndexOf(' ') + 1) }, - l: function localize(match, space, global, dot, name) { - if (global) return space + global + l: function localize(match, global, dot, name) { + if (global) return global if (!locals[name]) locals[name] = name + instance.scopeRoot - return space + dot + locals[name].match(/\S+$/) + return dot + locals[name].match(/\S+$/) } } diff --git a/src/sheet.js b/src/sheet.js index 07456219..97dc3cae 100644 --- a/src/sheet.js +++ b/src/sheet.js @@ -51,12 +51,12 @@ export function sheet(statements, buf, prefix, composes, local, state) { (/,/.test(prefix) || prefix && /,/.test(k)) ? cartesian(splitSelector(prefix), splitSelector( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l + /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l ) : k ), prefix).join(',') : concat(prefix, ( local ? k.replace( - /()(?::global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+))/g, state.l + /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l ) : k ), prefix), composes || prefix ? '' : k, From 763a294004c0b3e1f1cd14f248417e9dffae23db Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Mon, 8 Feb 2016 00:20:48 +0100 Subject: [PATCH 020/244] Add @counter-style + basic tests for all at-rules --- dist/j2c.amd.js | 31 ++++--- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 31 ++++--- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 31 ++++--- dist/j2c.global.js | 31 ++++--- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1881 -> 1895 bytes scripts/regexps.js | 128 +++++++++++----------------- src/at-rules.js | 10 +-- src/declarations.js | 5 +- src/main.js | 16 ++-- test/test.js | 171 +++++++++++++++++++++++++++++++++----- 13 files changed, 278 insertions(+), 182 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 42d9ab40..4fedce5f 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -96,7 +96,8 @@ define(function () { 'use strict'; * @param {function} state.l - @local helper. */ - function declarations(o, buf, prefix, local, state, /*var*/ k, v, kk) { + function declarations(o, buf, prefix, local, state) { + var k, v, kk if (o==null) return if (/\$/.test(prefix)) { for (kk in (prefix = prefix.split('$'))) if (own.call(prefix, kk)) { @@ -131,7 +132,7 @@ define(function () { 'use strict'; // `o` is the value. k = prefix.replace(/_/g, '-').replace(/[A-Z]/g, decamelize) - if (local && (k == 'animation-name' || k == 'animation')) { + if (local && (k == 'animation-name' || k == 'animation' || k == 'list-style')) { o = o.split(',').map(function (o) { return o.replace(/:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l) }).join(',') @@ -209,20 +210,20 @@ define(function () { 'use strict'; buf.c('}\n') })(v) - } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/.test(k)) { + } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|counter-style|font-feature-values)\b\s*(.+)/.test(k)) { - params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/)[1] + params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|counter-style|font-feature-values)\b\s*(.+)/)[1] - k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)/)[0] + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|counter-style|font-feature-values)/)[0] - if (local && /^@(?:-[\w]+-)?keyframes/.test(k)) params = params.replace( + if (local && /^@(?:-[\w]+-)?(?:keyframes|counter-style)/.test(k)) params = params.replace( // generated by script/regexps.js /:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l ) buf.a(k, ' ', params, ' {\n') - if (/@(?:-[\w]+-)?page/.test(k)) { + if (/@(?:-[\w]+-)?(?:page|counter-style)/.test(k)) { declarations(v, buf, '', local, state) } else { sheet(v, buf, prefix, 1, local, state) @@ -308,12 +309,10 @@ define(function () { 'use strict'; function j2c() { var filters = [] var postprocessors = [] - var locals = {} - var instance = { flatIter: flatIter, - names: locals, - scopeRoot: '__j2c-' + + names: {}, + suffix: '__j2c-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + @@ -326,7 +325,7 @@ define(function () { 'use strict'; var register = { $names: flatIter(function(ns) { - for (var k in ns) if (!( k in locals )) locals[k] = ns[k] + for (var k in ns) if (!( k in instance.names )) instance.names[k] = ns[k] }), $filter: flatIter(function(filter) { filters.push(filter) @@ -368,16 +367,16 @@ define(function () { 'use strict'; var state = { c: function composes(parent, child) { - var nameList = locals[child] - locals[child] = + var nameList = instance.names[child] + instance.names[child] = nameList.slice(0, nameList.lastIndexOf(' ') + 1) + parent + ' ' + nameList.slice(nameList.lastIndexOf(' ') + 1) }, l: function localize(match, global, dot, name) { if (global) return global - if (!locals[name]) locals[name] = name + instance.scopeRoot - return dot + locals[name].match(/\S+$/) + if (!instance.names[name]) instance.names[name] = name + instance.suffix + return dot + instance.names[name].match(/\S+$/) } } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 69a5adf4..be63ffe0 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,r,a,s,o){a=[];for(o in n)if(b.call(n,o))for(s in e)b.call(e,s)&&a.push(t(e[s],n[o],r));return a}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){for(var t,n,r=[],a=[],s=0;t=d.exec(e);)switch(t[0]){case"(":s++;break;case")":s--;break;case",":if(s)break;r.push(t.index)}for(n=r.length;n--;)a.unshift(e.slice(r[n]+1)),e=e.slice(0,r[n]);return a.unshift(e),a}function r(e){return function t(n){if(p.call(n)===g)for(var r=0;rNo=J-=A`js%_Nm40ra;~*DFIDW zHd~r9NXp8<@_*k$>S}k=ZM)dTBAJOq9iHoVZaGms`}r*+MWvV(r3%qGs0^POs|B;c zsz0CckYj}@*4W?@oi$1GRZ;4&oC!5kNEG2FW>m^h!Dr;Y825#v?wDhP=5rk%E3*%6 z$WxPJm6kcC2(2`?l~yx-8N>kvwpf9n_LG{=!{w(m%If=kalec$H#W4uF-Rh=b*ZBb z-A1O`M21VwEF1(2+ceAhgx1EIA0=fxgyS9N2sI5~*iotqIXXMtPv92o>;*HivlSci zxU%FF^DmqM)e4zfSO%t~k2yLsYIqO^iCHXG8_nr2D}RFEB#NddI7q-%2DL}Db4M)H zmVZGPCt492ORjcyzfy1)>9|s6FADHTY@`6?X{z$Y6GE7i{^$|A!_krB9fT)drOv*N zX5wmaGbnZJ;)e(!2h@9kg5C64^(xWD0>Oopf-o)tC>$FYz2m?%m-B`p`7g!&}2SW3oz8D zf@}dlrUJ(jxmQL!lhGVGF-H>liaD|~hdI#;d1Fw2Jk@E-3tCB=NN~>p^UnZtP!EkK z>0hItayZop-_fQCs1gV2LJ}!@;K3b{kW<59_b!F8k+Cn*6Eux?Vy83)?gx4dhYB)6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HpWjFwP7Q`)ggHjXUtK6Iylqf= zFdc`mt*$P#x{gl03TZeNvYQCsqzuM})(3oN(??Z;znL$5NS2`r3*Qcht^(7lt-&?j z(%t&H1*_|}TcbSHpN5I2MtK5HT&ELR*NxYmvdvSGZR9vJ>-(G0utr#S=w7?%3D%-% zqTM|VfVYU>;)dGEcL<-Ji*|NW?OimVKhn~-wu~x~@GUOkgsx~OE5mqcb)%zfOiQ*X zOF!S#6Cg}+kObFANP-ayds+buVNGZ@>6{_1qW_yf$fE_c-FRNuIc0ri-ZTb>u=i*` zd!rHcWB0VEs1|`%+_b2Sn8~niOgD_lo582TjmH5yoy4oJ0ytOgU0!N(akJ@KMdxj3 zNA%E8jh`KUvd~=C{rJj&FE);^4ER!!j9Cih_%JW4Hx`d}7JppJPi&aSUGrp^w4o|i zhxO3^+E{q4T5?z#%IJKdS#-_?GvA{+hl;v35|&hF<%$2TEKTTr`-Tk+!}6b*IRv>V zaq)NWKYsV|!|&gJ{P5tYipgDh#LS9$`m4)A|92mVoj(7+Pf_fW;bgb$99H>7ySTJ9 zVGJvPeYwy)I^VZ`Qdi@~u$i^Pw)>|bIEIx5>ui#raC1m>j5 zjO*JQ*vNLl=yd&Y+>yB5k!sX)^c3VXrVnzX+pq=Ly%P;58F$u=W69_992)yh?a+~s zQ5ZyeQ>>=@=$wu2v%=0Tz^uhQGucQrB4m;9ymAS|1V5s+s#eEgLhA) z8%Un$o`7U*wnMKBi?JvqfBU%Zk3W*(>~PX$Vqudow@Fw<;5bG3fKK?f3uZy+v42Ky zJoL{fT6O}wCtuTtP4bYePP-dM-7n5WST TeqC%TLHa)cI??(q;Sm4;T)?od diff --git a/scripts/regexps.js b/scripts/regexps.js index fb8e4d27..a681afeb 100644 --- a/scripts/regexps.js +++ b/scripts/regexps.js @@ -7,102 +7,74 @@ global.__proto__ = require('compose-regexp') var maybe = greedy.bind(null, '?') maybe() -var animation = sequence( - capture(), - either( - sequence( - /:?/, - 'global(', - /\s*/, - capture(/[-\w]+/), - /\s*/, - ')' - ), - sequence( - capture(), - capture(/[-\w]+/) - ) +var animation = either( + sequence( + /:?/, + 'global(', + /\s*/, + capture(/[-\w]+/), + /\s*/, + ')' + ), + sequence( + capture(), + capture(/[-\w]+/) ) ) console.log('animation / animation-name\n', animation) -var keyframes = sequence( - capture(' '), - either( - sequence( - /:?/, - 'global(', - /\s*/, - capture(/[-\w]+/), - /\s*/, - ')' - ), - sequence( - capture(), - capture(/[-\w]+/) - ) +var keyframes = either( + sequence( + /:?/, + 'global(', + /\s*/, + capture(/[-\w]+/), + /\s*/, + ')' + ), + sequence( + capture(), + capture(/[-\w]+/) ) ) console.log('@keyframes\n', keyframes) -var selector = flags('g', sequence( - capture(''), - either( - sequence( - ':global(', - /\s*/, - capture( - '.', - /[-\w]+/ - ), - /\s*/, - ')' +var selector = flags('g', either( + sequence( + ':global(', + /\s*/, + capture( + '.', + /[-\w]+/ ), - sequence( - capture('.'), - capture(/[-\w]+/) - ) + /\s*/, + ')' + ), + sequence( + capture('.'), + capture(/[-\w]+/) ) )) console.log('selector / @global\n', selector) -var composes = sequence( - capture(''), - either( - sequence( - /:?/, - 'global(', - /\s*\.?/, - capture(/[-\w]+/), - /\s*/, - ')' - ), - sequence( - capture(''), - /\.?/, - capture(/[-\w]+/) - ) +var composes = either( + sequence( + /:?/, + 'global(', + /\s*\.?/, + capture(/[-\w]+/), + /\s*/, + ')' + ), + sequence( + capture(''), + /\.?/, + capture(/[-\w]+/) ) ) -// /() -// (?: -// :? -// global\( -// \s* -// \.? -// ([-\w]+) -// \s* -// \) -// | -// () -// \. -// ([-\w]+) -// ) -// / - console.log('@composes\n', composes) var selectorTokenizer = flags('g', diff --git a/src/at-rules.js b/src/at-rules.js index 3ba308df..d20e813c 100644 --- a/src/at-rules.js +++ b/src/at-rules.js @@ -64,20 +64,20 @@ export function at(k, v, buf, prefix, composes, local, state){ buf.c('}\n') })(v) - } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/.test(k)) { + } else if (/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|counter-style|font-feature-values)\b\s*(.+)/.test(k)) { - params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)\b\s*(.+)/)[1] + params = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|counter-style|font-feature-values)\b\s*(.+)/)[1] - k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|font-feature-values)/)[0] + k = k.match(/^@(?:-[\w]+-)?(?:media|supports|document|page|keyframes|counter-style|font-feature-values)/)[0] - if (local && /^@(?:-[\w]+-)?keyframes/.test(k)) params = params.replace( + if (local && /^@(?:-[\w]+-)?(?:keyframes|counter-style)/.test(k)) params = params.replace( // generated by script/regexps.js /:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l ) buf.a(k, ' ', params, ' {\n') - if (/@(?:-[\w]+-)?page/.test(k)) { + if (/@(?:-[\w]+-)?(?:page|counter-style)/.test(k)) { declarations(v, buf, '', local, state) } else { sheet(v, buf, prefix, 1, local, state) diff --git a/src/declarations.js b/src/declarations.js index 024e2a3a..03e457aa 100644 --- a/src/declarations.js +++ b/src/declarations.js @@ -18,7 +18,8 @@ function decamelize(match) { * @param {function} state.l - @local helper. */ -export function declarations(o, buf, prefix, local, state, /*var*/ k, v, kk) { +export function declarations(o, buf, prefix, local, state) { + var k, v, kk if (o==null) return if (/\$/.test(prefix)) { for (kk in (prefix = prefix.split('$'))) if (own.call(prefix, kk)) { @@ -53,7 +54,7 @@ export function declarations(o, buf, prefix, local, state, /*var*/ k, v, kk) { // `o` is the value. k = prefix.replace(/_/g, '-').replace(/[A-Z]/g, decamelize) - if (local && (k == 'animation-name' || k == 'animation')) { + if (local && (k == 'animation-name' || k == 'animation' || k == 'list-style')) { o = o.split(',').map(function (o) { return o.replace(/:?global\(\s*([-\w]+)\s*\)|()([-\w]+)/, state.l) }).join(',') diff --git a/src/main.js b/src/main.js index 183211d4..845b6915 100644 --- a/src/main.js +++ b/src/main.js @@ -5,12 +5,10 @@ import {declarations} from './declarations' export default function j2c() { var filters = [] var postprocessors = [] - var locals = {} - var instance = { flatIter: flatIter, - names: locals, - scopeRoot: '__j2c-' + + names: {}, + suffix: '__j2c-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + @@ -23,7 +21,7 @@ export default function j2c() { var register = { $names: flatIter(function(ns) { - for (var k in ns) if (!( k in locals )) locals[k] = ns[k] + for (var k in ns) if (!( k in instance.names )) instance.names[k] = ns[k] }), $filter: flatIter(function(filter) { filters.push(filter) @@ -65,16 +63,16 @@ export default function j2c() { var state = { c: function composes(parent, child) { - var nameList = locals[child] - locals[child] = + var nameList = instance.names[child] + instance.names[child] = nameList.slice(0, nameList.lastIndexOf(' ') + 1) + parent + ' ' + nameList.slice(nameList.lastIndexOf(' ') + 1) }, l: function localize(match, global, dot, name) { if (global) return global - if (!locals[name]) locals[name] = name + instance.scopeRoot - return dot + locals[name].match(/\S+$/) + if (!instance.names[name]) instance.names[name] = name + instance.suffix + return dot + instance.names[name].match(/\S+$/) } } diff --git a/test/test.js b/test/test.js index 37bd5236..6b41cd6d 100644 --- a/test/test.js +++ b/test/test.js @@ -800,17 +800,37 @@ function randInt() { //////////////////////////////// - test('standard at-rule with text value', function() { + test('@charset', function() { check( j2c().sheet({ - '@import': "'bar'" + '@charset': '"UTF-8"' }), - "@import 'bar';" + '@charset "UTF-8";' ) }) - test('standard at-rule with object value', function() { + test('@import', function() { + check( + j2c().sheet({ + '@import': 'url("bluish.css") projection, tv' + }), + + '@import url("bluish.css") projection, tv;' + ) + }) + + test('@namespace', function() { + check( + j2c().sheet({ + '@namespace': 'prefix url(XML-namespace-URL)' + }), + + '@namespace prefix url(XML-namespace-URL);' + ) + }) + + test('@media', function() { check( j2c().sheet({p: { '@media foo': {bar: 'baz'} @@ -820,7 +840,116 @@ function randInt() { ) }) - test('several at-rules with object value', function() { + test('@supports', function() { + check( + j2c().sheet({ + '@supports not (text-align-last:justify)': { + 'p': { + textAlignLast: 'justify' + } + } + }), + + '@supports not (text-align-last:justify) {p {text-align-last:justify}}' + ) + }) + + test('@document', function() { + check( + j2c().sheet({ + '@document url(http://www.w3.org/)': { + ' body': { + color: 'purple' + } + } + }), + + '@document url(http://www.w3.org/) {body {color: purple;}}' + ) + }) + + test('@page', function() { + check( + j2c().sheet({ + '@page :first': { + margin: '2in 3in' + } + }), + + '@page :first {margin: 2in 3in;}' + ) + }) + + test('@viewport', function() { + check( + j2c().sheet({ + '@viewport': { + orientation: 'landscape' + } + }), + + '@viewport {orientation: landscape;}' + ) + }) + + test('global @counter-style', function() { + check( + j2c().sheet({ + '@global': { + '@counter-style circled': { + system: 'fixed' + } + } + }), + + '@counter-style circled {system: fixed;}' + ) + }) + + test('local @counter-style', function() { + var _j2c = j2c() + check( + _j2c.sheet({ + '@counter-style circled': { + system: 'fixed' + } + }), + + '@counter-style ' + _j2c.names.circled + ' {system: fixed;}' + ) + }) + + test('@font-feature-values', function() { + check( + j2c().sheet({ + '@font-feature-values Font One': { + '@styleset': { + ident0: 2 + }, + '@swash': { + ident1: 2 + }, + '@ornaments': { + ident2: 2 + }, + '@annotation': { + ident3: 2 + }, + '@stylistic': { + ident4: 2 + }, + '@character-variant': { + ident5: 2 + } + } + }), + + '@font-feature-values Font One {@styleset{ident0: 2;}@swash{ident1: 2;}@ornaments{ident2: 2;}@annotation{ident3: 2;}@stylistic{ident4: 2;}@character-variant{ident5: 2;}}' + ) + }) + + + test('several @media with object value', function() { check( j2c().sheet({p: { '@media foo': {bar: 'baz'}, @@ -832,7 +961,7 @@ function randInt() { ) }) - test('Array of at-rules with text values', function() { + test('Array of @import with text values', function() { check( j2c().sheet([ {'@import': "'bar'"}, @@ -842,7 +971,7 @@ function randInt() { ) }) - test('nested at-rules', function() { + test('nested @media', function() { check( j2c().sheet({p: {'@media screen': {width:1000, '@media (max-width: 12cm)': {size:5}}}}), [ @@ -933,15 +1062,15 @@ function randInt() { test('a local class', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') }) test('two local classes', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5}, '.bat': {bar:6}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) - expect(names.bat).to.be('bat' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) + expect(names.bat).to.be('bat' + _j2c.suffix) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') expect(css).to.contain('.' + names.bat + ' {\nbar:6;\n}') }) @@ -949,7 +1078,7 @@ function randInt() { test('a local and a global class', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5}, ':global(.bat)': {bar:6}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(names.bat).to.be(undefined) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') expect(css).to.contain('.bat {\nbar:6;\n}') @@ -958,7 +1087,7 @@ function randInt() { test('a local wrapping a global block', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {'@global': {'.bat': {foo:5}}}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(names.bat).to.be(undefined) expect(css).to.contain('.' + names.bit + '.bat {\nfoo:5;\n}') }) @@ -966,8 +1095,8 @@ function randInt() { test('two local classes, nested', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {foo:5, '.bat': {bar:6}}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) - expect(names.bat).to.be('bat' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) + expect(names.bat).to.be('bat' + _j2c.suffix) expect(css).to.contain('.' + names.bit + ' {\nfoo:5;\n}') expect(css).to.contain('.' + names.bit +'.' + names.bat + ' {\nbar:6;\n}') }) @@ -975,7 +1104,7 @@ function randInt() { test('@keyframes', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'@keyframes bit': {}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(css).to.contain('@keyframes ' + names.bit +' {') }) @@ -996,7 +1125,7 @@ function randInt() { test('one animation', function(){ var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation: 'bit 1sec'}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(css).to.contain('animation:' + names.bit +' ') }) @@ -1017,22 +1146,22 @@ function randInt() { test('one animation-name', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit'}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(css).to.contain('animation-name:' + names.bit +';') }) test('two animation-name', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit, bat'}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) - expect(names.bat).to.be('bat' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) + expect(names.bat).to.be('bat' + _j2c.suffix) expect(css).to.contain('animation-name:' + names.bit +', ' + names.bat) }) test('two animation-name, one global', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({p: {animation_name: 'bit, global(bat)'}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(names.bat).to.be(undefined) expect(css).to.contain('animation-name:' + names.bit +', bat;') }) @@ -1040,7 +1169,7 @@ function randInt() { test('a nested @global at-rule', function() { var _j2c = j2c(), names = _j2c.names var css = _j2c.sheet({'.bit': {'@global': {'.bat': {'foo':6}}}}) - expect(names.bit).to.be('bit' + _j2c.scopeRoot) + expect(names.bit).to.be('bit' + _j2c.suffix) expect(names.bat).to.be(undefined) expect(css).to.contain( names.bit +'.bat {') }) From a89a221f764ce79caf9b60463d86a2e9ec5930e8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Mon, 8 Feb 2016 15:21:25 +0100 Subject: [PATCH 021/244] Added kv(), at() and global() --- dist/j2c.amd.js | 32 ++++++++++++++++++++++++++++---- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 32 ++++++++++++++++++++++++++++---- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 32 ++++++++++++++++++++++++++++---- dist/j2c.global.js | 32 ++++++++++++++++++++++++++++---- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1895 -> 1982 bytes src/main.js | 28 ++++++++++++++++++++++++++-- test/test.js | 2 -- 10 files changed, 141 insertions(+), 23 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 4fedce5f..fb0f5537 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -165,7 +165,7 @@ define(function () { 'use strict'; * @param {function} state.l - @local helper */ - function at(k, v, buf, prefix, composes, local, state){ + function at$1(k, v, buf, prefix, composes, local, state){ var i, params if (/^@global$/.test(k)) { sheet(v, buf, prefix, 1, 0, state) @@ -271,7 +271,7 @@ define(function () { 'use strict'; // Handle At-rules inDeclaration = (inDeclaration && buf.c('}\n') && 0) - at(k, v, buf, prefix, composes, local, state) + at$1(k, v, buf, prefix, composes, local, state) } else { // selector or nested sub-selectors @@ -306,11 +306,35 @@ define(function () { 'use strict'; } } + function global(x) { + return ':global(' + x + ')' + } + + + function kv (k, v, o) { + o = {} + o[k] = v + return o + } + + function at (rule, params, block) { + if ( + arguments.length < 3 + ) { + var _at = at.bind.apply(at, [null].concat([].slice.call(arguments,0))) + _at.toString = function(){return '@' + rule + ' ' + params} + return _at + } + else return kv('@' + rule + ' ' + params, block) + } + function j2c() { var filters = [] var postprocessors = [] var instance = { - flatIter: flatIter, + at: at, + global: global, + kv: kv, names: {}, suffix: '__j2c-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + @@ -407,7 +431,7 @@ define(function () { 'use strict'; } var _j2c = j2c() - 'sheet|sheets|inline|remove|names|flatIter'.split('|').map(function(m){j2c[m] = _j2c[m]}) + 'sheet|inline|names|at|global|kv'.split('|').map(function(m){j2c[m] = _j2c[m]}) return j2c; diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index be63ffe0..7a397454 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n,a,r,s,o){r=[];for(o in n)if(b.call(n,o))for(s in e)b.call(e,s)&&r.push(t(e[s],n[o],a));return r}function t(e,t,n){return n&&(/^[-\w$]+$/.test(t)&&":-error-bad-sub-selector-"+t||/&/.test(t)&&t.replace(/&/g,e))||e+t}function n(e){for(var t,n,a=[],r=[],s=0;t=d.exec(e);)switch(t[0]){case"(":s++;break;case")":s--;break;case",":if(s)break;a.push(t.index)}for(n=a.length;n--;)r.unshift(e.slice(a[n]+1)),e=e.slice(0,a[n]);return r.unshift(e),r}function a(e){return function t(n){if(p.call(n)===m)for(var a=0;aL^bI}}`$gL?oOH*WYBHa*psMxW z7e0@5N=;m*R1vaP+|)|U*m)2K3M!}}r|y%P&;8Zsc$plp)5Y~FFkBm7fTI^Kxl&Rs zAJ}%O>xZT0CC>~FyoG3*)qFxL0>!J6W!%T{j&eephA+e@)%cv8tnN>6i?H^>OlobV zI=Wqp=sDnDc?POA(Z|AMFeScC$th!+d%hRy#bW)SID1^X6M~cFa(Y6&5U$dsJyM-J zfAj#}x4JjIN@}qnxDYD{<0XK?ap62lV50;N5#WK5f0akB z{tV-NGScZbz5o=!WaUVj(P9lXL|v9w5x0n1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--- dist/j2c.amd.js | 103 ++++++++++++++++++++++---------------- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 103 ++++++++++++++++++++++---------------- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 103 ++++++++++++++++++++++---------------- dist/j2c.global.js | 103 ++++++++++++++++++++++---------------- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 1982 -> 2050 bytes src/helpers.js | 70 ++++++++++++++------------ src/sheet.js | 36 +++++++++---- test/test.js | 36 ++++++++++--- 11 files changed, 339 insertions(+), 221 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index fb0f5537..30f0e3ce 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -9,41 +9,21 @@ define(function () { 'use strict'; var STRING = type.call(emptyString); var FUNCTION = type.call(type); var own = emptyObject.hasOwnProperty; - /*/-inline-/*/ - // function cartesian(a, b, res, i, j) { - // res = []; - // for (j in b) if (own.call(b, j)) - // for (i in a) if (own.call(a, i)) - // res.push(a[i] + b[j]); - // return res; - // } - /*/-inline-/*/ - - /* /-statements-/*/ - function cartesian(a,b, selectorP, res, i, j) { - res = [] + function cartesian(a,b) { + var res = [], i, j for (j in b) if(own.call(b, j)) for (i in a) if(own.call(a, i)) - res.push(concat(a[i], b[j], selectorP)) + res.push(a[i] + b[j]) return res } - function concat(a, b, selectorP) { - // `b.replace(/&/g, a)` is never falsy, since the - // 'a' of cartesian can't be the empty string - // in selector mode. - return selectorP && ( - /^[-\w$]+$/.test(b) && ':-error-bad-sub-selector-' + b || - /&/.test(b) && /* never falsy */ b.replace(/&/g, a) - ) || a + b - } - // "Tokenizes" the selectors into parts relevant for the next function. // Strings and comments are matched, but ignored afterwards. // This is not a full tokenizers. It only recognizes comas, parentheses, // strings and comments. // regexp generated by scripts/regexps.js then trimmed by hand - var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g + var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g + /** * This will split a coma-separated selector list into individual selectors, @@ -53,24 +33,47 @@ define(function () { 'use strict'; */ function splitSelector(selector) { - var indices = [], res = [], inParen = 0, match, i + var indices = [], res = [], inParen = 0, o /*eslint-disable no-cond-assign*/ - while(match = selectorTokenizer.exec(selector)) { + while(o = selectorTokenizer.exec(selector)) { /*eslint-enable no-cond-assign*/ - switch(match[0]){ + switch(o[0]){ case '(': inParen++; break case ')': inParen--; break - case ',': if (inParen) break; indices.push(match.index) + case ',': if (inParen) break; indices.push(o.index) } } - for (i = indices.length; i--;){ - res.unshift(selector.slice(indices[i] + 1)) - selector = selector.slice(0, indices[i]) + for (o = indices.length; o--;){ + res.unshift(selector.slice(indices[o] + 1)) + selector = selector.slice(0, indices[o]) } res.unshift(selector) return res } - /* /-statements-/*/ + + // This is like the `selectorTokenizer`, but for the `&` operator + + var ampersandTokenizer = /&|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g + + function ampersand (selector, parents) { + var indices = [], split = [], res, o + /*eslint-disable no-cond-assign*/ + while(o = ampersandTokenizer.exec(selector)) { + /*eslint-enable no-cond-assign*/ + if (o[0] == '&') indices.push(o.index) + } + for (o = indices.length; o--;){ + split.unshift(selector.slice(indices[o] + 1)) + selector = selector.slice(0, indices[o]) + } + split.unshift(selector) + res = [split[0]] + for (o = 1; o < split.length; o++) { + res = cartesian(res, cartesian(parents, [split[o]])) + } + return res.join(',') + } + function flatIter (f) { return function iter(arg) { if (type.call(arg) === ARRAY) for (var i= 0 ; i < arg.length; i ++) iter(arg[i]) @@ -249,7 +252,7 @@ define(function () { 'use strict'; * @param {function} state.l - @local helper */ function sheet(statements, buf, prefix, composes, local, state) { - var k, v, inDeclaration + var k, v, inDeclaration, kk switch (type.call(statements)) { @@ -264,7 +267,7 @@ define(function () { 'use strict'; if (prefix && /^[-\w$]+$/.test(k)) { if (!inDeclaration) { inDeclaration = 1 - buf.s(( prefix || '*' ), ' {\n') + buf.s(( prefix || ':-error-no-selector' ), ' {\n') } declarations(v, buf, k, local, state) } else if (/^@/.test(k)) { @@ -278,18 +281,34 @@ define(function () { 'use strict'; inDeclaration = (inDeclaration && buf.c('}\n') && 0) + sheet(v, buf, (/,/.test(prefix) || prefix && /,/.test(k)) ? - cartesian(splitSelector(prefix), splitSelector( local ? - k.replace( - /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l - ) : k - ), prefix).join(',') : - concat(prefix, ( local ? + /*0*/ (kk = splitSelector(prefix), splitSelector( local ? k.replace( /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l ) : k - ), prefix), + ).map(function (k) { + return /&/.test(k) ? ampersand(k, kk) : kk.map(function(kk) { + return kk + k + }).join(',') + }).join(',')) : + /*0*/ /&/.test(k) ? + /*1*/ ampersand( + local ? + k.replace( + /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l + ) : + k, + [prefix] + ) : + /*1*/ prefix + ( + local ? + k.replace( + /:global\(\s*(\.[-\w]+)\s*\)|(\.)([-\w]+)/g, state.l + ) : + k + ), composes || prefix ? '' : k, local, state ) diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 7a397454..ccf12082 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,t,r,a,s,l){a=[];for(l in t)if($.call(t,l))for(s in e)$.call(e,s)&&a.push(n(e[s],t[l],r));return a}function n(e,n,t){return t&&(/^[-\w$]+$/.test(n)&&":-error-bad-sub-selector-"+n||/&/.test(n)&&n.replace(/&/g,e))||e+n}function t(e){for(var n,t,r=[],a=[],s=0;n=y.exec(e);)switch(n[0]){case"(":s++;break;case")":s--;break;case",":if(s)break;r.push(n.index)}for(t=r.length;t--;)a.unshift(e.slice(r[t]+1)),e=e.slice(0,r[t]);return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subject: [PATCH 023/244] Remove the now redundant 'postprocess' plugins --- dist/j2c.amd.js | 15 ++------ dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 15 ++------ dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 15 ++------ dist/j2c.global.js | 15 ++------ dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 2050 -> 2006 bytes src/main.js | 15 ++------ test/test.js | 78 -------------------------------------- 10 files changed, 18 insertions(+), 141 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index 30f0e3ce..4202904f 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -349,7 +349,6 @@ define(function () { 'use strict'; function j2c() { var filters = [] - var postprocessors = [] var instance = { at: at, global: global, @@ -372,9 +371,6 @@ define(function () { 'use strict'; }), $filter: flatIter(function(filter) { filters.push(filter) - }), - $postprocess: flatIter(function(pp) { - postprocessors.push(pp) }) } @@ -403,11 +399,6 @@ define(function () { 'use strict'; return buf } - function postprocess(buf, res, i) { - for (i = 0; i< postprocessors.length; i++) buf = postprocessors[i](buf) || buf - return buf.join('') - } - var state = { c: function composes(parent, child) { var nameList = instance.names[child] @@ -431,8 +422,8 @@ define(function () { 'use strict'; 1, // local, by default state ) - buf = postprocess(buf.b) - return buf + + return buf.b.join('') } /*/-statements-/*/ instance.inline = function (decl, buf) { @@ -443,7 +434,7 @@ define(function () { 'use strict'; 1, //local state ) - return postprocess(buf.b) + return buf.b.join('') } return instance diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index ccf12082..a0114334 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function n(n,e){var t,r,a=[];for(r in e)if(y.call(e,r))for(t in n)y.call(n,t)&&a.push(n[t]+e[r]);return a}function e(n){for(var e,t=[],r=[],a=0;e=$.exec(n);)switch(e[0]){case"(":a++;break;case")":a--;break;case",":if(a)break;t.push(e.index)}for(e=t.length;e--;)r.unshift(n.slice(t[e]+1)),n=n.slice(0,t[e]);return r.unshift(n),r}function t(e,t){for(var r,a,s=[],l=[];a=k.exec(e);)"&"==a[0]&&s.push(a.index);for(a=s.length;a--;)l.unshift(e.slice(s[a]+1)),e=e.slice(0,s[a]);for(l.unshift(e),r=[l[0]],a=1;azJT)uCjFTewUV@C3rN^lv1fLjuB1pF^s3ES)f~wX#Pk+QFo%2|wWU08Rm6);f zV2OKzoKOMU;?#g8s_=tF_e&n#2K*b(KxRqwu`t=rD(mln+!GEF2JA|syI|BhSqkj-ds?oU;1InW3);kW~Ij$2$419B4-GXEtNE>(- z=^i9HNXo$=?-1#jwIF%K2avefDww=LFu*04!XQ5^*<(4Vp3jMjgr}(R3q9Yli0GU;fLx0c}7{wSPKX?gj1l#01T419E z$9Lu;F!Jy6$kksUz1{?gM$S^CYuPea(t>77fFbI#yom(Tc9GmJ0>iZd8x~N8yfr`p zU6qCLoLh(VBsMey5_f9jEVY_jh#eO@|Bx03R@VG;?h(?Gb9M|-y#!z7qv(B=;43JM zWja8ekbiZy4grblnmIUXvnJcB8tY9^N$|Fatdh|kIdMlu@)dVv=T3p9=km&-etC*% z!*f=bCX^5!#jBD5rxsrqTMF>VxDx-_|5pmDjL;j^G!7HRo?%LS!S>v_iKOd}i`{)$ zXya@1Qd)tgu|e!W1HpnltGuC2jT953*>JTj<$s!$iI?a*FZPpTIwx?Mkj5kZ{el9y z$(fAQB^1LmX!-JKL7h7X$|l%Ah~&x%;m4tZI?F^jQzF{71{GW)uV~$pET zas8Qjpd~>Y|DPBp zKpcC3_^;apQ}-#&T=#n$Z>Sl=;<^x*>Nhu8EDcO(PsD0S`QjRab>|K1D{UKLN04xA zi&uQPDnK~dv{B<5EJjtA{MG6cLx1TFJzWA|Je6H`bh@Sc<<%a4xv#hFPE6Y!sDkRA zXuI6m?OW}34$MPIh8e;T-lp@ujB<$47IwpJ^gvahJqG(}*trR9So4x+MyjEtu%;@o znOlpthNhaLt?Q~GY_5AxOAq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QuClu;U7HfpZuWIks}RfA@`rleHBo ze7^w1frTA8x6q-%6-2s^kNFtN@l{Yf`n{Tjz>F_N!is70SATqO0kbe(w&!=G%g0{o zRhbj5&J5ykJl6L$kA{$|Y!ZK!#cE!Kj@<<2*YS(~o|Qg8a|N$XeF}m2j&n1Xl&LAa za^M?~t2@%&UGJdvz!Jx*fH1>SRHfjrZ`b|yTQck&cG`@sF7pvB#4KuB)PVLjP e*U$RxE3 Date: Mon, 8 Feb 2016 23:17:24 +0100 Subject: [PATCH 024/244] README update, WIP --- README.md | 79 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 5a94bbb5..6c75d991 100644 --- a/README.md +++ b/README.md @@ -7,44 +7,77 @@ [![bitHound Score][bithound_img]][bithound_url] [![downloads][monthly_img]][monthly_url] +[trav_img]: https://travis-ci.org/j2css/j2c.svg?branch=master +[trav_url]: https://travis-ci.org/j2css/j2c +[cov_img]: https://coveralls.io/repos/j2css/j2c/badge.svg?branch=master +[cov_url]: https://coveralls.io/r/j2css/j2c?branch=master +[npm_img]: https://img.shields.io/npm/v/j2c.svg +[npm_url]: https://npmjs.com/package/j2c +[size_img]: https://badges.herokuapp.com/size/npm/j2c/dist/j2c.global.min.js.gz?label=.min.gz +[deps_img]: https://david-dm.org/j2css/j2c.svg +[deps_url]: https://david-dm.org/j2css/j2c +[bithound_img]: https://www.bithound.io/github/j2css/j2c/badges/score.svg +[bithound_url]: https://www.bithound.io/github/j2css/j2c/ +[gitter_img]: https://badges.gitter.im/Join%20Chat.svg +[gitter_url]: https://gitter.im/j2css/j2c + +A lean (2.0KB), no hassle CSS in JS solution. + +`j2c`: -A lean, no hassle CSS in JS solution. +- supports all CSS features, and then some (most notably, local scope). +- scales from standalone ` + + + + + \ No newline at end of file diff --git a/plugins/prefix-browser/tests/test-plugin-at-supports-params.js b/plugins/prefix-browser/tests/test-plugin-at-supports-params.js index 6558558f..c23d1297 100644 --- a/plugins/prefix-browser/tests/test-plugin-at-supports-params.js +++ b/plugins/prefix-browser/tests/test-plugin-at-supports-params.js @@ -8,8 +8,6 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState -var init = exposed.init -var finalize = exposed.finalize var referenceFixers = Object.keys(blankFixers()) @@ -29,8 +27,7 @@ o.spec('plugin @supports parameters', function() { o('works with a blank fixer object', function() { mocks(global) - init() - finalize() + var plugin = createPrefixPlugin().setFixers(fixers) var sink = makeSink() var methods = plugin().$filter(sink) @@ -39,4 +36,58 @@ o.spec('plugin @supports parameters', function() { o(sink.buffer).deepEquals([['atrule', '@supports', 'supports', '(foo:bar)', true]]) }) + o('adds prefixes adequately (simple example)', function() { + mocks(global, { + properties: { + OFoo: 'bar' + } + }) + var plugin = createPrefixPlugin() + var sink = makeSink() + var methods = plugin().$filter(sink) + + methods.atrule('@supports', 'supports', '(foo: foo)', true) + + o(sink.buffer).deepEquals([ + ['atrule', '@supports', 'supports', '(-o-foo:foo)', true] + ]) + }) + o('adds prefixes adequately (complex example)', function() { + mocks(global, { + properties: { + OFoo: 'bar', + backgroundImage: ['-o-linear-gradient(red, teal)'], + display:['-o-box', '-o-grid'], + width: '-o-calc(1px + 5%)', + color: '-o-initial' + } + }) + var plugin = createPrefixPlugin() + var sink = makeSink() + var methods = plugin().$filter(sink) + + methods.atrule('@supports', 'supports', + '(foo: foo) and ' + + '(transition: foo cubic-bezier(calc(2 * var(--foo)),foo,calc(1 + var(--ofo)))) and ' + + '(transition-property: bar,foo) and ' + + '(display: flex) and ' + + '(display: grid) and ' + + '(background-image: linear-gradient(40deg, rgb(0, 0, calc(3 * var(--oof))))) and ' + + '(foo: initial)', + true) + + o(sink.buffer).deepEquals([ + [ + 'atrule', '@supports', 'supports', + '(-o-foo:foo) and ' + + '(transition:-o-foo cubic-bezier(-o-calc(2 * var(--foo)),foo,-o-calc(1 + var(--ofo)))) and ' + + '(transition-property:bar,-o-foo) and ' + + '(display:-o-box) and ' + + '(display:-o-grid) and ' + + '(background-image:-o-linear-gradient(50deg, rgb(0, 0, -o-calc(3 * var(--oof))))) and ' + + '(-o-foo:-o-initial)', + true + ] + ]) + }) }) \ No newline at end of file diff --git a/plugins/prefix-browser/tests/test-plugin-properties.js b/plugins/prefix-browser/tests/test-plugin-properties.js index 9771e1d7..dcf43b75 100644 --- a/plugins/prefix-browser/tests/test-plugin-properties.js +++ b/plugins/prefix-browser/tests/test-plugin-properties.js @@ -256,7 +256,7 @@ o.spec('plugin.decl for properties', function() { ]) o(fixers.properties).deepEquals({ - 'flex-direction': '-ms-flex-direction', + 'flex-direction': '-ms-flex-direction' }) }) o('with flexbox 2012, `flex-flow` (no direction) becomes flex-wrap', function() { diff --git a/plugins/prefix-browser/tests/test-plugin-values-functions.js b/plugins/prefix-browser/tests/test-plugin-values-functions.js index a572f66c..ea73968a 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-functions.js +++ b/plugins/prefix-browser/tests/test-plugin-values-functions.js @@ -52,7 +52,7 @@ o.spec('plugin.decl for values that have functions', function() { o(sink.buffer).deepEquals([ ['decl', 'foo', '-o-cross-fade(-o-linear-gradient(1deg red, green),-o-repeating-linear-gradient(110deg rgb( -o-calc(2 * var(--foo)), 0, 0), green))'], ['decl', 'foo', '-o-linear-gradient(-10deg red, green)'] - ]) + ]) }) o('skips the gradient fixer if none are present (see coverage)', function() { mocks(global) @@ -69,7 +69,7 @@ o.spec('plugin.decl for values that have functions', function() { o(sink.buffer).deepEquals([ ['decl', 'foo', '-o-cross-fade(linear-gradient(89deg red, green),repeating-linear-gradient(-20deg rgb( -o-calc(2 * var(--foo)), 0, 0), green))'], ['decl', 'foo', 'linear-gradient(100deg red, green)'] - ]) + ]) }) }) diff --git a/plugins/prefix-browser/tests/test-plugin-values-keywords.js b/plugins/prefix-browser/tests/test-plugin-values-keywords.js index ccf2c88f..f5ca622e 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-keywords.js +++ b/plugins/prefix-browser/tests/test-plugin-values-keywords.js @@ -58,7 +58,7 @@ o.spec('plugin.decl for keywords', function() { fixers.prefix = '-o-' fixers.hasKeywords = true fixers.keywords = unPrefixedKeywords - + var plugin = createPrefixPlugin().setFixers(fixers) var sink = makeSink() var methods = plugin().$filter(sink) @@ -93,7 +93,7 @@ o.spec('plugin.decl for keywords', function() { fixers.hasKeywords = true fixers.keywords = prefixedKeywords fixers.initial = '-o-initial' - + var plugin = createPrefixPlugin().setFixers(fixers) var sink = makeSink() var methods = plugin().$filter(sink) From 4296512de0ebf2e152aa40db0890cd26cef62a87 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 8 Jan 2017 23:31:01 +0100 Subject: [PATCH 134/244] [prefix-plugin] Use correct file name, improve flexbox support --- ...x.amd.js => j2c-plugin-prefix-browser.amd.js} | 8 ++++---- ...n.js => j2c-plugin-prefix-browser.amd.min.js} | 2 +- ....js => j2c-plugin-prefix-browser.commonjs.js} | 8 ++++---- ...=> j2c-plugin-prefix-browser.commonjs.min.js} | 2 +- ...al.js => j2c-plugin-prefix-browser.global.js} | 8 ++++---- ...s => j2c-plugin-prefix-browser.global.min.js} | 2 +- .../j2c-plugin-prefix-browser.global.min.js.gz | Bin 0 -> 3071 bytes .../dist/j2c-plugin-prefix.global.min.js.gz | Bin 3060 -> 0 bytes plugins/prefix-browser/scripts/build.js | 6 +++--- plugins/prefix-browser/src/plugin.js | 4 ++-- .../prefix-browser/test-utils/_exposed.es6.js | 4 ++-- plugins/prefix-browser/test-utils/exposed.js | 8 ++++---- 12 files changed, 26 insertions(+), 26 deletions(-) rename plugins/prefix-browser/dist/{j2c-plugin-prefix.amd.js => j2c-plugin-prefix-browser.amd.js} (97%) rename plugins/prefix-browser/dist/{j2c-plugin-prefix.amd.min.js => j2c-plugin-prefix-browser.amd.min.js} (67%) rename plugins/prefix-browser/dist/{j2c-plugin-prefix.commonjs.js => j2c-plugin-prefix-browser.commonjs.js} (97%) rename plugins/prefix-browser/dist/{j2c-plugin-prefix.commonjs.min.js => j2c-plugin-prefix-browser.commonjs.min.js} (67%) rename plugins/prefix-browser/dist/{j2c-plugin-prefix.global.js => j2c-plugin-prefix-browser.global.js} (97%) rename plugins/prefix-browser/dist/{j2c-plugin-prefix.global.min.js => j2c-plugin-prefix-browser.global.min.js} (67%) create mode 100644 plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz delete mode 100644 plugins/prefix-browser/dist/j2c-plugin-prefix.global.min.js.gz diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js similarity index 97% rename from plugins/prefix-browser/dist/j2c-plugin-prefix.amd.js rename to plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index 315f1e9e..ea4c26c2 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -550,8 +550,8 @@ define(function () { 'use strict'; fixers.hasAtrules && fixers.atrules[rule] || rule, kind, ( - kind === 'media' ? fixers.fixAtMediaParams(params) : - kind === 'supports' ? fixers.fixAtSupportsParams(params) : + rule === '@media' ? fixers.fixAtMediaParams(params) : + rule === '@supports' ? fixers.fixAtSupportsParams(params) : params ), hasBlock @@ -565,8 +565,8 @@ define(function () { 'use strict'; else if(v !== '') decl('flex-direction', v) }) } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js similarity index 67% rename from plugins/prefix-browser/dist/j2c-plugin-prefix.amd.min.js rename to plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index b85b8e5d..11378cdc 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=h("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=y("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=-1===i.indexOf(",")?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return-1!==e.indexOf("reso")?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"media"===n?r.fixAtMediaParams(t):"supports"===n?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return-1===i.indexOf(n)&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file +define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js similarity index 97% rename from plugins/prefix-browser/dist/j2c-plugin-prefix.commonjs.js rename to plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index 5da9515a..765d6d38 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -550,8 +550,8 @@ function createPrefixPlugin() { fixers.hasAtrules && fixers.atrules[rule] || rule, kind, ( - kind === 'media' ? fixers.fixAtMediaParams(params) : - kind === 'supports' ? fixers.fixAtSupportsParams(params) : + rule === '@media' ? fixers.fixAtMediaParams(params) : + rule === '@supports' ? fixers.fixAtSupportsParams(params) : params ), hasBlock @@ -565,8 +565,8 @@ function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v) }) } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js similarity index 67% rename from plugins/prefix-browser/dist/j2c-plugin-prefix.commonjs.min.js rename to plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index 75e67326..6299df51 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=-1===t.indexOf(",")?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(o&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return-1!==e.indexOf("reso")?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"media"===i?r.fixAtMediaParams(n):"supports"===i?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof n?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof n?(e.decl(r.properties["box-orient"],n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return-1===t.indexOf(i)&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof n?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof n?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js similarity index 97% rename from plugins/prefix-browser/dist/j2c-plugin-prefix.global.js rename to plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index a959a8c8..4d97733d 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -551,8 +551,8 @@ var j2cPrefixPluginBrowser = (function () { fixers.hasAtrules && fixers.atrules[rule] || rule, kind, ( - kind === 'media' ? fixers.fixAtMediaParams(params) : - kind === 'supports' ? fixers.fixAtSupportsParams(params) : + rule === '@media' ? fixers.fixAtMediaParams(params) : + rule === '@supports' ? fixers.fixAtSupportsParams(params) : params ), hasBlock @@ -566,8 +566,8 @@ var j2cPrefixPluginBrowser = (function () { else if(v !== '') decl('flex-direction', v) }) } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js similarity index 67% rename from plugins/prefix-browser/dist/j2c-plugin-prefix.global.min.js rename to plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index 11c78ce2..035f1080 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=h("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=y("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=-1===i.indexOf(",")?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return-1!==e.indexOf("reso")?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"media"===n?r.fixAtMediaParams(t):"supports"===n?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return-1===i.indexOf(n)&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file +var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz new file mode 100644 index 0000000000000000000000000000000000000000..7c52e02c0b8731cee61446771e0c4351b2643717 GIT binary patch literal 3071 zcmV5!aM#A8-Xu4$s-9IiTnTx5&2rP}>1y zi?$idlt9tzb=LmxouOXzE7?OoHV9;LW;mST4CldpigfGCkMjpD7V`Na*)FB}t4?>h z(0s8~b0bsb(HFAKMJqR2&J7t>@Rk6~jxU9IpKh|P5%HthC&G)<`F10e397+|MBooo z+a#fE#%qGP7LgGp+9R=iA~eX630w19Y=S7ugo@vGwrZ#t^i(1y zZEp6NNEfY&L#K0dLoGJxlPES^Q?}!4j;b`gr6=f%7G|sAP=Gv3qPg&TzBi8iuT$Dv zvid9q(>19MO!_ZSM!%18ILjlgmlB^aLLBMU^&Q6d{(q(?>?>9T@Qp&Y%pO8Yk~IB9>9h13|ikz8nc_ z_dXXuZxl}Qu1XCZ!Ecl#Jy@C>Zyn?-A;6k>{%MmU7bHS0&8p#%BM-Uo2>1&ZL1u3WeR+aQqxs8P>=!!Ph&&_;eh7P# zVwa`bgyE1W?thNi3e^T=*GceU0dFaJl4H9ob|1?$RDE_Rdxx4ma2p+GaY1n_?tb zsS%!kYahbgRb#S|%5RpEsk0bSuV4^8-(&!&YYgD1k+)-s8)tc@;}vON!RWgJTgZ2K zK+tS1K=#cGKo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Nq*<~ zqe*->3Gho}vFt4++j94<$#n_v7}@oH?)!>jbsac^1@h{qH+f%V;w=P&O{X z2!&1k!ARDQv}8{-+<-p8Cd#}k-X~5-kF*RNzzV{Cr}JDmr){4=>dcuMZtArQwgq|@ z5;KhuTKMn|{10r7uM7u#CV(qiKOLa6g=jUrZSh?|!Q;9VAC7uUHsfaxHzU`aj{lt* z)W#ll3~xO9{1Gl6BeM!@NAC^#cj(`}L7yDM)2rZIgtJ9I|K(2NrN|^Ho$91M;q}`Y zl&$T-=$eh(%^X>4!{cER+P1cD47y{pI*6Vy9qtm0e$rdVpHV{r&Z~-4AGc$jVZLr%TJz@!$nhn|FDpW zf#UL#S6P~eZbV~-rP!z!C@8C%n!VG}_0um#Nu(~{-i!FAFZ>y*w2-{ZOQlYzPBleB z-1*32F;7CL*Z_&>3&GMFn*MZ$JQM^R?Kbv@gLa=ZARrO^8g)B)wv93thhVxwv}kf>B|@Vx^f(3LIK#U=_mil$UF5R<_%&RiAk)wpQg0v7I7O@S=5 zkB`NRi006j4oStNIsWrMEp|FFRFP~69~&{ThiU4~T$o=Wi)iP5Hd&)d!Kz5W;H*p3 zsBBa~7pA#l;t2n3I%G4pW{-SqAC93}B=fD#Q%$BtCx;NI#%7R)@n?p9!^qb(-S|>f zqjU=na%44&@-@umfe&KLeH~+@dJ<&kZ-fQv6mIvIaRan7chf8_`bu}#+{pQQe?nG1 zy_at4SJRb{%awrv)&wV$iUKQ!1|h4Z&TjKmnFtUNDI$nBpawRz(NiRoXqE^IF#f#w z^IXZ@nZe3xHa$++1Aie=BA3dSMr`o@pz~V@vCVz~C=aIz69pL02u1j^g)>;}Yt98W zi{@*>pxlGVTwdf@D*I-iZZoKuKk+i^2^GT{{FZymgs>EjW` N{{@{o3jbmu0055&@m~M{ literal 0 HcmV?d00001 diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix.global.min.js.gz deleted file mode 100644 index 11f9591c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-Nf zeN4$ -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), diff --git a/plugins/prefix-browser/test-utils/_exposed.es6.js b/plugins/prefix-browser/test-utils/_exposed.es6.js index 2659ed55..b0057224 100644 --- a/plugins/prefix-browser/test-utils/_exposed.es6.js +++ b/plugins/prefix-browser/test-utils/_exposed.es6.js @@ -12,8 +12,8 @@ export { export {detectAtrules} from '../src/detectors/atrules.js' export {detectFunctions} from '../src/detectors/functions.js' export { - detectKeywords, keywords, - flex2009Props, flex2009Values, + detectKeywords, keywords, + flex2009Props, flex2009Values, flex2012Props, flex2012Values } from '../src/detectors/keywords.js' export {detectPrefix} from '../src/detectors/prefix.js' diff --git a/plugins/prefix-browser/test-utils/exposed.js b/plugins/prefix-browser/test-utils/exposed.js index a553f6fb..f6058677 100644 --- a/plugins/prefix-browser/test-utils/exposed.js +++ b/plugins/prefix-browser/test-utils/exposed.js @@ -558,8 +558,8 @@ function createPrefixPlugin() { fixers.hasAtrules && fixers.atrules[rule] || rule, kind, ( - kind === 'media' ? fixers.fixAtMediaParams(params) : - kind === 'supports' ? fixers.fixAtSupportsParams(params) : + rule === '@media' ? fixers.fixAtMediaParams(params) : + rule === '@supports' ? fixers.fixAtSupportsParams(params) : params ), hasBlock @@ -573,8 +573,8 @@ function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v) }) } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), From 634f5441c6297d6143773d86e99e777b7a524214 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 8 Jan 2017 23:39:17 +0100 Subject: [PATCH 135/244] [prefix-plugin] Only use prefixed flexbox when unprefixed is unavailable --- .../dist/j2c-plugin-prefix-browser.amd.js | 4 ++-- .../dist/j2c-plugin-prefix-browser.amd.min.js | 2 +- .../j2c-plugin-prefix-browser.commonjs.js | 4 ++-- .../j2c-plugin-prefix-browser.commonjs.min.js | 2 +- .../dist/j2c-plugin-prefix-browser.global.js | 4 ++-- .../j2c-plugin-prefix-browser.global.min.js | 2 +- ...j2c-plugin-prefix-browser.global.min.js.gz | Bin 3071 -> 3083 bytes .../prefix-browser/src/detectors/keywords.js | 4 ++-- plugins/prefix-browser/test-utils/exposed.js | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index ea4c26c2..1aa35a16 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -223,7 +223,7 @@ define(function () { 'use strict'; fixers.keywords[property] = map } } - if (fixers.keywords.display && fixers.keywords.display.flexbox) { + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE fixers.keywords.display.flex = fixers.keywords.display.flexbox fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] @@ -232,7 +232,7 @@ define(function () { 'use strict'; fixers.properties[k] = flex2012Props[k] fixers.keywords[k] = flex2012Values } - } else if (fixers.keywords.display && fixers.keywords.display.box) { + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec fixers.keywords.display.flex = fixers.keywords.display.box fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index 11378cdc..3b0871ba 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file +define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index 765d6d38..eab48440 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -223,7 +223,7 @@ function detectKeywords(fixers) { fixers.keywords[property] = map } } - if (fixers.keywords.display && fixers.keywords.display.flexbox) { + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE fixers.keywords.display.flex = fixers.keywords.display.flexbox fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] @@ -232,7 +232,7 @@ function detectKeywords(fixers) { fixers.properties[k] = flex2012Props[k] fixers.keywords[k] = flex2012Values } - } else if (fixers.keywords.display && fixers.keywords.display.box) { + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec fixers.keywords.display.flex = fixers.keywords.display.box fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index 6299df51..f3517a3a 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof n?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof n?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],l=i.property,n=t+"("+i.params+")";!supportedDecl(l,n)&&supportedDecl(l,e.prefix+n)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var l;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(l=(e.keywords[i]||emptySet)[t])?l:(l=t,e.valueProperties.hasOwnProperty(i)&&(l=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(l=l.replace(p,u)),l=l.replace(d,r)),l)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,l,n){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(l):"@supports"===t?r.fixAtSupportsParams(l):l,n)},decl:function t(i,l){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof l?l.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof l?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),l.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),l.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(l,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index 4d97733d..c7447190 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -224,7 +224,7 @@ var j2cPrefixPluginBrowser = (function () { fixers.keywords[property] = map } } - if (fixers.keywords.display && fixers.keywords.display.flexbox) { + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE fixers.keywords.display.flex = fixers.keywords.display.flexbox fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] @@ -233,7 +233,7 @@ var j2cPrefixPluginBrowser = (function () { fixers.properties[k] = flex2012Props[k] fixers.keywords[k] = flex2012Values } - } else if (fixers.keywords.display && fixers.keywords.display.box) { + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec fixers.keywords.display.flex = fixers.keywords.display.box fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index 035f1080..51371afc 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file +var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz index 7c52e02c0b8731cee61446771e0c4351b2643717..115534ad50dc73e56248743e8faadbbd0a4cd2ce 100644 GIT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z~-4AGc$jVZLr%TJz@!$nhn|FDpWf#UL#SASWWhi*h;hNal37bqyJnwq`S(e=|W zMoFYD-`2%S)wBs7^ISLfrYtVlhubr`Q0A=nKKp8k+uehddMn9PKvt zhl6&XG$0@m{2P*50(JS<7c(+d%iJO~fGY7r1f{2YD9#<)=_s>FbR@lEZwp}p)Uh39 zr+-r+VyUZUPe8~F&!L69C*oce4-x>X4vM)CtFXdPb@5zhwRG~5i-hRfNI!>Qx>1Gv zWR|4!wI4mp970j~HezSk#ogGkk^cIo4gO?bUyCQ9v1YeBSF@0)RB!OT10v9sE!D*) z3Ob6WR5TEi!7)$5WHYvAk9=$&j-gp3 z^R3QPO{PUBhY+a7W{`&QXNG>m$k#O8_)=A)bPEo0WHpQOHO%FK4`R%H9b=?=5`Sdp zZ-fQv6mIvIaRan7chf8_`bu}#+{pQQe?nG1y_at4SJRb{%awrv)&wV$iUKQ!1|h4Z z&TjKmnFtUNDI$nBpawRz(NiRoXqE^IF#f#w^IXZ@nZe3xHa$++1Aie=BA3dSMr`o@ zpz~V@vCVz~C=aIz69pL02u1j^g?}?x>}$>iHjCzK!l2xP$Xs6JSStHwpKdd#m_P9{ z>IoIY8vK@fro zDhfEToy()}!lxRauXORyS5qjlj7o}2<1~C+3)N6NhjaMyTJxNn18ye7{@K=uZ&>8W r-s9gnKJebyqik9h8~Nn1EHUNWS25}15yt-oojMBtVj%zkFjMEY diff --git a/plugins/prefix-browser/src/detectors/keywords.js b/plugins/prefix-browser/src/detectors/keywords.js index eecd78ea..920cc118 100644 --- a/plugins/prefix-browser/src/detectors/keywords.js +++ b/plugins/prefix-browser/src/detectors/keywords.js @@ -105,7 +105,7 @@ export function detectKeywords(fixers) { fixers.keywords[property] = map } } - if (fixers.keywords.display && fixers.keywords.display.flexbox) { + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE fixers.keywords.display.flex = fixers.keywords.display.flexbox fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] @@ -114,7 +114,7 @@ export function detectKeywords(fixers) { fixers.properties[k] = flex2012Props[k] fixers.keywords[k] = flex2012Values } - } else if (fixers.keywords.display && fixers.keywords.display.box) { + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec fixers.keywords.display.flex = fixers.keywords.display.box fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] diff --git a/plugins/prefix-browser/test-utils/exposed.js b/plugins/prefix-browser/test-utils/exposed.js index f6058677..72c18f6a 100644 --- a/plugins/prefix-browser/test-utils/exposed.js +++ b/plugins/prefix-browser/test-utils/exposed.js @@ -231,7 +231,7 @@ function detectKeywords(fixers) { fixers.keywords[property] = map } } - if (fixers.keywords.display && fixers.keywords.display.flexbox) { + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE fixers.keywords.display.flex = fixers.keywords.display.flexbox fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] @@ -240,7 +240,7 @@ function detectKeywords(fixers) { fixers.properties[k] = flex2012Props[k] fixers.keywords[k] = flex2012Values } - } else if (fixers.keywords.display && fixers.keywords.display.box) { + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec fixers.keywords.display.flex = fixers.keywords.display.box fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] From 129ebeb0c2f295529429e7f396dd42fda99af59a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Mon, 9 Jan 2017 00:00:04 +0100 Subject: [PATCH 136/244] [prefix-plugin] improve test page --- plugins/prefix-browser/tests/index.html | 86 +++++++++++++++++-------- 1 file changed, 59 insertions(+), 27 deletions(-) diff --git a/plugins/prefix-browser/tests/index.html b/plugins/prefix-browser/tests/index.html index 2ed02c21..160e56c1 100644 --- a/plugins/prefix-browser/tests/index.html +++ b/plugins/prefix-browser/tests/index.html @@ -15,37 +15,67 @@ transform: 'rotate(375deg)' } }, - '.download': { - position: 'absolute', - top: '1em', - left: '-1.5em', - width: '6em', - height: '6em', - padding: '1em 0', - background: '#80A060', - backgroundImage: 'linear-gradient(90deg, transparent, rgba(10,0,0,.3)),linear-gradient(transparent, transparent)', - color: 'white', - lineHeight: 1, - fontSize: '140%', - textAlign: 'center', - textDecoration: 'initial', - textShadow: '.08em .08em .2em rgba(0,0,0,.6)', - borderRadius: '50%', - boxShadow: '.1em .2em .4em -.2em black', - boxSizing: 'border-box', - transform: 'rotate(15deg)', - animation: 'rotate', - cursor: 'zoom-in' + '@supports (display:flex)':{ + ':read-write ::placeholder': { + display: 'flex', + flex: '1 1', + flexFlow: 'column-reverse wrap' + }, }, - ':read-write ::placeholder': { - display: 'flex', - flex: '1 1', - flexFlow: 'column-reverse wrap' + '@media (min-resolution:2ddpx)' : { + '.download': { + backgroundImage: 'linear-gradient(90deg, red, rgba(calc(10 * 2),0,0,.3))', + color: 'white', + textDecoration: 'initial', + textShadow: '.08em .08em .2em rgba(0,0,0,.6)', + borderRadius: '50%', + boxShadow: '.1em .2em .4em -.2em black', + boxSizing: 'border-box', + transform: 'rotate(15deg)', + animation: 'rotate', + cursor: 'zoom-in' + } } } } -var prefixer = j2c().use(j2cPrefixPluginBrowser) -source.value = '// raw (this isn\'t live)\n' + j2c.sheet(src) +var buf, err, indent + +// the bottom of the 'codegen' stream. Mirrors the `$filter` plugin API. +var sink = {$sink: { + init: function(){buf=[], err=0, indent = ''}, + done: function (raw) { + if (err) throw new Error('j2c error, see below\n' + buf.join('')) + return raw ? buf : buf.join('') + }, + err: function(msg) { + err = 1 + buf.push('/* +++ ERROR +++ ' + msg + ' */\n') + }, + atrule: function (rule, kind, param, takesBlock) { + buf.push(indent, rule, param && ' ', param, takesBlock ? ' {' : ';', '\n') + if (takesBlock) indent = indent + ' ' + }, + // close atrule + _atrule: function () { + indent = indent.slice(4) + buf.push(indent, '}', '\n') + }, + rule: function (selector) { + buf.push(indent, selector, ' {', '\n') + indent = indent + ' ' + }, + + // close rule + _rule: function () { + indent = indent.slice(4) + buf.push(indent, '}', '\n') + }, + decl: function (prop, value) {buf.push(indent, prop, prop && ': ', value, ';', '\n')} +}} + +var rawstyler = j2c().use(sink) +var prefixer = j2c().use(j2cPrefixPluginBrowser, sink) +source.value = '// raw (this isn\'t live)\n' + rawstyler.sheet(src) prefixed.value = '//prefixed\n' + prefixer.sheet(src) \ No newline at end of file From 01e971ac10cd2c19184fafe8b68145be0b56eb2c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Mon, 9 Jan 2017 13:22:26 +0100 Subject: [PATCH 137/244] [prefix-plugin] `dppx`, not `ddpx` --- plugins/prefix-browser/tests/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/prefix-browser/tests/index.html b/plugins/prefix-browser/tests/index.html index 160e56c1..072f53aa 100644 --- a/plugins/prefix-browser/tests/index.html +++ b/plugins/prefix-browser/tests/index.html @@ -22,7 +22,7 @@ flexFlow: 'column-reverse wrap' }, }, - '@media (min-resolution:2ddpx)' : { + '@media (min-resolution:2dppx)' : { '.download': { backgroundImage: 'linear-gradient(90deg, red, rgba(calc(10 * 2),0,0,.3))', color: 'white', From 8567cfb6cf1bbb64db4395781d493c573b76687d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 10 Jan 2017 20:32:43 +0100 Subject: [PATCH 138/244] [prefix-plugin] build --- .../dist/j2c-plugin-prefix-browser.amd.js | 1039 ++++++++-------- .../dist/j2c-plugin-prefix-browser.amd.min.js | 2 +- .../j2c-plugin-prefix-browser.commonjs.js | 253 ++-- .../j2c-plugin-prefix-browser.commonjs.min.js | 2 +- .../dist/j2c-plugin-prefix-browser.global.js | 1043 +++++++++-------- .../j2c-plugin-prefix-browser.global.min.js | 2 +- ...j2c-plugin-prefix-browser.global.min.js.gz | Bin 3083 -> 3084 bytes plugins/prefix-browser/test-utils/exposed.js | 263 +++-- 8 files changed, 1335 insertions(+), 1269 deletions(-) diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index 1aa35a16..a3191e9f 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -1,593 +1,608 @@ define(function () { 'use strict'; - // Derived from Lea Verou's PrefixFree - - var allStyles; - var styleAttr; - var styleElement; - function init() { - allStyles = getComputedStyle(document.documentElement, null) - styleAttr = document.createElement('div').style - styleElement = document.documentElement.appendChild(document.createElement('style')) - } - function finalize() { - if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement) - // `styleAttr` is used at run time via `supportedProperty()` - // `allStyles` and `styleElement` can be displosed of after initialization. - allStyles = styleElement = null - } - - // Helpers, in alphabetic order - - function camelCase(str) { - return str.replace(/-([a-z])/g, function($0, $1) { return $1.toUpperCase() }).replace('-','') - } - function deCamelCase(str) { - return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) - } - function supportedDecl(property, value) { - styleAttr[property] = styleAttr[deCamelCase(property)] = '' - styleAttr[property] = styleAttr[deCamelCase(property)] = value - return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) - } - function supportedMedia(condition) { - styleElement.textContent = '@media (' + condition +'){}' - // Opera 11 treats unknown conditions as 'all', the rest as 'not all'. - // So far tested in modern browsers (01/01/2017), and desktop IE9, FF4, - // Opera 11/12, and Safari 6. TY SauceLabs. - return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) - } - function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return property in styleAttr || camelCase(property) in styleAttr - } - function supportedRule(selector) { - styleElement.textContent = selector + '{}' - return !!styleElement.sheet.cssRules.length - } - - function detectAtrules(fixers) { - if (fixers.prefix === '') return - var atrules = { - 'keyframes': 'name', - 'viewport': null, - 'document': 'regexp(".")' - } - - // build a map of {'@ruleX': '@-prefix-ruleX'} - for(var atrule in atrules) { - var test = atrule + ' ' + (atrules[atrule] || '') - if (!supportedRule('@' + test) && supportedRule('@' + fixers.prefix + test)) { - - fixers.hasAtrules = true - fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule - } - } - - // Standard - fixers.hasDppx = supportedMedia('resolution:1dppx') - // Webkit - fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio:1') - // Opera - fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio:1/1') - - if (fixers.hasPixelRatio || fixers.hasPixelRatioFraction) { - fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio' - fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio' - fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio' - if (supportedMedia('min-' + fixers.prefix + 'device-pixel-ratio:1')) { - // Mozilla/Firefox tunred a vendor prefix into a vendor infix - fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio' - fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio' - } +// Derived from Lea Verou's PrefixFree + +var allStyles; +var styleAttr; +var styleElement; + +function init() { + allStyles = getComputedStyle(document.documentElement, null); + styleAttr = document.createElement('div').style; + styleElement = document.documentElement.appendChild(document.createElement('style')); +} +function finalize() { + if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); + // `styleAttr` is used at run time via `supportedProperty()` + // `allStyles` and `styleElement` can be displosed of after initialization. + allStyles = styleElement = null; +} + +// Helpers, in alphabetic order + +function camelCase(str) { + return str.replace(/-([a-z])/g, function($0, $1) { return $1.toUpperCase() }).replace('-','') +} +function deCamelCase(str) { + return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) +} +function supportedDecl(property, value) { + styleAttr[property] = styleAttr[deCamelCase(property)] = ''; + styleAttr[property] = styleAttr[deCamelCase(property)] = value; + return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) +} +function supportedMedia(condition) { + styleElement.textContent = '@media (' + condition +'){}'; + // Opera 11 treats unknown conditions as 'all', the rest as 'not all'. + // So far tested in modern browsers (01/01/2017), and desktop IE9, FF4, + // Opera 11/12, and Safari 6. TY SauceLabs. + return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) +} +function supportedProperty(property) { + // Some browsers like it dash-cased, some camelCased, most like both. + return property in styleAttr || camelCase(property) in styleAttr +} +function supportedRule(selector) { + styleElement.textContent = selector + '{}'; + return !!styleElement.sheet.cssRules.length +} + +// Derived from Lea Verou's PrefixFree + +// TODO: http://caniuse.com/#feat=css-media-resolution + +function detectAtrules(fixers) { + if (fixers.prefix === '') return + var atrules = { + 'keyframes': 'name', + 'viewport': null, + 'document': 'regexp(".")' + }; + + // build a map of {'@ruleX': '@-prefix-ruleX'} + for(var atrule in atrules) { + var test = atrule + ' ' + (atrules[atrule] || ''); + if (!supportedRule('@' + test) && supportedRule('@' + fixers.prefix + test)) { + + fixers.hasAtrules = true; + fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule; } } - function detectFunctions(fixers) { - // Values that might need prefixing - if (fixers.prefix === '') return - var functions = { - 'linear-gradient': { - property: 'backgroundImage', - params: 'red, teal' - }, - 'calc': { - property: 'width', - params: '1px + 5%' - }, - 'element': { - property: 'backgroundImage', - params: '#foo' - }, - 'cross-fade': { - property: 'backgroundImage', - params: 'url(a.png), url(b.png), 50%' - } - } - functions['repeating-linear-gradient'] = - functions['repeating-radial-gradient'] = - functions['radial-gradient'] = - functions['linear-gradient'] - - // build an array of prefixable functions - for (var func in functions) { - var test = functions[func], - property = test.property, - value = func + '(' + test.params + ')' - - if (!supportedDecl(property, value) && supportedDecl(property, fixers.prefix + value)) { - // It's only supported with a prefix - fixers.functions.push(func) - } + // Standard + fixers.hasDppx = supportedMedia('resolution:1dppx'); + // Webkit + fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio:1'); + // Opera + fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio:1/1'); + + if (fixers.hasPixelRatio || fixers.hasPixelRatioFraction) { + fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio'; + fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio'; + fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio'; + if (supportedMedia('min-' + fixers.prefix + 'device-pixel-ratio:1')) { + // Mozilla/Firefox tunred a vendor prefix into a vendor infix + fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio'; + fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio'; } } +} - // db of prop/value pairs whose values may need treatment. - - var keywords = [ +// Derived from Lea Verou's PrefixFree - // `initial` applies to all properties and is thus handled separately. - { - props: ['cursor'], - values: [ 'grab', 'grabbing', 'zoom-in', 'zoom-out'] +function detectFunctions(fixers) { + // Values that might need prefixing + if (fixers.prefix === '') return + var functions = { + 'linear-gradient': { + property: 'backgroundImage', + params: 'red, teal' }, - { - props: ['display'], - values:['box', 'inline-box', 'flexbox', 'inline-flexbox', 'flex', 'inline-flex', 'grid', 'inline-grid'] + 'calc': { + property: 'width', + params: '1px + 5%' }, - { - props: ['position'], - values: [ 'sticky' ] + 'element': { + property: 'backgroundImage', + params: '#foo' }, - { - props: ['width', 'column-width', 'height', 'max-height', 'max-width', 'min-height', 'min-width'], - values: ['contain-floats', 'fill-available', 'fit-content', 'max-content', 'min-content'] + 'cross-fade': { + property: 'backgroundImage', + params: 'url(a.png), url(b.png), 50%' + } + }; + functions['repeating-linear-gradient'] = + functions['repeating-radial-gradient'] = + functions['radial-gradient'] = + functions['linear-gradient']; + + // build an array of prefixable functions + for (var func in functions) { + var test = functions[func], + property = test.property, + value = func + '(' + test.params + ')'; + + if (!supportedDecl(property, value) && supportedDecl(property, fixers.prefix + value)) { + // It's only supported with a prefix + fixers.functions.push(func); } - ] - // The flexbox zoo - // - // ## Specs: - // - box (2009/old): https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/ - // - flexbox (2012/ie10): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/ - // - flex (final): https://www.w3.org/TR/css-flexbox-1/ - var flex2009Props = { - // ?align-content => - // ?align-self => - 'align-items': 'box-align', - 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, - // ?flex-basis => - // !!flex-direction => box-direction + box-orient, covered in `plugin.js` - // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` - // ?flex-grow => - // ?flex-shrink => - 'flex-wrap': 'box-lines', - 'justify-content': 'box-pack', - 'order': 'box-ordinal-group' // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025 - } - var flex2009Values = { - // flex => box || only for display? handled in the code - 'flex-end': 'end', - 'flex-start': 'start', - // inline-flex => inline-box || see flex - 'nowrap': 'single', - 'space-around': 'justify', - 'space-between': 'justify', - 'wrap': 'multiple', - 'wrap-reverse': 'multiple' - } - var flex2012Props = { - 'align-content': '-ms-flex-line-pack', - 'align-items': '-ms-flex-align', - 'align-self': '-ms-flex-item-align', - // flex => -ms-flex - 'flex-basis': '-ms-preferred-size', - // flex-direction => -ms-flex-direction - // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` - 'flex-grow': '-ms-flex-positive', - 'flex-shrink': '-ms-flex-negative', - // flex-wrap => -ms-flex-wrap - 'justify-content': '-ms-flex-pack', - 'order': '-ms-flex-order' } - var flex2012Values = { - // flex => flexbox || only for display? handled in the code - 'flex-end': 'end', - 'flex-start': 'start', - // inline-flex => inline-flexbox || see 'flex' - // nowrap => nowrap - 'space-around': 'distribute', - 'space-between': 'justify' - // wrap => wrap - // wrap-reverse => wrap-reverse +} + +// Derived from Lea Verou's PrefixFree and Robin Frischmann's Inline Style Prefixer + +// TODO: http://caniuse.com/#feat=css-writing-mode + +// db of prop/value pairs whose values may need treatment. + +var keywords = [ + + // `initial` applies to all properties and is thus handled separately. + { + props: ['cursor'], + values: [ 'grab', 'grabbing', 'zoom-in', 'zoom-out'] + }, + { + props: ['display'], + values:['box', 'inline-box', 'flexbox', 'inline-flexbox', 'flex', 'inline-flex', 'grid', 'inline-grid'] + }, + { + props: ['position'], + values: [ 'sticky' ] + }, + { + props: ['width', 'column-width', 'height', 'max-height', 'max-width', 'min-height', 'min-width'], + values: ['contain-floats', 'fill-available', 'fit-content', 'max-content', 'min-content'] } - - function detectKeywords(fixers) { - if (fixers.prefix === '') return - - // build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...} - for (var i = 0; i < keywords.length; i++) { - var map = {}, property = keywords[i].props[0] - // eslint-disable-next-line - for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) { - - if ( - !supportedDecl(property, keyword) && - supportedDecl(property, fixers.prefix + keyword) - ) { - fixers.hasKeywords = true - map[keyword] = fixers.prefix + keyword - } - } - // eslint-disable-next-line - for (j = 0; property = keywords[i].props[j]; j++) { - fixers.keywords[property] = map +]; +// The flexbox zoo +// +// ## Specs: +// - box (2009/old): https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/ +// - flexbox (2012/ie10): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/ +// - flex (final): https://www.w3.org/TR/css-flexbox-1/ +var flex2009Props = { + // ?align-content => + // ?align-self => + 'align-items': 'box-align', + 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, + // ?flex-basis => + // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` + // ?flex-grow => + // ?flex-shrink => + 'flex-wrap': 'box-lines', + 'justify-content': 'box-pack', + 'order': 'box-ordinal-group' // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025 +}; +var flex2009Values = { + // flex => box || only for display? handled in the code + 'flex-end': 'end', + 'flex-start': 'start', + // inline-flex => inline-box || see flex + 'nowrap': 'single', + 'space-around': 'justify', + 'space-between': 'justify', + 'wrap': 'multiple', + 'wrap-reverse': 'multiple' +}; +var flex2012Props = { + 'align-content': '-ms-flex-line-pack', + 'align-items': '-ms-flex-align', + 'align-self': '-ms-flex-item-align', + // flex => -ms-flex + 'flex-basis': '-ms-preferred-size', + // flex-direction => -ms-flex-direction + // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` + 'flex-grow': '-ms-flex-positive', + 'flex-shrink': '-ms-flex-negative', + // flex-wrap => -ms-flex-wrap + 'justify-content': '-ms-flex-pack', + 'order': '-ms-flex-order' +}; +var flex2012Values = { + // flex => flexbox || only for display? handled in the code + 'flex-end': 'end', + 'flex-start': 'start', + // inline-flex => inline-flexbox || see 'flex' + // nowrap => nowrap + 'space-around': 'distribute', + 'space-between': 'justify' + // wrap => wrap + // wrap-reverse => wrap-reverse +}; + +function detectKeywords(fixers) { + if (fixers.prefix === '') return + + // build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...} + for (var i = 0; i < keywords.length; i++) { + var map = {}, property = keywords[i].props[0]; + // eslint-disable-next-line + for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) { + + if ( + !supportedDecl(property, keyword) && + supportedDecl(property, fixers.prefix + keyword) + ) { + fixers.hasKeywords = true; + map[keyword] = fixers.prefix + keyword; } } - if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { - // old IE - fixers.keywords.display.flex = fixers.keywords.display.flexbox - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] - fixers.flexbox2012 = true - for (var k in flex2012Props) { - fixers.properties[k] = flex2012Props[k] - fixers.keywords[k] = flex2012Values - } - } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { - // old flexbox spec - fixers.keywords.display.flex = fixers.keywords.display.box - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] - fixers.flexbox2009 = true - for (k in flex2009Props) { - fixers.properties[k] = fixers.prefix + flex2009Props[k] - fixers.keywords[k] = flex2009Values - } + // eslint-disable-next-line + for (j = 0; property = keywords[i].props[j]; j++) { + fixers.keywords[property] = map; + } + } + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { + // old IE + fixers.keywords.display.flex = fixers.keywords.display.flexbox; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox']; + fixers.flexbox2012 = true; + for (var k in flex2012Props) { + fixers.properties[k] = flex2012Props[k]; + fixers.keywords[k] = flex2012Values; } - if ( - !supportedDecl('color', 'initial') && - supportedDecl('color', fixers.prefix + 'initial') - ) { - // `initial` does not use the `hasKeywords` branch, no need to set it to true. - fixers.initial = fixers.prefix + 'initial' + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { + // old flexbox spec + fixers.keywords.display.flex = fixers.keywords.display.box; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box']; + fixers.flexbox2009 = true; + for (k in flex2009Props) { + fixers.properties[k] = fixers.prefix + flex2009Props[k]; + fixers.keywords[k] = flex2009Values; } } + if ( + !supportedDecl('color', 'initial') && + supportedDecl('color', fixers.prefix + 'initial') + ) { + // `initial` does not use the `hasKeywords` branch, no need to set it to true. + fixers.initial = fixers.prefix + 'initial'; + } +} - function detectPrefix(fixers) { - var prefixCounters = {} - // Why are we doing this instead of iterating over properties in a .style object? Because Webkit. - // 1. Older Webkit won't iterate over those. - // 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit' - // (lower case 'w') ones are, but they don't `deCamelCase()` into a prefix that we can detect. +// Derived from Lea Verou's PrefixFree - function iteration(property) { - if(property.charAt(0) === '-') { - var prefix = property.split('-')[1] +function detectPrefix(fixers) { + var prefixCounters = {}; + // Why are we doing this instead of iterating over properties in a .style object? Because Webkit. + // 1. Older Webkit won't iterate over those. + // 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit' + // (lower case 'w') ones are, but they don't `deCamelCase()` into a prefix that we can detect. - // Count prefix uses - prefixCounters[prefix] = ++prefixCounters[prefix] || 1 - } - } + function iteration(property) { + if(property.charAt(0) === '-') { + var prefix = property.split('-')[1]; - // Some browsers have numerical indices for the properties, some don't - if(allStyles && allStyles.length > 0) { - for(var i=0; i 0) { + for(var i=0; i -1 - var gradientDetector = /\blinear-gradient\(/ - var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig - var gradientReplacer = function (match, delim, gradient, deg) { - return delim + gradient + (90-deg) + 'deg' - } + // When gradients are supported with a prefix, convert angles to legacy + // (from clockwise to trigonometric) + var hasGradients = fixers.functions.indexOf('linear-gradient') > -1; + var gradientDetector = /\blinear-gradient\(/; + var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig; + var gradientReplacer = function (match, delim, gradient, deg) { + return delim + gradient + (90-deg) + 'deg' + }; - // functions - var hasFunctions = !!fixers.functions.length - var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\(') - var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()') - function functionReplacer (match, $1, $2) { - return $1 + prefix + $2 - } + // functions + var hasFunctions = !!fixers.functions.length; + var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\('); + var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()'); + function functionReplacer (match, $1, $2) { + return $1 + prefix + $2 + } - // properties as values (for transition, ...) - // No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity. - var valuePropertiesMatcher = /^\s*([-\w]+)/gi - var valuePropertiesReplacer = function(match, prop){ - return fixers.properties[prop] || fixers.fixProperty(prop) - } + // properties as values (for transition, ...) + // No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity. + var valuePropertiesMatcher = /^\s*([-\w]+)/gi; + var valuePropertiesReplacer = function(match, prop){ + return fixers.properties[prop] || fixers.fixProperty(prop) + }; - fixers.fixValue = function (value, property) { - var res - if (fixers.initial != null && value === 'initial') return fixers.initial + fixers.fixValue = function (value, property) { + var res; + if (fixers.initial != null && value === 'initial') return fixers.initial - if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res + if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res - res = value + res = value; - if (fixers.valueProperties.hasOwnProperty(property)) { - res = (value.indexOf(',') === -1) ? - value.replace(valuePropertiesMatcher, valuePropertiesReplacer) : - splitValue(value).map(function(v) { - return v.replace(valuePropertiesMatcher, valuePropertiesReplacer) - }).join(',') - } + if (fixers.valueProperties.hasOwnProperty(property)) { + res = (value.indexOf(',') === -1) ? + value.replace(valuePropertiesMatcher, valuePropertiesReplacer) : + splitValue(value).map(function(v) { + return v.replace(valuePropertiesMatcher, valuePropertiesReplacer) + }).join(','); + } - if (hasFunctions && functionsDetector.test(value)) { - if (hasGradients && gradientDetector.test(value)) { - res = res.replace(gradientMatcher, gradientReplacer) - } - res = res.replace(functionsMatcher, functionReplacer) + if (hasFunctions && functionsDetector.test(value)) { + if (hasGradients && gradientDetector.test(value)) { + res = res.replace(gradientMatcher, gradientReplacer); } - return res + res = res.replace(functionsMatcher, functionReplacer); } + return res + }; - // @media (resolution:...) { - // ------------------------- + // @media (resolution:...) { + // ------------------------- - var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g - var resolutionReplacer = ( - fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} : - fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} : - function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'} - ) + var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g; + var resolutionReplacer = ( + fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} : + fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} : + function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'} + ); - fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ? - function(p) {return p} : - function (params) { - return (params.indexOf('reso') !== -1) ? - params.replace(resolutionMatcher, resolutionReplacer) : - params - } + fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ? + function(p) {return p} : + function (params) { + return (params.indexOf('reso') !== -1) ? + params.replace(resolutionMatcher, resolutionReplacer) : + params + }; - // @supports ... { - // --------------- + // @supports ... { + // --------------- - // regexp built by scripts/regexps.js - var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g - function atSupportsParamsReplacer(match, prop, value) { - return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop) - } - fixers.fixAtSupportsParams = function(params) { - return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer) - } + // regexp built by scripts/regexps.js + var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g; + function atSupportsParamsReplacer(match, prop, value) { + return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop) } - - function createPrefixPlugin() { - var fixers = blankFixers() - if (typeof getComputedStyle === 'function') browserDetector(fixers) - finalizeFixers(fixers) - - var cache = [] - - prefixPlugin.setFixers = function(f) { - if (cache.indexOf(f) === -1) { - finalizeFixers(f) - cache.push(f) - } - fixers = f - return prefixPlugin + fixers.fixAtSupportsParams = function(params) { + return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer) + }; +} + +function createPrefixPlugin() { + var fixers = blankFixers(); + if (typeof getComputedStyle === 'function') browserDetector(fixers); + finalizeFixers(fixers); + + var cache = []; + + prefixPlugin.setFixers = function(f) { + if (cache.indexOf(f) === -1) { + finalizeFixers(f); + cache.push(f); } + fixers = f; + return prefixPlugin + }; - function prefixPlugin() { - return { - $filter: function(next) { - return { - atrule: function(rule, kind, params, hasBlock) { - next.atrule( - fixers.hasAtrules && fixers.atrules[rule] || rule, - kind, - ( - rule === '@media' ? fixers.fixAtMediaParams(params) : - rule === '@supports' ? fixers.fixAtSupportsParams(params) : - params - ), - hasBlock - ) - }, - decl: function decl(property, value) { - if (property === 'flex-flow' && (fixers.flexbox2009 || fixers.flexbox2012) && typeof value === 'string') { - value.split(' ').forEach(function(v){ - // recurse! The lack of `next.` is intentional. - if (v.indexOf('wrap') > -1) decl('flex-wrap', v) - else if(v !== '') decl('flex-direction', v) - }) - } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') - } else { - next.decl( - fixers.properties[property] || fixers.fixProperty(property), - fixers.fixValue(value, property) - ) - } - }, - rule: function(selector) { - next.rule( - fixers.hasSelectors ? fixers.fixSelector(selector) : selector - ) + function prefixPlugin() { + return { + $filter: function(next) { + return { + atrule: function(rule, kind, params, hasBlock) { + next.atrule( + fixers.hasAtrules && fixers.atrules[rule] || rule, + kind, + ( + rule === '@media' ? fixers.fixAtMediaParams(params) : + rule === '@supports' ? fixers.fixAtSupportsParams(params) : + params + ), + hasBlock + ); + }, + decl: function decl(property, value) { + if (property === 'flex-flow' && (fixers.flexbox2009 || fixers.flexbox2012) && typeof value === 'string') { + value.split(' ').forEach(function(v){ + // recurse! The lack of `next.` is intentional. + if (v.indexOf('wrap') > -1) decl('flex-wrap', v); + else if(v !== '') decl('flex-direction', v); + }); + } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); + } else { + next.decl( + fixers.properties[property] || fixers.fixProperty(property), + fixers.fixValue(value, property) + ); } + }, + rule: function(selector) { + next.rule( + fixers.hasSelectors ? fixers.fixSelector(selector) : selector + ); } } } } - return prefixPlugin } + return prefixPlugin +} - var plugin = createPrefixPlugin() +var plugin$2 = createPrefixPlugin(); - return plugin; +return plugin; -}); \ No newline at end of file +}); diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index 3b0871ba..02e00812 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file +define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g;v();return plugin}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index eab48440..b0b69e52 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -5,16 +5,17 @@ var allStyles; var styleAttr; var styleElement; + function init() { - allStyles = getComputedStyle(document.documentElement, null) - styleAttr = document.createElement('div').style - styleElement = document.documentElement.appendChild(document.createElement('style')) + allStyles = getComputedStyle(document.documentElement, null); + styleAttr = document.createElement('div').style; + styleElement = document.documentElement.appendChild(document.createElement('style')); } function finalize() { - if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement) + if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); // `styleAttr` is used at run time via `supportedProperty()` // `allStyles` and `styleElement` can be displosed of after initialization. - allStyles = styleElement = null + allStyles = styleElement = null; } // Helpers, in alphabetic order @@ -26,12 +27,12 @@ function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } function supportedDecl(property, value) { - styleAttr[property] = styleAttr[deCamelCase(property)] = '' - styleAttr[property] = styleAttr[deCamelCase(property)] = value + styleAttr[property] = styleAttr[deCamelCase(property)] = ''; + styleAttr[property] = styleAttr[deCamelCase(property)] = value; return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) } function supportedMedia(condition) { - styleElement.textContent = '@media (' + condition +'){}' + styleElement.textContent = '@media (' + condition +'){}'; // Opera 11 treats unknown conditions as 'all', the rest as 'not all'. // So far tested in modern browsers (01/01/2017), and desktop IE9, FF4, // Opera 11/12, and Safari 6. TY SauceLabs. @@ -42,47 +43,53 @@ function supportedProperty(property) { return property in styleAttr || camelCase(property) in styleAttr } function supportedRule(selector) { - styleElement.textContent = selector + '{}' + styleElement.textContent = selector + '{}'; return !!styleElement.sheet.cssRules.length } +// Derived from Lea Verou's PrefixFree + +// TODO: http://caniuse.com/#feat=css-media-resolution + function detectAtrules(fixers) { if (fixers.prefix === '') return var atrules = { 'keyframes': 'name', 'viewport': null, 'document': 'regexp(".")' - } + }; // build a map of {'@ruleX': '@-prefix-ruleX'} for(var atrule in atrules) { - var test = atrule + ' ' + (atrules[atrule] || '') + var test = atrule + ' ' + (atrules[atrule] || ''); if (!supportedRule('@' + test) && supportedRule('@' + fixers.prefix + test)) { - fixers.hasAtrules = true - fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule + fixers.hasAtrules = true; + fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule; } } // Standard - fixers.hasDppx = supportedMedia('resolution:1dppx') + fixers.hasDppx = supportedMedia('resolution:1dppx'); // Webkit - fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio:1') + fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio:1'); // Opera - fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio:1/1') + fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio:1/1'); if (fixers.hasPixelRatio || fixers.hasPixelRatioFraction) { - fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio' - fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio' - fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio' + fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio'; + fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio'; + fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio'; if (supportedMedia('min-' + fixers.prefix + 'device-pixel-ratio:1')) { // Mozilla/Firefox tunred a vendor prefix into a vendor infix - fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio' - fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio' + fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio'; + fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio'; } } } +// Derived from Lea Verou's PrefixFree + function detectFunctions(fixers) { // Values that might need prefixing if (fixers.prefix === '') return @@ -103,25 +110,29 @@ function detectFunctions(fixers) { property: 'backgroundImage', params: 'url(a.png), url(b.png), 50%' } - } + }; functions['repeating-linear-gradient'] = functions['repeating-radial-gradient'] = functions['radial-gradient'] = - functions['linear-gradient'] + functions['linear-gradient']; // build an array of prefixable functions for (var func in functions) { var test = functions[func], property = test.property, - value = func + '(' + test.params + ')' + value = func + '(' + test.params + ')'; if (!supportedDecl(property, value) && supportedDecl(property, fixers.prefix + value)) { // It's only supported with a prefix - fixers.functions.push(func) + fixers.functions.push(func); } } } +// Derived from Lea Verou's PrefixFree and Robin Frischmann's Inline Style Prefixer + +// TODO: http://caniuse.com/#feat=css-writing-mode + // db of prop/value pairs whose values may need treatment. var keywords = [ @@ -143,7 +154,7 @@ var keywords = [ props: ['width', 'column-width', 'height', 'max-height', 'max-width', 'min-height', 'min-width'], values: ['contain-floats', 'fill-available', 'fit-content', 'max-content', 'min-content'] } -] +]; // The flexbox zoo // // ## Specs: @@ -163,7 +174,7 @@ var flex2009Props = { 'flex-wrap': 'box-lines', 'justify-content': 'box-pack', 'order': 'box-ordinal-group' // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025 -} +}; var flex2009Values = { // flex => box || only for display? handled in the code 'flex-end': 'end', @@ -174,7 +185,7 @@ var flex2009Values = { 'space-between': 'justify', 'wrap': 'multiple', 'wrap-reverse': 'multiple' -} +}; var flex2012Props = { 'align-content': '-ms-flex-line-pack', 'align-items': '-ms-flex-align', @@ -188,7 +199,7 @@ var flex2012Props = { // flex-wrap => -ms-flex-wrap 'justify-content': '-ms-flex-pack', 'order': '-ms-flex-order' -} +}; var flex2012Values = { // flex => flexbox || only for display? handled in the code 'flex-end': 'end', @@ -199,14 +210,14 @@ var flex2012Values = { 'space-between': 'justify' // wrap => wrap // wrap-reverse => wrap-reverse -} +}; function detectKeywords(fixers) { if (fixers.prefix === '') return // build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...} for (var i = 0; i < keywords.length; i++) { - var map = {}, property = keywords[i].props[0] + var map = {}, property = keywords[i].props[0]; // eslint-disable-next-line for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) { @@ -214,32 +225,32 @@ function detectKeywords(fixers) { !supportedDecl(property, keyword) && supportedDecl(property, fixers.prefix + keyword) ) { - fixers.hasKeywords = true - map[keyword] = fixers.prefix + keyword + fixers.hasKeywords = true; + map[keyword] = fixers.prefix + keyword; } } // eslint-disable-next-line for (j = 0; property = keywords[i].props[j]; j++) { - fixers.keywords[property] = map + fixers.keywords[property] = map; } } if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE - fixers.keywords.display.flex = fixers.keywords.display.flexbox - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] - fixers.flexbox2012 = true + fixers.keywords.display.flex = fixers.keywords.display.flexbox; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox']; + fixers.flexbox2012 = true; for (var k in flex2012Props) { - fixers.properties[k] = flex2012Props[k] - fixers.keywords[k] = flex2012Values + fixers.properties[k] = flex2012Props[k]; + fixers.keywords[k] = flex2012Values; } } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec - fixers.keywords.display.flex = fixers.keywords.display.box - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] - fixers.flexbox2009 = true + fixers.keywords.display.flex = fixers.keywords.display.box; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box']; + fixers.flexbox2009 = true; for (k in flex2009Props) { - fixers.properties[k] = fixers.prefix + flex2009Props[k] - fixers.keywords[k] = flex2009Values + fixers.properties[k] = fixers.prefix + flex2009Props[k]; + fixers.keywords[k] = flex2009Values; } } if ( @@ -247,12 +258,14 @@ function detectKeywords(fixers) { supportedDecl('color', fixers.prefix + 'initial') ) { // `initial` does not use the `hasKeywords` branch, no need to set it to true. - fixers.initial = fixers.prefix + 'initial' + fixers.initial = fixers.prefix + 'initial'; } } +// Derived from Lea Verou's PrefixFree + function detectPrefix(fixers) { - var prefixCounters = {} + var prefixCounters = {}; // Why are we doing this instead of iterating over properties in a .style object? Because Webkit. // 1. Older Webkit won't iterate over those. // 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit' @@ -260,36 +273,38 @@ function detectPrefix(fixers) { function iteration(property) { if(property.charAt(0) === '-') { - var prefix = property.split('-')[1] + var prefix = property.split('-')[1]; // Count prefix uses - prefixCounters[prefix] = ++prefixCounters[prefix] || 1 + prefixCounters[prefix] = ++prefixCounters[prefix] || 1; } } // Some browsers have numerical indices for the properties, some don't if(allStyles && allStyles.length > 0) { for(var i=0; i -1 - var gradientDetector = /\blinear-gradient\(/ - var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig + var hasGradients = fixers.functions.indexOf('linear-gradient') > -1; + var gradientDetector = /\blinear-gradient\(/; + var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig; var gradientReplacer = function (match, delim, gradient, deg) { return delim + gradient + (90-deg) + 'deg' - } + }; // functions - var hasFunctions = !!fixers.functions.length - var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\(') - var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()') + var hasFunctions = !!fixers.functions.length; + var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\('); + var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()'); function functionReplacer (match, $1, $2) { return $1 + prefix + $2 } // properties as values (for transition, ...) // No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity. - var valuePropertiesMatcher = /^\s*([-\w]+)/gi + var valuePropertiesMatcher = /^\s*([-\w]+)/gi; var valuePropertiesReplacer = function(match, prop){ return fixers.properties[prop] || fixers.fixProperty(prop) - } + }; fixers.fixValue = function (value, property) { - var res + var res; if (fixers.initial != null && value === 'initial') return fixers.initial if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res - res = value + res = value; if (fixers.valueProperties.hasOwnProperty(property)) { res = (value.indexOf(',') === -1) ? value.replace(valuePropertiesMatcher, valuePropertiesReplacer) : splitValue(value).map(function(v) { return v.replace(valuePropertiesMatcher, valuePropertiesReplacer) - }).join(',') + }).join(','); } if (hasFunctions && functionsDetector.test(value)) { if (hasGradients && gradientDetector.test(value)) { - res = res.replace(gradientMatcher, gradientReplacer) + res = res.replace(gradientMatcher, gradientReplacer); } - res = res.replace(functionsMatcher, functionReplacer) + res = res.replace(functionsMatcher, functionReplacer); } return res - } + }; // @media (resolution:...) { // ------------------------- - var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g + var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g; var resolutionReplacer = ( fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} : fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} : function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'} - ) + ); fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ? function(p) {return p} : @@ -509,37 +524,37 @@ function finalizeFixers(fixers) { return (params.indexOf('reso') !== -1) ? params.replace(resolutionMatcher, resolutionReplacer) : params - } + }; // @supports ... { // --------------- // regexp built by scripts/regexps.js - var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g + var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g; function atSupportsParamsReplacer(match, prop, value) { return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop) } fixers.fixAtSupportsParams = function(params) { return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer) - } + }; } function createPrefixPlugin() { - var fixers = blankFixers() - if (typeof getComputedStyle === 'function') browserDetector(fixers) - finalizeFixers(fixers) + var fixers = blankFixers(); + if (typeof getComputedStyle === 'function') browserDetector(fixers); + finalizeFixers(fixers); - var cache = [] + var cache = []; prefixPlugin.setFixers = function(f) { if (cache.indexOf(f) === -1) { - finalizeFixers(f) - cache.push(f) + finalizeFixers(f); + cache.push(f); } - fixers = f + fixers = f; return prefixPlugin - } + }; function prefixPlugin() { return { @@ -555,29 +570,29 @@ function createPrefixPlugin() { params ), hasBlock - ) + ); }, decl: function decl(property, value) { if (property === 'flex-flow' && (fixers.flexbox2009 || fixers.flexbox2012) && typeof value === 'string') { value.split(' ').forEach(function(v){ // recurse! The lack of `next.` is intentional. - if (v.indexOf('wrap') > -1) decl('flex-wrap', v) - else if(v !== '') decl('flex-direction', v) - }) + if (v.indexOf('wrap') > -1) decl('flex-wrap', v); + else if(v !== '') decl('flex-direction', v); + }); } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), fixers.fixValue(value, property) - ) + ); } }, rule: function(selector) { next.rule( fixers.hasSelectors ? fixers.fixSelector(selector) : selector - ) + ); } } } @@ -586,6 +601,6 @@ function createPrefixPlugin() { return prefixPlugin } -var plugin = createPrefixPlugin() +var plugin$2 = createPrefixPlugin(); -module.exports = plugin; \ No newline at end of file +module.exports = plugin; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index f3517a3a..0654280d 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],l=i.property,n=t+"("+i.params+")";!supportedDecl(l,n)&&supportedDecl(l,e.prefix+n)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var l;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(l=(e.keywords[i]||emptySet)[t])?l:(l=t,e.valueProperties.hasOwnProperty(i)&&(l=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(l=l.replace(p,u)),l=l.replace(d,r)),l)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,l,n){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(l):"@supports"===t?r.fixAtSupportsParams(l):l,n)},decl:function t(i,l){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof l?l.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof l?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),l.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),l.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(l,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],l=i.property,n=t+"("+i.params+")";!supportedDecl(l,n)&&supportedDecl(l,e.prefix+n)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var l;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(l=(e.keywords[i]||emptySet)[t])?l:(l=t,e.valueProperties.hasOwnProperty(i)&&(l=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(l=l.replace(p,u)),l=l.replace(d,r)),l)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,l,n){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(l):"@supports"===t?r.fixAtSupportsParams(l):l,n)},decl:function t(i,l){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof l?l.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof l?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),l.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),l.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(l,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin$2=createPrefixPlugin();module.exports=plugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index c7447190..1f52f671 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -1,594 +1,609 @@ var j2cPrefixPluginBrowser = (function () { - 'use strict'; - - // Derived from Lea Verou's PrefixFree - - var allStyles; - var styleAttr; - var styleElement; - function init() { - allStyles = getComputedStyle(document.documentElement, null) - styleAttr = document.createElement('div').style - styleElement = document.documentElement.appendChild(document.createElement('style')) - } - function finalize() { - if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement) - // `styleAttr` is used at run time via `supportedProperty()` - // `allStyles` and `styleElement` can be displosed of after initialization. - allStyles = styleElement = null - } - - // Helpers, in alphabetic order - - function camelCase(str) { - return str.replace(/-([a-z])/g, function($0, $1) { return $1.toUpperCase() }).replace('-','') - } - function deCamelCase(str) { - return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) - } - function supportedDecl(property, value) { - styleAttr[property] = styleAttr[deCamelCase(property)] = '' - styleAttr[property] = styleAttr[deCamelCase(property)] = value - return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) - } - function supportedMedia(condition) { - styleElement.textContent = '@media (' + condition +'){}' - // Opera 11 treats unknown conditions as 'all', the rest as 'not all'. - // So far tested in modern browsers (01/01/2017), and desktop IE9, FF4, - // Opera 11/12, and Safari 6. TY SauceLabs. - return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) - } - function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return property in styleAttr || camelCase(property) in styleAttr - } - function supportedRule(selector) { - styleElement.textContent = selector + '{}' - return !!styleElement.sheet.cssRules.length - } - - function detectAtrules(fixers) { - if (fixers.prefix === '') return - var atrules = { - 'keyframes': 'name', - 'viewport': null, - 'document': 'regexp(".")' - } - - // build a map of {'@ruleX': '@-prefix-ruleX'} - for(var atrule in atrules) { - var test = atrule + ' ' + (atrules[atrule] || '') - if (!supportedRule('@' + test) && supportedRule('@' + fixers.prefix + test)) { - - fixers.hasAtrules = true - fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule - } - } - - // Standard - fixers.hasDppx = supportedMedia('resolution:1dppx') - // Webkit - fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio:1') - // Opera - fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio:1/1') - - if (fixers.hasPixelRatio || fixers.hasPixelRatioFraction) { - fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio' - fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio' - fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio' - if (supportedMedia('min-' + fixers.prefix + 'device-pixel-ratio:1')) { - // Mozilla/Firefox tunred a vendor prefix into a vendor infix - fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio' - fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio' - } +'use strict'; + +// Derived from Lea Verou's PrefixFree + +var allStyles; +var styleAttr; +var styleElement; + +function init() { + allStyles = getComputedStyle(document.documentElement, null); + styleAttr = document.createElement('div').style; + styleElement = document.documentElement.appendChild(document.createElement('style')); +} +function finalize() { + if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); + // `styleAttr` is used at run time via `supportedProperty()` + // `allStyles` and `styleElement` can be displosed of after initialization. + allStyles = styleElement = null; +} + +// Helpers, in alphabetic order + +function camelCase(str) { + return str.replace(/-([a-z])/g, function($0, $1) { return $1.toUpperCase() }).replace('-','') +} +function deCamelCase(str) { + return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) +} +function supportedDecl(property, value) { + styleAttr[property] = styleAttr[deCamelCase(property)] = ''; + styleAttr[property] = styleAttr[deCamelCase(property)] = value; + return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) +} +function supportedMedia(condition) { + styleElement.textContent = '@media (' + condition +'){}'; + // Opera 11 treats unknown conditions as 'all', the rest as 'not all'. + // So far tested in modern browsers (01/01/2017), and desktop IE9, FF4, + // Opera 11/12, and Safari 6. TY SauceLabs. + return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) +} +function supportedProperty(property) { + // Some browsers like it dash-cased, some camelCased, most like both. + return property in styleAttr || camelCase(property) in styleAttr +} +function supportedRule(selector) { + styleElement.textContent = selector + '{}'; + return !!styleElement.sheet.cssRules.length +} + +// Derived from Lea Verou's PrefixFree + +// TODO: http://caniuse.com/#feat=css-media-resolution + +function detectAtrules(fixers) { + if (fixers.prefix === '') return + var atrules = { + 'keyframes': 'name', + 'viewport': null, + 'document': 'regexp(".")' + }; + + // build a map of {'@ruleX': '@-prefix-ruleX'} + for(var atrule in atrules) { + var test = atrule + ' ' + (atrules[atrule] || ''); + if (!supportedRule('@' + test) && supportedRule('@' + fixers.prefix + test)) { + + fixers.hasAtrules = true; + fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule; } } - function detectFunctions(fixers) { - // Values that might need prefixing - if (fixers.prefix === '') return - var functions = { - 'linear-gradient': { - property: 'backgroundImage', - params: 'red, teal' - }, - 'calc': { - property: 'width', - params: '1px + 5%' - }, - 'element': { - property: 'backgroundImage', - params: '#foo' - }, - 'cross-fade': { - property: 'backgroundImage', - params: 'url(a.png), url(b.png), 50%' - } - } - functions['repeating-linear-gradient'] = - functions['repeating-radial-gradient'] = - functions['radial-gradient'] = - functions['linear-gradient'] - - // build an array of prefixable functions - for (var func in functions) { - var test = functions[func], - property = test.property, - value = func + '(' + test.params + ')' - - if (!supportedDecl(property, value) && supportedDecl(property, fixers.prefix + value)) { - // It's only supported with a prefix - fixers.functions.push(func) - } + // Standard + fixers.hasDppx = supportedMedia('resolution:1dppx'); + // Webkit + fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio:1'); + // Opera + fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio:1/1'); + + if (fixers.hasPixelRatio || fixers.hasPixelRatioFraction) { + fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio'; + fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio'; + fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio'; + if (supportedMedia('min-' + fixers.prefix + 'device-pixel-ratio:1')) { + // Mozilla/Firefox tunred a vendor prefix into a vendor infix + fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio'; + fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio'; } } +} - // db of prop/value pairs whose values may need treatment. +// Derived from Lea Verou's PrefixFree - var keywords = [ - - // `initial` applies to all properties and is thus handled separately. - { - props: ['cursor'], - values: [ 'grab', 'grabbing', 'zoom-in', 'zoom-out'] +function detectFunctions(fixers) { + // Values that might need prefixing + if (fixers.prefix === '') return + var functions = { + 'linear-gradient': { + property: 'backgroundImage', + params: 'red, teal' }, - { - props: ['display'], - values:['box', 'inline-box', 'flexbox', 'inline-flexbox', 'flex', 'inline-flex', 'grid', 'inline-grid'] + 'calc': { + property: 'width', + params: '1px + 5%' }, - { - props: ['position'], - values: [ 'sticky' ] + 'element': { + property: 'backgroundImage', + params: '#foo' }, - { - props: ['width', 'column-width', 'height', 'max-height', 'max-width', 'min-height', 'min-width'], - values: ['contain-floats', 'fill-available', 'fit-content', 'max-content', 'min-content'] + 'cross-fade': { + property: 'backgroundImage', + params: 'url(a.png), url(b.png), 50%' + } + }; + functions['repeating-linear-gradient'] = + functions['repeating-radial-gradient'] = + functions['radial-gradient'] = + functions['linear-gradient']; + + // build an array of prefixable functions + for (var func in functions) { + var test = functions[func], + property = test.property, + value = func + '(' + test.params + ')'; + + if (!supportedDecl(property, value) && supportedDecl(property, fixers.prefix + value)) { + // It's only supported with a prefix + fixers.functions.push(func); } - ] - // The flexbox zoo - // - // ## Specs: - // - box (2009/old): https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/ - // - flexbox (2012/ie10): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/ - // - flex (final): https://www.w3.org/TR/css-flexbox-1/ - var flex2009Props = { - // ?align-content => - // ?align-self => - 'align-items': 'box-align', - 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, - // ?flex-basis => - // !!flex-direction => box-direction + box-orient, covered in `plugin.js` - // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` - // ?flex-grow => - // ?flex-shrink => - 'flex-wrap': 'box-lines', - 'justify-content': 'box-pack', - 'order': 'box-ordinal-group' // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025 - } - var flex2009Values = { - // flex => box || only for display? handled in the code - 'flex-end': 'end', - 'flex-start': 'start', - // inline-flex => inline-box || see flex - 'nowrap': 'single', - 'space-around': 'justify', - 'space-between': 'justify', - 'wrap': 'multiple', - 'wrap-reverse': 'multiple' - } - var flex2012Props = { - 'align-content': '-ms-flex-line-pack', - 'align-items': '-ms-flex-align', - 'align-self': '-ms-flex-item-align', - // flex => -ms-flex - 'flex-basis': '-ms-preferred-size', - // flex-direction => -ms-flex-direction - // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` - 'flex-grow': '-ms-flex-positive', - 'flex-shrink': '-ms-flex-negative', - // flex-wrap => -ms-flex-wrap - 'justify-content': '-ms-flex-pack', - 'order': '-ms-flex-order' } - var flex2012Values = { - // flex => flexbox || only for display? handled in the code - 'flex-end': 'end', - 'flex-start': 'start', - // inline-flex => inline-flexbox || see 'flex' - // nowrap => nowrap - 'space-around': 'distribute', - 'space-between': 'justify' - // wrap => wrap - // wrap-reverse => wrap-reverse +} + +// Derived from Lea Verou's PrefixFree and Robin Frischmann's Inline Style Prefixer + +// TODO: http://caniuse.com/#feat=css-writing-mode + +// db of prop/value pairs whose values may need treatment. + +var keywords = [ + + // `initial` applies to all properties and is thus handled separately. + { + props: ['cursor'], + values: [ 'grab', 'grabbing', 'zoom-in', 'zoom-out'] + }, + { + props: ['display'], + values:['box', 'inline-box', 'flexbox', 'inline-flexbox', 'flex', 'inline-flex', 'grid', 'inline-grid'] + }, + { + props: ['position'], + values: [ 'sticky' ] + }, + { + props: ['width', 'column-width', 'height', 'max-height', 'max-width', 'min-height', 'min-width'], + values: ['contain-floats', 'fill-available', 'fit-content', 'max-content', 'min-content'] } - - function detectKeywords(fixers) { - if (fixers.prefix === '') return - - // build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...} - for (var i = 0; i < keywords.length; i++) { - var map = {}, property = keywords[i].props[0] - // eslint-disable-next-line - for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) { - - if ( - !supportedDecl(property, keyword) && - supportedDecl(property, fixers.prefix + keyword) - ) { - fixers.hasKeywords = true - map[keyword] = fixers.prefix + keyword - } - } - // eslint-disable-next-line - for (j = 0; property = keywords[i].props[j]; j++) { - fixers.keywords[property] = map +]; +// The flexbox zoo +// +// ## Specs: +// - box (2009/old): https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/ +// - flexbox (2012/ie10): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/ +// - flex (final): https://www.w3.org/TR/css-flexbox-1/ +var flex2009Props = { + // ?align-content => + // ?align-self => + 'align-items': 'box-align', + 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, + // ?flex-basis => + // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` + // ?flex-grow => + // ?flex-shrink => + 'flex-wrap': 'box-lines', + 'justify-content': 'box-pack', + 'order': 'box-ordinal-group' // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025 +}; +var flex2009Values = { + // flex => box || only for display? handled in the code + 'flex-end': 'end', + 'flex-start': 'start', + // inline-flex => inline-box || see flex + 'nowrap': 'single', + 'space-around': 'justify', + 'space-between': 'justify', + 'wrap': 'multiple', + 'wrap-reverse': 'multiple' +}; +var flex2012Props = { + 'align-content': '-ms-flex-line-pack', + 'align-items': '-ms-flex-align', + 'align-self': '-ms-flex-item-align', + // flex => -ms-flex + 'flex-basis': '-ms-preferred-size', + // flex-direction => -ms-flex-direction + // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` + 'flex-grow': '-ms-flex-positive', + 'flex-shrink': '-ms-flex-negative', + // flex-wrap => -ms-flex-wrap + 'justify-content': '-ms-flex-pack', + 'order': '-ms-flex-order' +}; +var flex2012Values = { + // flex => flexbox || only for display? handled in the code + 'flex-end': 'end', + 'flex-start': 'start', + // inline-flex => inline-flexbox || see 'flex' + // nowrap => nowrap + 'space-around': 'distribute', + 'space-between': 'justify' + // wrap => wrap + // wrap-reverse => wrap-reverse +}; + +function detectKeywords(fixers) { + if (fixers.prefix === '') return + + // build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...} + for (var i = 0; i < keywords.length; i++) { + var map = {}, property = keywords[i].props[0]; + // eslint-disable-next-line + for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) { + + if ( + !supportedDecl(property, keyword) && + supportedDecl(property, fixers.prefix + keyword) + ) { + fixers.hasKeywords = true; + map[keyword] = fixers.prefix + keyword; } } - if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { - // old IE - fixers.keywords.display.flex = fixers.keywords.display.flexbox - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] - fixers.flexbox2012 = true - for (var k in flex2012Props) { - fixers.properties[k] = flex2012Props[k] - fixers.keywords[k] = flex2012Values - } - } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { - // old flexbox spec - fixers.keywords.display.flex = fixers.keywords.display.box - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] - fixers.flexbox2009 = true - for (k in flex2009Props) { - fixers.properties[k] = fixers.prefix + flex2009Props[k] - fixers.keywords[k] = flex2009Values - } + // eslint-disable-next-line + for (j = 0; property = keywords[i].props[j]; j++) { + fixers.keywords[property] = map; } - if ( - !supportedDecl('color', 'initial') && - supportedDecl('color', fixers.prefix + 'initial') - ) { - // `initial` does not use the `hasKeywords` branch, no need to set it to true. - fixers.initial = fixers.prefix + 'initial' + } + if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { + // old IE + fixers.keywords.display.flex = fixers.keywords.display.flexbox; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox']; + fixers.flexbox2012 = true; + for (var k in flex2012Props) { + fixers.properties[k] = flex2012Props[k]; + fixers.keywords[k] = flex2012Values; } + } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { + // old flexbox spec + fixers.keywords.display.flex = fixers.keywords.display.box; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box']; + fixers.flexbox2009 = true; + for (k in flex2009Props) { + fixers.properties[k] = fixers.prefix + flex2009Props[k]; + fixers.keywords[k] = flex2009Values; + } + } + if ( + !supportedDecl('color', 'initial') && + supportedDecl('color', fixers.prefix + 'initial') + ) { + // `initial` does not use the `hasKeywords` branch, no need to set it to true. + fixers.initial = fixers.prefix + 'initial'; } +} - function detectPrefix(fixers) { - var prefixCounters = {} - // Why are we doing this instead of iterating over properties in a .style object? Because Webkit. - // 1. Older Webkit won't iterate over those. - // 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit' - // (lower case 'w') ones are, but they don't `deCamelCase()` into a prefix that we can detect. +// Derived from Lea Verou's PrefixFree - function iteration(property) { - if(property.charAt(0) === '-') { - var prefix = property.split('-')[1] +function detectPrefix(fixers) { + var prefixCounters = {}; + // Why are we doing this instead of iterating over properties in a .style object? Because Webkit. + // 1. Older Webkit won't iterate over those. + // 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit' + // (lower case 'w') ones are, but they don't `deCamelCase()` into a prefix that we can detect. - // Count prefix uses - prefixCounters[prefix] = ++prefixCounters[prefix] || 1 - } - } + function iteration(property) { + if(property.charAt(0) === '-') { + var prefix = property.split('-')[1]; - // Some browsers have numerical indices for the properties, some don't - if(allStyles && allStyles.length > 0) { - for(var i=0; i 0) { + for(var i=0; i -1 - var gradientDetector = /\blinear-gradient\(/ - var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig - var gradientReplacer = function (match, delim, gradient, deg) { - return delim + gradient + (90-deg) + 'deg' - } + // When gradients are supported with a prefix, convert angles to legacy + // (from clockwise to trigonometric) + var hasGradients = fixers.functions.indexOf('linear-gradient') > -1; + var gradientDetector = /\blinear-gradient\(/; + var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig; + var gradientReplacer = function (match, delim, gradient, deg) { + return delim + gradient + (90-deg) + 'deg' + }; - // functions - var hasFunctions = !!fixers.functions.length - var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\(') - var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()') - function functionReplacer (match, $1, $2) { - return $1 + prefix + $2 - } + // functions + var hasFunctions = !!fixers.functions.length; + var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\('); + var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()'); + function functionReplacer (match, $1, $2) { + return $1 + prefix + $2 + } - // properties as values (for transition, ...) - // No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity. - var valuePropertiesMatcher = /^\s*([-\w]+)/gi - var valuePropertiesReplacer = function(match, prop){ - return fixers.properties[prop] || fixers.fixProperty(prop) - } + // properties as values (for transition, ...) + // No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity. + var valuePropertiesMatcher = /^\s*([-\w]+)/gi; + var valuePropertiesReplacer = function(match, prop){ + return fixers.properties[prop] || fixers.fixProperty(prop) + }; - fixers.fixValue = function (value, property) { - var res - if (fixers.initial != null && value === 'initial') return fixers.initial + fixers.fixValue = function (value, property) { + var res; + if (fixers.initial != null && value === 'initial') return fixers.initial - if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res + if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res - res = value + res = value; - if (fixers.valueProperties.hasOwnProperty(property)) { - res = (value.indexOf(',') === -1) ? - value.replace(valuePropertiesMatcher, valuePropertiesReplacer) : - splitValue(value).map(function(v) { - return v.replace(valuePropertiesMatcher, valuePropertiesReplacer) - }).join(',') - } + if (fixers.valueProperties.hasOwnProperty(property)) { + res = (value.indexOf(',') === -1) ? + value.replace(valuePropertiesMatcher, valuePropertiesReplacer) : + splitValue(value).map(function(v) { + return v.replace(valuePropertiesMatcher, valuePropertiesReplacer) + }).join(','); + } - if (hasFunctions && functionsDetector.test(value)) { - if (hasGradients && gradientDetector.test(value)) { - res = res.replace(gradientMatcher, gradientReplacer) - } - res = res.replace(functionsMatcher, functionReplacer) + if (hasFunctions && functionsDetector.test(value)) { + if (hasGradients && gradientDetector.test(value)) { + res = res.replace(gradientMatcher, gradientReplacer); } - return res + res = res.replace(functionsMatcher, functionReplacer); } + return res + }; - // @media (resolution:...) { - // ------------------------- + // @media (resolution:...) { + // ------------------------- - var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g - var resolutionReplacer = ( - fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} : - fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} : - function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'} - ) + var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g; + var resolutionReplacer = ( + fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} : + fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} : + function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'} + ); - fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ? - function(p) {return p} : - function (params) { - return (params.indexOf('reso') !== -1) ? - params.replace(resolutionMatcher, resolutionReplacer) : - params - } + fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ? + function(p) {return p} : + function (params) { + return (params.indexOf('reso') !== -1) ? + params.replace(resolutionMatcher, resolutionReplacer) : + params + }; - // @supports ... { - // --------------- + // @supports ... { + // --------------- - // regexp built by scripts/regexps.js - var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g - function atSupportsParamsReplacer(match, prop, value) { - return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop) - } - fixers.fixAtSupportsParams = function(params) { - return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer) - } + // regexp built by scripts/regexps.js + var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g; + function atSupportsParamsReplacer(match, prop, value) { + return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop) } - - function createPrefixPlugin() { - var fixers = blankFixers() - if (typeof getComputedStyle === 'function') browserDetector(fixers) - finalizeFixers(fixers) - - var cache = [] - - prefixPlugin.setFixers = function(f) { - if (cache.indexOf(f) === -1) { - finalizeFixers(f) - cache.push(f) - } - fixers = f - return prefixPlugin + fixers.fixAtSupportsParams = function(params) { + return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer) + }; +} + +function createPrefixPlugin() { + var fixers = blankFixers(); + if (typeof getComputedStyle === 'function') browserDetector(fixers); + finalizeFixers(fixers); + + var cache = []; + + prefixPlugin.setFixers = function(f) { + if (cache.indexOf(f) === -1) { + finalizeFixers(f); + cache.push(f); } + fixers = f; + return prefixPlugin + }; - function prefixPlugin() { - return { - $filter: function(next) { - return { - atrule: function(rule, kind, params, hasBlock) { - next.atrule( - fixers.hasAtrules && fixers.atrules[rule] || rule, - kind, - ( - rule === '@media' ? fixers.fixAtMediaParams(params) : - rule === '@supports' ? fixers.fixAtSupportsParams(params) : - params - ), - hasBlock - ) - }, - decl: function decl(property, value) { - if (property === 'flex-flow' && (fixers.flexbox2009 || fixers.flexbox2012) && typeof value === 'string') { - value.split(' ').forEach(function(v){ - // recurse! The lack of `next.` is intentional. - if (v.indexOf('wrap') > -1) decl('flex-wrap', v) - else if(v !== '') decl('flex-direction', v) - }) - } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') - } else { - next.decl( - fixers.properties[property] || fixers.fixProperty(property), - fixers.fixValue(value, property) - ) - } - }, - rule: function(selector) { - next.rule( - fixers.hasSelectors ? fixers.fixSelector(selector) : selector - ) + function prefixPlugin() { + return { + $filter: function(next) { + return { + atrule: function(rule, kind, params, hasBlock) { + next.atrule( + fixers.hasAtrules && fixers.atrules[rule] || rule, + kind, + ( + rule === '@media' ? fixers.fixAtMediaParams(params) : + rule === '@supports' ? fixers.fixAtSupportsParams(params) : + params + ), + hasBlock + ); + }, + decl: function decl(property, value) { + if (property === 'flex-flow' && (fixers.flexbox2009 || fixers.flexbox2012) && typeof value === 'string') { + value.split(' ').forEach(function(v){ + // recurse! The lack of `next.` is intentional. + if (v.indexOf('wrap') > -1) decl('flex-wrap', v); + else if(v !== '') decl('flex-direction', v); + }); + } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); + } else { + next.decl( + fixers.properties[property] || fixers.fixProperty(property), + fixers.fixValue(value, property) + ); } + }, + rule: function(selector) { + next.rule( + fixers.hasSelectors ? fixers.fixSelector(selector) : selector + ); } } } } - return prefixPlugin } + return prefixPlugin +} - var plugin = createPrefixPlugin() +var plugin$2 = createPrefixPlugin(); - return plugin; +return plugin; -}()); \ No newline at end of file +}()); diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index 51371afc..6f21a1e8 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file +var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g;v();return plugin}(); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz index 115534ad50dc73e56248743e8faadbbd0a4cd2ce..946b2f49eea120406aa6a0f31960f6835750fe33 100644 GIT binary patch delta 3073 zcmV+c4F2pQyABzY80000000ZS3YmXwi@vne$VcUbdfs-!MHRt0dn>{JYoo=*~ z0 z*6A)6nlH9$Ze*%FdLY|ev~r{6+>l`fZwbKc_)?hn=_cEM8WBI6*F<=6I^S-DGC}p@ zLn82tscn)_HsdwHT#Lwv677*#z7QJZ$b_x=JvKp$ZT?(daQXQD|A8;A{KFUFtCt7bMK4FA7(yQAij351fP0!d@RKTGtfd4P) zuHoPCGiQR##$w86W86OFgs`)4aBiK4HVh_%s3}}s$pEe?vQOg5C zx`ZB1gtdF03ZOR%CwW(;hK}GnN|GLI&5gGX@|6&OV9h-LxJ^Vp?oaXe-+`@jX5=cP zB|-k<5lw)<8mi>3WFU@}rhR!_kO;LjtAw=r&vP)W|>*=wa9*589=IuTcK~yZpNGrjP?iNW;cEew?Y|m4VXpyJM z7Vj7iVt^6KEdELEMe;EM1W?txNi1IET=*GceU0dFaJ}Vc9a*(~b!!hddl$Qp$2;tb z+h#h2NHG$u)CkYNbPi$et})q2J|e~HS%^WaYvUIcf29( z8yJ06U<>&Q4@jC#0Aybb0Fpp1jkLeiQ7pmJNq8uae+|hjny;5Sg_Qf(O|*pQ$RY?9 zh!rhj)-obW$cfFPWbSU-$=IwK(m}Rwbz9&45hz8GjNf#^9~Nl}TgY6edG0TwSiDVt zvaL?MD9F^3vKIcHmA}91g9N9c9)s)|)ETLk{^ivnQMzaZN697n7VwJEodkiIfu&qk z7Jg+BCJjih0J0Z=EK7!M<-^Pk^7V&*vVgrr$rd~^nhqn_Xl0a_GRiuw{Y|{?QXSj8 zrr_G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UDKor;7V@5nds93pe*k!OxS0D0 z3p@N&7f*ZkmQG!Ak&s;*>F1D4H>!}I%#w7z_M?N$Ar+NxBX)&T+zTf*(%(L`!JnP$ zYq1j=dv<$rwF-$!^#mM?SWX%rGpH`BvwtCevb)LkM(ZGbqFOXNG>m$k#O8_)=A0 z=@uO1#A+7R+nd7!AHG)s%Qf6_fQH*&syIwLEe z=}R~DtK~|_<;uVZ_5^2(iUK=^1|h4h&S~>hnFtV&DI&->a19)4qg^DEXqE^IF#f#w zr@WH8vx1$~YI>To2mVZ=L@t#tjo4uPpz~V@vBQ1=D3#Nsi2{r|LJ_`fK?jScnsb58 zqWPLIX!js9mw_Bhe`VkI(`^PF^Cwpx%H_>26jzg!+AGm8 zAuU`ilGh{_GK+FqF~BiVXf0wtmtRFi0Seo@JPI$|)%bj+PK$@WnnH box || only for display? handled in the code 'flex-end': 'end', @@ -182,7 +195,7 @@ var flex2009Values = { 'space-between': 'justify', 'wrap': 'multiple', 'wrap-reverse': 'multiple' -} +}; var flex2012Props = { 'align-content': '-ms-flex-line-pack', 'align-items': '-ms-flex-align', @@ -196,7 +209,7 @@ var flex2012Props = { // flex-wrap => -ms-flex-wrap 'justify-content': '-ms-flex-pack', 'order': '-ms-flex-order' -} +}; var flex2012Values = { // flex => flexbox || only for display? handled in the code 'flex-end': 'end', @@ -207,14 +220,14 @@ var flex2012Values = { 'space-between': 'justify' // wrap => wrap // wrap-reverse => wrap-reverse -} +}; function detectKeywords(fixers) { if (fixers.prefix === '') return // build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...} for (var i = 0; i < keywords.length; i++) { - var map = {}, property = keywords[i].props[0] + var map = {}, property = keywords[i].props[0]; // eslint-disable-next-line for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) { @@ -222,32 +235,32 @@ function detectKeywords(fixers) { !supportedDecl(property, keyword) && supportedDecl(property, fixers.prefix + keyword) ) { - fixers.hasKeywords = true - map[keyword] = fixers.prefix + keyword + fixers.hasKeywords = true; + map[keyword] = fixers.prefix + keyword; } } // eslint-disable-next-line for (j = 0; property = keywords[i].props[j]; j++) { - fixers.keywords[property] = map + fixers.keywords[property] = map; } } if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) { // old IE - fixers.keywords.display.flex = fixers.keywords.display.flexbox - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'] - fixers.flexbox2012 = true + fixers.keywords.display.flex = fixers.keywords.display.flexbox; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox']; + fixers.flexbox2012 = true; for (var k in flex2012Props) { - fixers.properties[k] = flex2012Props[k] - fixers.keywords[k] = flex2012Values + fixers.properties[k] = flex2012Props[k]; + fixers.keywords[k] = flex2012Values; } } else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) { // old flexbox spec - fixers.keywords.display.flex = fixers.keywords.display.box - fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'] - fixers.flexbox2009 = true + fixers.keywords.display.flex = fixers.keywords.display.box; + fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box']; + fixers.flexbox2009 = true; for (k in flex2009Props) { - fixers.properties[k] = fixers.prefix + flex2009Props[k] - fixers.keywords[k] = flex2009Values + fixers.properties[k] = fixers.prefix + flex2009Props[k]; + fixers.keywords[k] = flex2009Values; } } if ( @@ -255,12 +268,14 @@ function detectKeywords(fixers) { supportedDecl('color', fixers.prefix + 'initial') ) { // `initial` does not use the `hasKeywords` branch, no need to set it to true. - fixers.initial = fixers.prefix + 'initial' + fixers.initial = fixers.prefix + 'initial'; } } +// Derived from Lea Verou's PrefixFree + function detectPrefix(fixers) { - var prefixCounters = {} + var prefixCounters = {}; // Why are we doing this instead of iterating over properties in a .style object? Because Webkit. // 1. Older Webkit won't iterate over those. // 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit' @@ -268,36 +283,38 @@ function detectPrefix(fixers) { function iteration(property) { if(property.charAt(0) === '-') { - var prefix = property.split('-')[1] + var prefix = property.split('-')[1]; // Count prefix uses - prefixCounters[prefix] = ++prefixCounters[prefix] || 1 + prefixCounters[prefix] = ++prefixCounters[prefix] || 1; } } // Some browsers have numerical indices for the properties, some don't if(allStyles && allStyles.length > 0) { for(var i=0; i -1 - var gradientDetector = /\blinear-gradient\(/ - var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig + var hasGradients = fixers.functions.indexOf('linear-gradient') > -1; + var gradientDetector = /\blinear-gradient\(/; + var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig; var gradientReplacer = function (match, delim, gradient, deg) { return delim + gradient + (90-deg) + 'deg' - } + }; // functions - var hasFunctions = !!fixers.functions.length - var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\(') - var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()') + var hasFunctions = !!fixers.functions.length; + var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\('); + var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()'); function functionReplacer (match, $1, $2) { return $1 + prefix + $2 } // properties as values (for transition, ...) // No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity. - var valuePropertiesMatcher = /^\s*([-\w]+)/gi + var valuePropertiesMatcher = /^\s*([-\w]+)/gi; var valuePropertiesReplacer = function(match, prop){ return fixers.properties[prop] || fixers.fixProperty(prop) - } + }; fixers.fixValue = function (value, property) { - var res + var res; if (fixers.initial != null && value === 'initial') return fixers.initial if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res - res = value + res = value; if (fixers.valueProperties.hasOwnProperty(property)) { res = (value.indexOf(',') === -1) ? value.replace(valuePropertiesMatcher, valuePropertiesReplacer) : splitValue(value).map(function(v) { return v.replace(valuePropertiesMatcher, valuePropertiesReplacer) - }).join(',') + }).join(','); } if (hasFunctions && functionsDetector.test(value)) { if (hasGradients && gradientDetector.test(value)) { - res = res.replace(gradientMatcher, gradientReplacer) + res = res.replace(gradientMatcher, gradientReplacer); } - res = res.replace(functionsMatcher, functionReplacer) + res = res.replace(functionsMatcher, functionReplacer); } return res - } + }; // @media (resolution:...) { // ------------------------- - var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g + var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g; var resolutionReplacer = ( fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} : fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} : function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'} - ) + ); fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ? function(p) {return p} : @@ -517,37 +534,37 @@ function finalizeFixers(fixers) { return (params.indexOf('reso') !== -1) ? params.replace(resolutionMatcher, resolutionReplacer) : params - } + }; // @supports ... { // --------------- // regexp built by scripts/regexps.js - var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g + var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g; function atSupportsParamsReplacer(match, prop, value) { return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop) } fixers.fixAtSupportsParams = function(params) { return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer) - } + }; } function createPrefixPlugin() { - var fixers = blankFixers() - if (typeof getComputedStyle === 'function') browserDetector(fixers) - finalizeFixers(fixers) + var fixers = blankFixers(); + if (typeof getComputedStyle === 'function') browserDetector(fixers); + finalizeFixers(fixers); - var cache = [] + var cache = []; prefixPlugin.setFixers = function(f) { if (cache.indexOf(f) === -1) { - finalizeFixers(f) - cache.push(f) + finalizeFixers(f); + cache.push(f); } - fixers = f + fixers = f; return prefixPlugin - } + }; function prefixPlugin() { return { @@ -563,29 +580,29 @@ function createPrefixPlugin() { params ), hasBlock - ) + ); }, decl: function decl(property, value) { if (property === 'flex-flow' && (fixers.flexbox2009 || fixers.flexbox2012) && typeof value === 'string') { value.split(' ').forEach(function(v){ // recurse! The lack of `next.` is intentional. - if (v.indexOf('wrap') > -1) decl('flex-wrap', v) - else if(v !== '') decl('flex-direction', v) - }) + if (v.indexOf('wrap') > -1) decl('flex-wrap', v); + else if(v !== '') decl('flex-direction', v); + }); } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), fixers.fixValue(value, property) - ) + ); } }, rule: function(selector) { next.rule( fixers.hasSelectors ? fixers.fixSelector(selector) : selector - ) + ); } } } @@ -594,7 +611,11 @@ function createPrefixPlugin() { return prefixPlugin } -var plugin = createPrefixPlugin() +var plugin = createPrefixPlugin(); + +// Once built as 'exposed.js' by '../scripts/build.js', this script +// exposes every relevant function from the plugin, including private +// ones, for testing. exports.blankFixers = blankFixers; exports.finalizeFixers = finalizeFixers; @@ -615,4 +636,4 @@ exports.flex2009Values = flex2009Values; exports.flex2012Props = flex2012Props; exports.flex2012Values = flex2012Values; exports.detectPrefix = detectPrefix; -exports.detectSelectors = detectSelectors; \ No newline at end of file +exports.detectSelectors = detectSelectors; From f85aa4c3cf3c554fbae973c9894b327f2aebc132 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 10 Jan 2017 23:09:05 +0100 Subject: [PATCH 139/244] [prefix-plugin] Use distinct ospec instances --- plugins/prefix-browser/test-utils/ospec-instance.js | 4 ++++ plugins/prefix-browser/test-utils/tests/test-mocks.js | 4 +++- plugins/prefix-browser/tests/test-detector-atrules.js | 2 +- plugins/prefix-browser/tests/test-detector-functions.js | 2 +- plugins/prefix-browser/tests/test-detector-keywords.js | 2 +- plugins/prefix-browser/tests/test-detector-prefix.js | 2 +- plugins/prefix-browser/tests/test-detector-properties.js | 2 +- plugins/prefix-browser/tests/test-detector-selectors.js | 2 +- plugins/prefix-browser/tests/test-detector-utils.js | 2 +- plugins/prefix-browser/tests/test-plugin-at-media-params.js | 2 +- .../prefix-browser/tests/test-plugin-at-supports-params.js | 2 +- plugins/prefix-browser/tests/test-plugin-atrules.js | 2 +- plugins/prefix-browser/tests/test-plugin-misc.js | 2 +- plugins/prefix-browser/tests/test-plugin-properties.js | 2 +- plugins/prefix-browser/tests/test-plugin-selectors.js | 2 +- plugins/prefix-browser/tests/test-plugin-values-complex.js | 2 +- plugins/prefix-browser/tests/test-plugin-values-functions.js | 2 +- plugins/prefix-browser/tests/test-plugin-values-keywords.js | 2 +- plugins/prefix-browser/tests/test-plugin-values-properties.js | 2 +- 19 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 plugins/prefix-browser/test-utils/ospec-instance.js diff --git a/plugins/prefix-browser/test-utils/ospec-instance.js b/plugins/prefix-browser/test-utils/ospec-instance.js new file mode 100644 index 00000000..ce598b2d --- /dev/null +++ b/plugins/prefix-browser/test-utils/ospec-instance.js @@ -0,0 +1,4 @@ +var ospec = require("ospec") + +var o = module.exports = ospec['new']("prefix-plugin-browser") +ospec("$$prefix-plugin-browser", o.run) \ No newline at end of file diff --git a/plugins/prefix-browser/test-utils/tests/test-mocks.js b/plugins/prefix-browser/test-utils/tests/test-mocks.js index 153bb200..3c2521e1 100644 --- a/plugins/prefix-browser/test-utils/tests/test-mocks.js +++ b/plugins/prefix-browser/test-utils/tests/test-mocks.js @@ -1,4 +1,6 @@ -var o = require('ospec') +var ospec = require('ospec') +var o = ospec['new']('plugin-prefix-browser test-utils') +ospec('plugin-prefix-browser test-utils', o.run) var mocks = require('../mocks') diff --git a/plugins/prefix-browser/tests/test-detector-atrules.js b/plugins/prefix-browser/tests/test-detector-atrules.js index 8716d408..13ef59d9 100644 --- a/plugins/prefix-browser/tests/test-detector-atrules.js +++ b/plugins/prefix-browser/tests/test-detector-atrules.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-detector-functions.js b/plugins/prefix-browser/tests/test-detector-functions.js index 12fcf3d2..f8ee5c6e 100644 --- a/plugins/prefix-browser/tests/test-detector-functions.js +++ b/plugins/prefix-browser/tests/test-detector-functions.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-detector-keywords.js b/plugins/prefix-browser/tests/test-detector-keywords.js index b6bea899..de755d61 100644 --- a/plugins/prefix-browser/tests/test-detector-keywords.js +++ b/plugins/prefix-browser/tests/test-detector-keywords.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-detector-prefix.js b/plugins/prefix-browser/tests/test-detector-prefix.js index e7ad2fe5..388b194c 100644 --- a/plugins/prefix-browser/tests/test-detector-prefix.js +++ b/plugins/prefix-browser/tests/test-detector-prefix.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-detector-properties.js b/plugins/prefix-browser/tests/test-detector-properties.js index 06cbe3a1..e037ddc8 100644 --- a/plugins/prefix-browser/tests/test-detector-properties.js +++ b/plugins/prefix-browser/tests/test-detector-properties.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-detector-selectors.js b/plugins/prefix-browser/tests/test-detector-selectors.js index 65abc0c7..4c923f60 100644 --- a/plugins/prefix-browser/tests/test-detector-selectors.js +++ b/plugins/prefix-browser/tests/test-detector-selectors.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-detector-utils.js b/plugins/prefix-browser/tests/test-detector-utils.js index 4f2068fb..77d0978b 100644 --- a/plugins/prefix-browser/tests/test-detector-utils.js +++ b/plugins/prefix-browser/tests/test-detector-utils.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-at-media-params.js b/plugins/prefix-browser/tests/test-plugin-at-media-params.js index 2e192fa9..c3b734c7 100644 --- a/plugins/prefix-browser/tests/test-plugin-at-media-params.js +++ b/plugins/prefix-browser/tests/test-plugin-at-media-params.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-at-supports-params.js b/plugins/prefix-browser/tests/test-plugin-at-supports-params.js index c23d1297..dd235872 100644 --- a/plugins/prefix-browser/tests/test-plugin-at-supports-params.js +++ b/plugins/prefix-browser/tests/test-plugin-at-supports-params.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-atrules.js b/plugins/prefix-browser/tests/test-plugin-atrules.js index 3ee1287b..2a8531c4 100644 --- a/plugins/prefix-browser/tests/test-plugin-atrules.js +++ b/plugins/prefix-browser/tests/test-plugin-atrules.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-misc.js b/plugins/prefix-browser/tests/test-plugin-misc.js index 7033dbee..2bfef28b 100644 --- a/plugins/prefix-browser/tests/test-plugin-misc.js +++ b/plugins/prefix-browser/tests/test-plugin-misc.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var upToDate = require('../test-utils/misc').upToDate diff --git a/plugins/prefix-browser/tests/test-plugin-properties.js b/plugins/prefix-browser/tests/test-plugin-properties.js index dcf43b75..26df3841 100644 --- a/plugins/prefix-browser/tests/test-plugin-properties.js +++ b/plugins/prefix-browser/tests/test-plugin-properties.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-selectors.js b/plugins/prefix-browser/tests/test-plugin-selectors.js index 375da1f7..40fbf1fd 100644 --- a/plugins/prefix-browser/tests/test-plugin-selectors.js +++ b/plugins/prefix-browser/tests/test-plugin-selectors.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-values-complex.js b/plugins/prefix-browser/tests/test-plugin-values-complex.js index db1b1bc9..4f03d069 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-complex.js +++ b/plugins/prefix-browser/tests/test-plugin-values-complex.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-values-functions.js b/plugins/prefix-browser/tests/test-plugin-values-functions.js index ea73968a..50db5f2a 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-functions.js +++ b/plugins/prefix-browser/tests/test-plugin-values-functions.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-values-keywords.js b/plugins/prefix-browser/tests/test-plugin-values-keywords.js index f5ca622e..bbb0a161 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-keywords.js +++ b/plugins/prefix-browser/tests/test-plugin-values-keywords.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') diff --git a/plugins/prefix-browser/tests/test-plugin-values-properties.js b/plugins/prefix-browser/tests/test-plugin-values-properties.js index e8474a4c..7a1b22f3 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-properties.js +++ b/plugins/prefix-browser/tests/test-plugin-values-properties.js @@ -1,4 +1,4 @@ -var o = require('ospec') +var o = require('../test-utils/ospec-instance') var cleanupIfNeeded = require('../test-utils/misc').cleanupIfNeeded var exposed = require('../test-utils/exposed') From 57ae7a796af3db766df44cbbeadd17b02bc369d7 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 10 Jan 2017 23:10:21 +0100 Subject: [PATCH 140/244] [prefix-plugin] simplify command forwarding --- plugins/prefix-browser/package.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/prefix-browser/package.json b/plugins/prefix-browser/package.json index 43e01b25..3939c3bd 100644 --- a/plugins/prefix-browser/package.json +++ b/plugins/prefix-browser/package.json @@ -4,12 +4,10 @@ "description": "Vendor prefix handling for j2c in the browser, built on top of Lea Verou's PrefixFree", "main": "index.js", "scripts": { - "all": "yarn run lint && yarn run build && yarn run test", + "all": "yarn run go lint && yarn run build && yarn run go test", "build": "rm -f dist/*.js dist/*.gz && node scripts/build.js", - "dev": "yarn run build && yarn run test", - "cover": "cd ../.. && yarn run cover", - "lint": "cd ../.. && yarn run lint", - "test": "cd ../.. && yarn run test" + "dev": "yarn run build && yarn go test", + "go": "cd ../.. && yarn" }, "keywords": [ "prefixfree", @@ -31,7 +29,7 @@ "nodegit": "^0.8.0", "recast": "^0.11.2", "rimraf": "^2.5.0", - "rollup": "^0.25.4", + "rollup": "^0.41.1", "uglify-js": "^2.6.2" } } From f2dbb8ee730ca397ffe4298dfe742a07e8952f1f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 10 Jan 2017 23:51:45 +0100 Subject: [PATCH 141/244] [prefix-plugin] pre-cache 2009 flexbox properties --- dist/j2c.amd.js | 5 +---- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 5 +---- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 5 +---- dist/j2c.global.js | 5 +---- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 2433 -> 2424 bytes .../dist/j2c-plugin-prefix-browser.amd.js | 8 +++++--- .../dist/j2c-plugin-prefix-browser.amd.min.js | 2 +- .../j2c-plugin-prefix-browser.commonjs.js | 8 +++++--- .../j2c-plugin-prefix-browser.commonjs.min.js | 2 +- .../dist/j2c-plugin-prefix-browser.global.js | 8 +++++--- .../j2c-plugin-prefix-browser.global.min.js | 2 +- ...j2c-plugin-prefix-browser.global.min.js.gz | Bin 3084 -> 3085 bytes .../prefix-browser/src/detectors/keywords.js | 2 ++ plugins/prefix-browser/src/plugin.js | 4 ++-- plugins/prefix-browser/test-utils/exposed.js | 6 ++++-- plugins/prefix-browser/tests/index.html | 4 ++-- src/main.js | 5 +---- 20 files changed, 36 insertions(+), 41 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index e4d7480e..cc3f53ab 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -512,10 +512,6 @@ function j2c() { Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36), - use: function() { - _use(emptyArray.slice.call(arguments)); - return _instance - }, $plugins: [], sheet: function(tree) { var emit = _createOrRetrieveStream(0); @@ -653,6 +649,7 @@ function j2c() { return ignore || global$$1 || dot + _localize(name) } + _use(emptyArray.slice.call(arguments)); return _instance } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index c2fbcffa..db2b128c 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n){for(var t in n)b.call(n,t)&&(!t.indexOf("$")||t in e||(e[t]=n[t]));return e}function n(e,n){var t,r,l=[];for(r in n)if(b.call(n,r))for(t in e)b.call(e,t)&&l.push(e[t]+n[r]);return l}function t(e){for(var n,t=[],r=[],l=0;n=A.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;t.push(n.index)}for(n=t.length;n--;)r.unshift(e.slice(t[n]+1)),e=e.slice(0,t[n]);return r.unshift(e),r}function r(e,t){for(var r,l,a=[],i=[];l=Z.exec(e);)"&"==l[0]&&a.push(l.index);for(l=a.length;l--;)i.unshift(e.slice(a[l]+1)),e=e.slice(0,a[l]);for(i.unshift(e),1===i.length&&i.unshift(""),r=[i[0]],l=1;l0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(i))if(s||(s=1,t.rule(n)),/\$/.test(i))for(c in i=i.split("$"))own.call(i,c)&&declarations(e,t,i[c],o,a);else declarations(e,t,i,o,a);else/^@/.test(i)?(s=0,atRules(e,t,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(i)||[i,"@","",""],o,n,a,l)):(s=0,rules(e,t,n.length>0&&(/,/.test(n)||/,/.test(i))?(c=splitSelector(n),splitSelector(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i).map(function(e){return/&/.test(e)?ampersand(e,c):c.map(function(t){return t+e}).join(",")}).join(",")):/&/.test(i)?ampersand(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i,[n]):n+(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i),o,a,l+1));break;case ARRAY:for(i=0;i0&&/^[-\w$]+$/.test(i))if(s||(s=1,t.rule(n)),/\$/.test(i))for(c in i=i.split("$"))own.call(i,c)&&declarations(e,t,i[c],o,a);else declarations(e,t,i,o,a);else/^@/.test(i)?(s=0,atRules(e,t,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(i)||[i,"@","",""],o,n,a,l)):(s=0,rules(e,t,n.length>0&&(/,/.test(n)||/,/.test(i))?(c=splitSelector(n),splitSelector(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i).map(function(e){return/&/.test(e)?ampersand(e,c):c.map(function(t){return t+e}).join(",")}).join(",")):/&/.test(i)?ampersand(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i,[n]):n+(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i),o,a,l+1));break;case ARRAY:for(i=0;i0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f8~ zS{0cl(}q6a9%qui(Ra-YFm-TG`UdHgcI_B8rnKDpFQSk$bHkMJc|qf*bYRs29O@S8a?cU&bnF zHHl7>_IP&(uo^Tmg?~hJGnLW%fPdu~oSD*UU+8S($@nIrFIie~;*n7J{&cB$`ek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dO1K9;V_Fc-EG@8 z+aSxPYQ1~nQa63Z{cGz56>WnhjEF(H-HLDCmc`g5B|%ooEY)6|*eTE@_l60(q5Y{% zmk*}9>0dXvGrTj(L&1??n?p0kdA)T|uv2*hl)WKO+Aj0KDNSD%w)g7wb-lzgvnU!G z*f4C(;Tiu~{0t2;7=RZZ;r9>@4|c3IaD<4^_jgkbq0r5di*|;@dHDgaJDxr6Ent@P z@QqzvY04hV4M=mk2bk$kt|r`L>^JL+0JptYq zBG-*Upuf8eVh~P%9$cJ}!3zn=lz{0tOiqR5mx8yYC5PjkCz5(Hknu6o|B|JF-Z4g7 zrZ9ehwwN4`H3sex&fa_U&@y^Sb+~0V0fZI%@(eY{03(D@cSIo+8Nw`ZLb6zZug1jx zSE@HbE=us;FL!T$dHd!scW>WZn^gsqW%&fnVH>gD>o*i{6@G3iwyTcJ?g01btuJOL z=pdH|Hr$Hcx{y@}_N+FX>mw)IkeA*~3t#Q34Rmeqp*aR3u!Fh zbFOX@sq}7pIngmIfEo1p$}+pcGN1$NR!~zld=Kn>6u+ES@eqRCErr^--{l9^yC?|v zO~8~EdW8k`?!f*hmX`LAu*XOob#A{egT|WeO|YaUhqdeWN|Z7;CrG@J`wn$af?bw4 z_rUYeq|7x&-U>_UQ?zRF2MpYifZ3vX21)zo8Sgv4H!n|sJ)qvC z)rY>2K^g`mp>Atx}LH&cE}zK5wB195FD70W(ScXZlF!10SQw=+DwVL{NL3 zL5PW$+G4%7#s#xm*w$a3YnyXOGmh1#7ju~Hv9LYB57>Hh0M>s18VRJ%lNbO1U$V9z diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index a3191e9f..15e8b4de 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -168,6 +168,8 @@ var flex2009Props = { 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, // ?flex-basis => // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + 'box-direction' : 'box-direction', // we prepopulate the cache for the above case. + 'box-orient': 'box-orient', // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` // ?flex-grow => // ?flex-shrink => @@ -580,8 +582,8 @@ function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v); }); } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); + next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), @@ -601,7 +603,7 @@ function createPrefixPlugin() { return prefixPlugin } -var plugin$2 = createPrefixPlugin(); +var plugin = createPrefixPlugin(); return plugin; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index 02e00812..e6f3bb3d 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g;v();return plugin}); \ No newline at end of file +define(function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in w||i(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index b0b69e52..e35ee274 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -168,6 +168,8 @@ var flex2009Props = { 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, // ?flex-basis => // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + 'box-direction' : 'box-direction', // we prepopulate the cache for the above case. + 'box-orient': 'box-orient', // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` // ?flex-grow => // ?flex-shrink => @@ -580,8 +582,8 @@ function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v); }); } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); + next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), @@ -601,6 +603,6 @@ function createPrefixPlugin() { return prefixPlugin } -var plugin$2 = createPrefixPlugin(); +var plugin = createPrefixPlugin(); module.exports = plugin; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index 0654280d..520f1dac 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],l=i.property,n=t+"("+i.params+")";!supportedDecl(l,n)&&supportedDecl(l,e.prefix+n)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var l;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(l=(e.keywords[i]||emptySet)[t])?l:(l=t,e.valueProperties.hasOwnProperty(i)&&(l=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(l=l.replace(p,u)),l=l.replace(d,r)),l)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,l,n){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(l):"@supports"===t?r.fixAtSupportsParams(l):l,n)},decl:function t(i,l){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof l?l.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof l?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),l.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),l.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(l,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin$2=createPrefixPlugin();module.exports=plugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],l=i.property,n=t+"("+i.params+")";!supportedDecl(l,n)&&supportedDecl(l,e.prefix+n)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var l;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(l=(e.keywords[i]||emptySet)[t])?l:(l=t,e.valueProperties.hasOwnProperty(i)&&(l=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(l=l.replace(p,u)),l=l.replace(d,r)),l)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,l,n){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(l):"@supports"===t?r.fixAtSupportsParams(l):l,n)},decl:function t(i,l){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof l?l.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof l?(e.decl(r.properties["box-orient"],l.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],l.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(l,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index 1f52f671..2c4b5649 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -169,6 +169,8 @@ var flex2009Props = { 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, // ?flex-basis => // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + 'box-direction' : 'box-direction', // we prepopulate the cache for the above case. + 'box-orient': 'box-orient', // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` // ?flex-grow => // ?flex-shrink => @@ -581,8 +583,8 @@ function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v); }); } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); + next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), @@ -602,7 +604,7 @@ function createPrefixPlugin() { return prefixPlugin } -var plugin$2 = createPrefixPlugin(); +var plugin = createPrefixPlugin(); return plugin; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index 6f21a1e8..3a908999 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -var j2cPrefixPluginBrowser=function(){"use strict";function e(){w=getComputedStyle(document.documentElement,null),b=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),w=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return b[e]=b[n(e)]="",b[e]=b[n(e)]=r,!(!b[e]&&!b[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in b||i(e)in b}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var w=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(w,b):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"]||r.fixProperty("box-orient"),t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"]||r.fixProperty("box-direction"),t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var w,b,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g;v();return plugin}(); \ No newline at end of file +var j2cPrefixPluginBrowser=function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in w||i(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz index 946b2f49eea120406aa6a0f31960f6835750fe33..d342040b8280fc27073ecc77549c1294fde122b7 100644 GIT binary patch literal 3085 zcmV+o4D$0IiwFP!000001LYZOk0QD8uYhx5+k?A-lP=OV>tiRIJt@kqZnTr+Lx7bU z+JKkF-Ey0O*@6F_D)-CHFuM~a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FKYUWtYYY2jj#ye6@bS(M9)0gj16YZ3do{9RNOps=0GqwvC)8lSIp@z7UO zD6x!6ifiLEd|V6FP`d^_e15BWF3kav3Aul^HR1~vIkETnH<1s#H})u-md!>!c`lm` aXc(Z}R~ad@|L4UC0RIN9X5ufAApii6Jl5U- diff --git a/plugins/prefix-browser/src/detectors/keywords.js b/plugins/prefix-browser/src/detectors/keywords.js index 920cc118..245cee5e 100644 --- a/plugins/prefix-browser/src/detectors/keywords.js +++ b/plugins/prefix-browser/src/detectors/keywords.js @@ -39,6 +39,8 @@ export var flex2009Props = { 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, // ?flex-basis => // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + 'box-direction' : 'box-direction', // we prepopulate the cache for the above case. + 'box-orient': 'box-orient', // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` // ?flex-grow => // ?flex-shrink => diff --git a/plugins/prefix-browser/src/plugin.js b/plugins/prefix-browser/src/plugin.js index 4566aa70..ed5ba4b5 100644 --- a/plugins/prefix-browser/src/plugin.js +++ b/plugins/prefix-browser/src/plugin.js @@ -41,8 +41,8 @@ export function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v) }) } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') + next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis') + next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal') } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), diff --git a/plugins/prefix-browser/test-utils/exposed.js b/plugins/prefix-browser/test-utils/exposed.js index 0e897b74..2bdd4c94 100644 --- a/plugins/prefix-browser/test-utils/exposed.js +++ b/plugins/prefix-browser/test-utils/exposed.js @@ -178,6 +178,8 @@ var flex2009Props = { 'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025, // ?flex-basis => // !!flex-direction => box-direction + box-orient, covered in `plugin.js` + 'box-direction' : 'box-direction', // we prepopulate the cache for the above case. + 'box-orient': 'box-orient', // !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js` // ?flex-grow => // ?flex-shrink => @@ -590,8 +592,8 @@ function createPrefixPlugin() { else if(v !== '') decl('flex-direction', v); }); } else if (property === 'flex-direction' && fixers.flexbox2009 && typeof value === 'string') { - next.decl(fixers.properties['box-orient'] || fixers.fixProperty('box-orient'), value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); - next.decl(fixers.properties['box-direction'] || fixers.fixProperty('box-direction'), value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); + next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis'); + next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal'); } else { next.decl( fixers.properties[property] || fixers.fixProperty(property), diff --git a/plugins/prefix-browser/tests/index.html b/plugins/prefix-browser/tests/index.html index 072f53aa..d5963a72 100644 --- a/plugins/prefix-browser/tests/index.html +++ b/plugins/prefix-browser/tests/index.html @@ -73,8 +73,8 @@ decl: function (prop, value) {buf.push(indent, prop, prop && ': ', value, ';', '\n')} }} -var rawstyler = j2c().use(sink) -var prefixer = j2c().use(j2cPrefixPluginBrowser, sink) +var rawstyler = j2c(sink) +var prefixer = j2c(j2cPrefixPluginBrowser, sink) source.value = '// raw (this isn\'t live)\n' + rawstyler.sheet(src) prefixed.value = '//prefixed\n' + prefixer.sheet(src) diff --git a/src/main.js b/src/main.js index 256bf2a7..0881be4b 100644 --- a/src/main.js +++ b/src/main.js @@ -49,10 +49,6 @@ export default function j2c() { Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36), - use: function() { - _use(emptyArray.slice.call(arguments)) - return _instance - }, $plugins: [], sheet: function(tree) { var emit = _createOrRetrieveStream(0) @@ -190,6 +186,7 @@ export default function j2c() { return ignore || global || dot + _localize(name) } + _use(emptyArray.slice.call(arguments)) return _instance } From af93de6cf993c30b78ab3abdb5c839ffeb16493b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Tue, 10 Jan 2017 23:57:48 +0100 Subject: [PATCH 142/244] [prefix-plugin] Attempt at fixing issues with supportedDecl --- .../dist/j2c-plugin-prefix-browser.amd.js | 5 +++-- .../dist/j2c-plugin-prefix-browser.amd.min.js | 2 +- .../j2c-plugin-prefix-browser.commonjs.js | 5 +++-- .../j2c-plugin-prefix-browser.commonjs.min.js | 2 +- .../dist/j2c-plugin-prefix-browser.global.js | 5 +++-- .../j2c-plugin-prefix-browser.global.min.js | 2 +- ...j2c-plugin-prefix-browser.global.min.js.gz | Bin 3085 -> 3101 bytes plugins/prefix-browser/src/detectors/utils.js | 12 +++++++++--- plugins/prefix-browser/test-utils/exposed.js | 5 +++-- .../test-utils/tests/test-mocks.js | 5 +++-- .../tests/test-detector-properties.js | 2 +- 11 files changed, 28 insertions(+), 17 deletions(-) diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index 15e8b4de..8ed71cee 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -5,11 +5,13 @@ define(function () { 'use strict'; var allStyles; var styleAttr; var styleElement; +var convert; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); + convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -17,7 +19,6 @@ function finalize() { // `allStyles` and `styleElement` can be displosed of after initialization. allStyles = styleElement = null; } - // Helpers, in alphabetic order function camelCase(str) { @@ -40,7 +41,7 @@ function supportedMedia(condition) { } function supportedProperty(property) { // Some browsers like it dash-cased, some camelCased, most like both. - return property in styleAttr || camelCase(property) in styleAttr + return convert(property) in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index e6f3bb3d..3484f0a9 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in w||i(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}); \ No newline at end of file +define(function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style")),S="zIndex"in w?function(e){return e}:n}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return S(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||E)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S,P=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],R={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},A={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},j={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},C={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},E={},M=/[(),]|\/\*[\s\S]*?\*\//g,O=v();return O}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index e35ee274..b5c77cc3 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -5,11 +5,13 @@ var allStyles; var styleAttr; var styleElement; +var convert; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); + convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -17,7 +19,6 @@ function finalize() { // `allStyles` and `styleElement` can be displosed of after initialization. allStyles = styleElement = null; } - // Helpers, in alphabetic order function camelCase(str) { @@ -40,7 +41,7 @@ function supportedMedia(condition) { } function supportedProperty(property) { // Some browsers like it dash-cased, some camelCased, most like both. - return property in styleAttr || camelCase(property) in styleAttr + return convert(property) in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index 520f1dac..a129b66c 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style"))}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return e in styleAttr||camelCase(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],l=i.property,n=t+"("+i.params+")";!supportedDecl(l,n)&&supportedDecl(l,e.prefix+n)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var l;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(l=(e.keywords[i]||emptySet)[t])?l:(l=t,e.valueProperties.hasOwnProperty(i)&&(l=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(l=l.replace(p,u)),l=l.replace(d,r)),l)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,l,n){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(l):"@supports"===t?r.fixAtSupportsParams(l):l,n)},decl:function t(i,l){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof l?l.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof l?(e.decl(r.properties["box-orient"],l.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],l.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(l,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style")),convert="zIndex"in styleAttr?function(e){return e}:deCamelCase}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return convert(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof n?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof n?(e.decl(r.properties["box-orient"],n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,convert,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index 2c4b5649..6549e9be 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -6,11 +6,13 @@ var j2cPrefixPluginBrowser = (function () { var allStyles; var styleAttr; var styleElement; +var convert; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); + convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -18,7 +20,6 @@ function finalize() { // `allStyles` and `styleElement` can be displosed of after initialization. allStyles = styleElement = null; } - // Helpers, in alphabetic order function camelCase(str) { @@ -41,7 +42,7 @@ function supportedMedia(condition) { } function supportedProperty(property) { // Some browsers like it dash-cased, some camelCased, most like both. - return property in styleAttr || camelCase(property) in styleAttr + return convert(property) in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index 3a908999..bcecfb21 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -var j2cPrefixPluginBrowser=function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style"))}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return e in w||i(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||C)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],P={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},R={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},A={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},j={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},C={},E=/[(),]|\/\*[\s\S]*?\*\//g,M=v();return M}(); \ No newline at end of file +var j2cPrefixPluginBrowser=function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style")),S="zIndex"in w?function(e){return e}:n}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return S(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||E)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S,P=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],R={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},A={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},j={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},C={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},E={},M=/[(),]|\/\*[\s\S]*?\*\//g,O=v();return O}(); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz index d342040b8280fc27073ecc77549c1294fde122b7..7c2798fb20076cc9efb53b17f7566e9168a2c634 100644 GIT binary patch literal 3101 zcmV+&4C3=2iwFP!000001LYZOk0QD8uYhx5+k?A-lP=OV=Wv_No^;BscC?e^Lx7bU z+JKkF-Ey0O*@6F_D)-CH!0klIx13H)yUH$?>s_^vk?wr?etECON*?c%{aUKO==6{a z%~yN1G%{5leJ1-{baJER(vWcl?+Cyw_*$5E=`PzF5kHuxM0jz!-0y@kLG|%I5%`Cx zeUeai;Pr;37LgGp+9R=iBs9p82;1^oWP&Kmgo@v7WD7yw4+ETXQTaGVo zXiN82*q$ZPQg{R3n@0ZEIUTH7!yeQ1Rvno1AMj@VF3LgVXIdX6K4FB=<_2~BhUr`X zU-K6EY8O!G3!wj7dT8i3^h}G9!&J=qVT#A+oDkMpYu5F;2yDT=q$a z^gTV5^V11*KJF$S`I+<;?e&VU>V6CIM6ikSw?-r1ygOtfh>FD&_e#*8dqmQ+J@D5o zJMz>cTI6Z6$2W$f7+{1li@%pgk$j2(0lVtcBo>cyDf|qvzD9I7dU@m*9a*t`^XLE% zdl#oqryJyo*Je5e4>1z7)G*I~?;gV3Q&X~&%5RR6xpNp%uOJW|ZxR61H3A@Nr0r

?ye;d6QYQ%Dxka=X?kgxX(s z(HguXi@;gHSG0&($A~B)XSR%zrF-ZgW3y?tjuu~L4_*FOjVU?zEge-NM z=l&{+#p^iR>%@zKOsy&F;P;~Z{$U6loX2_!yl0Sxq+0uzPlo{Mq7fV=m*{K27ldvE z2#gFY<*L%~6N@ltKv)HkeE>vPGVU5LWf9mD{;d^_01;Gb&4X;8Z#)PJj;dGJRb4To z`Eaa%x-UcISoix4PBO)x&%oUMRL?Dc7_ouB;aC>1$0*r@MMm>+1P3jT@{&hchqb?n zr$ee^8`l&(n>%}~bdYlEwvw<2w&l@jI_K&P&uKtGEOW@0Pbi5?Sg=aOagiP&x7j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uOM#CHQ@4;wD&S5(goItqP^z)x? zBnCw$N$FIr{)E@>Y|yrLN0Vzdau0K4tqqULB(!U7-xzek4s{aQLSpco&~S8KWVtC6 z6I)`i_*Av029|YafK}(ds5v)Kac2Mb`=MIX`OS=;><4}I7v!eO7usFvwF=Rgbc-dl zsml+ZQ^Q5mfB&$OiGk+wIj^!c58aH$3`=oPFHq1{H9dQ;r|V~8%#ui5zS9@^O+WKz z=+Z*+E-x?DqH5n13Gw7Ji^Vbton`|hqEGe(0fzqcfIJi=9PJMFr;~OcIv^nt{P!lc z2I}%(YRtq`BXft)0J_8v5wxDJQk)n%=qR&AbRxatYztumu45<4UavyLQdh&CfRq_t zLJN6Y;$9UG3IJXmF6KVM!VW*x#nT=$jetwYmpfI6NES)D-1^Z`=8$d5=MTHWLG1;m zjesq_z7`KcW7};xSF4byRPXS~0+PrTmRPZLt7s}13Yu=uKw1UcUU(a-yz#PniYq*% zS^`;U-x`ZY4b5S+9FvMkqruC6N$mAvXaw0Ber(diF{Ei3b76jkLZF=xYZ8A`MO9Hl z!Qa++qjJ`OyD-fa6KD9}Ry1~CTXxT<_MI5!J+j>EJk_Av;_VV3&`>R)lH#8Qnx2ub zX}a^Js=m@a*!aw97S;2a!vo*6nESw0Jgv3B4ZyyUwcz%A88<+?au3bYVl;G5&5c}c zA6sPQOMB^tezn{Px!xG~z_Q+2R1{eB8-%R3I;SmDWg8;!hhL=_EwLzOa(TJmRrK0*MqcN@`$L@{HU>8rc+o znM(0cSb|Gg<>bH{qThBKKvte#BNoCOgitP~V6fXKMrM`;0{kZOYs{J5*4k|D Date: Wed, 11 Jan 2017 00:10:32 +0100 Subject: [PATCH 143/244] [prefix-plugin] Improve test page browser compat --- .eslintignore | 1 + .../dist/j2c-plugin-prefix-browser.amd.js | 7 ++++--- .../dist/j2c-plugin-prefix-browser.amd.min.js | 2 +- .../j2c-plugin-prefix-browser.commonjs.js | 7 ++++--- .../j2c-plugin-prefix-browser.commonjs.min.js | 2 +- .../dist/j2c-plugin-prefix-browser.global.js | 7 ++++--- .../j2c-plugin-prefix-browser.global.min.js | 2 +- ...j2c-plugin-prefix-browser.global.min.js.gz | Bin 3101 -> 3094 bytes plugins/prefix-browser/src/detectors/utils.js | 5 ----- plugins/prefix-browser/test-utils/exposed.js | 7 ++++--- .../test-utils/ospec-instance.js | 6 +++--- plugins/prefix-browser/tests/index.html | 4 ++-- .../tests/test-detector-functions.js | 3 ++- 13 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.eslintignore b/.eslintignore index 9f4f6db1..e0a0ff7a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,6 +2,7 @@ coverage dist example gh_pages +modules plugins/postcss/dist plugins/postcss/node_modules plugins/prefix-browser/dist diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index 8ed71cee..18e76d93 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -28,9 +28,10 @@ function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } function supportedDecl(property, value) { - styleAttr[property] = styleAttr[deCamelCase(property)] = ''; - styleAttr[property] = styleAttr[deCamelCase(property)] = value; - return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) + property = convert(property); + styleAttr[property] = ''; + styleAttr[property] = value; + return !!styleAttr[property] } function supportedMedia(condition) { styleElement.textContent = '@media (' + condition +'){}'; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index 3484f0a9..e5bff989 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style")),S="zIndex"in w?function(e){return e}:n}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return S(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||E)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S,P=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],R={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},A={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},j={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},C={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},E={},M=/[(),]|\/\*[\s\S]*?\*\//g,O=v();return O}); \ No newline at end of file +define(function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style")),S="zIndex"in w?function(e){return e}:n}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return e=S(e),w[e]="",w[e]=r,!!w[e]}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return S(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||E)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S,P=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],R={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},A={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},j={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},C={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},E={},M=/[(),]|\/\*[\s\S]*?\*\//g,O=v();return O}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index b5c77cc3..7979987a 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -28,9 +28,10 @@ function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } function supportedDecl(property, value) { - styleAttr[property] = styleAttr[deCamelCase(property)] = ''; - styleAttr[property] = styleAttr[deCamelCase(property)] = value; - return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) + property = convert(property); + styleAttr[property] = ''; + styleAttr[property] = value; + return !!styleAttr[property] } function supportedMedia(condition) { styleElement.textContent = '@media (' + condition +'){}'; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index a129b66c..9d3f03f9 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style")),convert="zIndex"in styleAttr?function(e){return e}:deCamelCase}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return styleAttr[e]=styleAttr[deCamelCase(e)]="",styleAttr[e]=styleAttr[deCamelCase(e)]=r,!(!styleAttr[e]&&!styleAttr[deCamelCase(e)])}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return convert(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof n?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof n?(e.decl(r.properties["box-orient"],n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,convert,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style")),convert="zIndex"in styleAttr?function(e){return e}:deCamelCase}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return e=convert(e),styleAttr[e]="",styleAttr[e]=r,!!styleAttr[e]}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return convert(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function createPrefixPlugin(){function e(){return{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){"flex-flow"===i&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof n?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009&&"string"==typeof n?(e.decl(r.properties["box-orient"],n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}var r=blankFixers();"function"==typeof getComputedStyle&&browserDetector(r),finalizeFixers(r);var t=[];return e.setFixers=function(i){return t.indexOf(i)===-1&&(finalizeFixers(i),t.push(i)),r=i,e},e}var allStyles,styleAttr,styleElement,convert,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,plugin=createPrefixPlugin();module.exports=plugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index 6549e9be..a5c1657a 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -29,9 +29,10 @@ function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } function supportedDecl(property, value) { - styleAttr[property] = styleAttr[deCamelCase(property)] = ''; - styleAttr[property] = styleAttr[deCamelCase(property)] = value; - return !!(styleAttr[property] || styleAttr[deCamelCase(property)]) + property = convert(property); + styleAttr[property] = ''; + styleAttr[property] = value; + return !!styleAttr[property] } function supportedMedia(condition) { styleElement.textContent = '@media (' + condition +'){}'; diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index bcecfb21..85b538fb 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -var j2cPrefixPluginBrowser=function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style")),S="zIndex"in w?function(e){return e}:n}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return w[e]=w[n(e)]="",w[e]=w[n(e)]=r,!(!w[e]&&!w[n(e)])}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return S(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||E)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S,P=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],R={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},A={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},j={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},C={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},E={},M=/[(),]|\/\*[\s\S]*?\*\//g,O=v();return O}(); \ No newline at end of file +var j2cPrefixPluginBrowser=function(){"use strict";function e(){b=getComputedStyle(document.documentElement,null),w=document.createElement("div").style,k=document.documentElement.appendChild(document.createElement("style")),S="zIndex"in w?function(e){return e}:n}function r(){"undefined"!=typeof document&&document.documentElement.removeChild(k),b=k=null}function i(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function n(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function t(e,r){return e=S(e),w[e]="",w[e]=r,!!w[e]}function o(e){return k.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(k.sheet.cssRules[0].cssText)}function a(e){return S(e)in w}function l(e){return k.textContent=e+"{}",!!k.sheet.cssRules.length}function s(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!l("@"+n)&&l("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=o("resolution:1dppx"),e.hasPixelRatio=o(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=o(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",o("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function p(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],o=n.property,a=i+"("+n.params+")";!t(o,a)&&t(o,e.prefix+a)&&e.functions.push(i)}}}function f(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=y("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=h("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),g=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||E)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(g,v):m(i).map(function(e){return e.replace(g,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function v(){function e(){return{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){"flex-flow"===n&&(r.flexbox2009||r.flexbox2012)&&"string"==typeof t?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009&&"string"==typeof t?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var r=x();"function"==typeof getComputedStyle&&d(r),g(r);var i=[];return e.setFixers=function(n){return i.indexOf(n)===-1&&(g(n),i.push(n)),r=n,e},e}var b,w,k,S,P=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],R={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},A={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},j={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},C={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},E={},M=/[(),]|\/\*[\s\S]*?\*\//g,O=v();return O}(); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz index 7c2798fb20076cc9efb53b17f7566e9168a2c634..d835f384fbde2028a3ebf7c8791d7b13a1952abf 100644 GIT binary patch literal 3094 zcmV+x4C(V9iwFP!000001LYb0kK(xXUjg^Z#)A{!q^oq{TyDGFlTN+Wj&|DqP++A% z40s7n!i_w48A_x;Rcq&r`}U*2o6lE?dGzn1DRIz8k< z^VME0jZBqCpUFNKo!n@-G-O=EI|48Zz82k-kD}yjOWA^NIi9$s zE!|yVdX_{>;SGFm8u?%6bg*VEdrUV|bzstez?t>CC7!Akw?^Zi%o8F1Z-F?x|iDoiBM~^X=&t0L#{jmCc#CJS%0C=kKjIi>{kmbc0uWTALcT$R(xP>M>~|f2BoHnm?XPtdOR#hjK3Cg6g=7&ew`-k3RQ+`qt-(982%H6c zMT?kqjEE9auw|4i-9-l(n@u})lpQ<$&JTZtnWBuhuiD`ct2BirWU13U_g7IYUdP#9 zCteg}YE4-OzZcc_4@2Of80#tUoi3&EIyk7M93V-RNvnZN8f`$8tX{VI=;{|k5A_O3p|{?5%jJQ z2~={g7smfa5dXChUI<|LV=VxC_)jkm-`L5gmr{6J;E9%Ll4>}QRMLPi5^IDtw2g}n z8iZDj_!Ye4Kzno`r=+ah$tN8BX}O8?TjLFB9X&+=rkJvhLj`P z(BvmG&F665gyTme435$4EP}FS;Ihf^PCd4~5P)0EHdX28Fq{n9n$(%oq$Q|D ztEe)*o_atmB#hJ(2H`CUoo_}$XbECJRml?~+ChyuXlX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e6t4lqo;?N?hEYNCHAom*X zRM%4lEWD?fXeTBFoP=jy1a&dIZMM$eRjq6u-}EmOe2IAHoO4)1D)eU;)EjwaM60q zfW{W0*3jGHyMThl^(hXS25WZU7ek(jt4_!ME);5Gk2;4pMnwM!l@F2G1h)J4M#DR_ z@4;wD&SBdX97nh~^y8oIBsxVVNoiEA`h?eWHYi)WqZC-++EJ+i}u_hL>dWR{zGH07egV)*6?G49=0J($(RfC z3nT*VxL6bTn=Gn|918Zf#ut^n2E2u7u9!H(|2Cts1KY9(cF(7FQVbm*S?+b7YLIR* zy#xr9R13(Z_-BF2XXI;|?tH1LuXGPuKC_xcH9&J{;8csbBd%h&)&e&GJ0)wu?fo)t zfOh3xnx#c^=-!$ex!gXrww1H?(h&V>xe;=`G4O$jy|t)zVA^jGvO4PAwoH|Y00HhE zLC}C_U}qXVMly*OiLe0UFN=SVE2%pxI9aXc=Q;btpGlO+weqDAJM<7Ve+wbDV=n-u zaN4dBUaXnxkDC1m==XER`Mar~3>F=C`~I zdP2o;27k*tauaDJQ~YHr#Y \ No newline at end of file diff --git a/plugins/prefix-browser/tests/test-plugin-at-media-params.js b/plugins/prefix-browser/tests/test-plugin-at-media-params.js index c3b734c7..85d1a14c 100644 --- a/plugins/prefix-browser/tests/test-plugin-at-media-params.js +++ b/plugins/prefix-browser/tests/test-plugin-at-media-params.js @@ -25,9 +25,11 @@ o.spec('plugin @media parameters', function() { }) o('works with a blank fixer object', function() { - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@media', 'media', 'screen', true) @@ -38,9 +40,11 @@ o.spec('plugin @media parameters', function() { fixers.hasDppx = false fixers.prefix = '-dummy-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@media', 'media', 'screen', true) methods.atrule('@media', 'media', '(resolution:2dppx) and (min-resolution:1dppx) and (max-resolution:2.5dppx)', true) @@ -56,9 +60,11 @@ o.spec('plugin @media parameters', function() { fixers.hasDppx = true fixers.prefix = '-dummy-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@media', 'media', '(resolution:2dppx) and (min-resolution:1dppx) and (max-resolution:2.5dppx)', true) @@ -73,9 +79,11 @@ o.spec('plugin @media parameters', function() { fixers.properties['max-resolution'] = '-webkit-max-device-pixel-ratio' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@media', 'media', '(resolution:2dppx) and (min-resolution:1dppx) and (max-resolution:2.5dppx)', true) @@ -90,9 +98,11 @@ o.spec('plugin @media parameters', function() { fixers.properties['max-resolution'] = '-o-max-device-pixel-ratio' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@media', 'media', '(resolution:2dppx) and (min-resolution:1dppx) and (max-resolution:2.51dppx)', true) diff --git a/plugins/prefix-browser/tests/test-plugin-at-supports-params.js b/plugins/prefix-browser/tests/test-plugin-at-supports-params.js index dd235872..1cbd1487 100644 --- a/plugins/prefix-browser/tests/test-plugin-at-supports-params.js +++ b/plugins/prefix-browser/tests/test-plugin-at-supports-params.js @@ -8,6 +8,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -27,10 +28,13 @@ o.spec('plugin @supports parameters', function() { o('works with a blank fixer object', function() { mocks(global) + initBrowser() - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@supports', 'supports', '(foo:bar)', true) @@ -42,9 +46,10 @@ o.spec('plugin @supports parameters', function() { OFoo: 'bar' } }) - var plugin = createPrefixPlugin() + initBrowser() + var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = createPrefixPlugin().$filter(sink) methods.atrule('@supports', 'supports', '(foo: foo)', true) @@ -62,9 +67,10 @@ o.spec('plugin @supports parameters', function() { color: '-o-initial' } }) - var plugin = createPrefixPlugin() + initBrowser() + var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = createPrefixPlugin().$filter(sink) methods.atrule('@supports', 'supports', '(foo: foo) and ' + diff --git a/plugins/prefix-browser/tests/test-plugin-atrules.js b/plugins/prefix-browser/tests/test-plugin-atrules.js index 2a8531c4..23db063e 100644 --- a/plugins/prefix-browser/tests/test-plugin-atrules.js +++ b/plugins/prefix-browser/tests/test-plugin-atrules.js @@ -25,9 +25,11 @@ o.spec('plugin.atrules', function() { }) o('works with a blank fixer object', function() { - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@keyframes', 'keyframes', 'foo', true) @@ -37,9 +39,11 @@ o.spec('plugin.atrules', function() { fixers.prefix = '-o-' fixers.hasAtrules = true - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@keyframes', 'keyframes', 'foo', true) @@ -50,9 +54,11 @@ o.spec('plugin.atrules', function() { fixers.prefix = '-o-' fixers.hasAtrules = true - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.atrule('@foo', 'foo', 'bar', true) diff --git a/plugins/prefix-browser/tests/test-plugin-misc.js b/plugins/prefix-browser/tests/test-plugin-misc.js index 28366248..5cb62119 100644 --- a/plugins/prefix-browser/tests/test-plugin-misc.js +++ b/plugins/prefix-browser/tests/test-plugin-misc.js @@ -10,6 +10,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -33,11 +34,15 @@ o.spec('plugin misc tests', function() { o('handles raw declarations and bad values gracefully', function() { mocks(global, {properties: {'-o-foo': 'bar'}}) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) diff --git a/plugins/prefix-browser/tests/test-plugin-properties.js b/plugins/prefix-browser/tests/test-plugin-properties.js index cd713ced..8607e47d 100644 --- a/plugins/prefix-browser/tests/test-plugin-properties.js +++ b/plugins/prefix-browser/tests/test-plugin-properties.js @@ -8,6 +8,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -28,12 +29,16 @@ o.spec('plugin.decl for properties', function() { o('it leaves unknowned properties as is', function() { mocks(global, {properties: {'-o-foo': null, 'foo': null}}) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) - plugin.setFixers(fixers) // set it a second time to exercise the cache branch. + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) + j2c.setPrefixDb(fixers) // set it a second time to exercise the cache branch. var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('foo', 'bar') @@ -42,11 +47,15 @@ o.spec('plugin.decl for properties', function() { }) o('adds prefixes when necessary', function() { mocks(global, {properties: {'-o-foo': 'bar'}}) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) @@ -65,11 +74,15 @@ o.spec('plugin.decl for properties', function() { }) o('doesn\'t prefix when both prefix an unprefixed are supported', function() { mocks(global, {properties: {'-o-foo': 'bar', 'foo': 'bar'}}) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) @@ -88,14 +101,18 @@ o.spec('plugin.decl for properties', function() { }) o('with flexbox 2009, `flex-direction` becomes box-orient + box-direction', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.properties['box-orient'] = '-o-box-orient' fixers.properties['box-direction'] = '-o-box-direction' fixers.flexbox2009 = true - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({ 'box-orient': '-o-box-orient', @@ -116,6 +133,8 @@ o.spec('plugin.decl for properties', function() { }) o('with flexbox 2009, `flex-flow` becomes box-orient + box-direction + box-lines', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.properties['box-orient'] = '-o-box-orient' fixers.properties['box-direction'] = '-o-box-direction' @@ -124,9 +143,11 @@ o.spec('plugin.decl for properties', function() { fixers.hasKeywords = true fixers.flexbox2009 = true - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({ 'box-orient': '-o-box-orient', @@ -150,6 +171,8 @@ o.spec('plugin.decl for properties', function() { }) o('with flexbox 2009, `flex-flow` (no wrap value) becomes box-orient + box-direction', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.properties['box-orient'] = '-o-box-orient' fixers.properties['box-direction'] = '-o-box-direction' @@ -158,9 +181,11 @@ o.spec('plugin.decl for properties', function() { fixers.hasKeywords = true fixers.flexbox2009 = true - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({ 'box-orient': '-o-box-orient', @@ -183,6 +208,8 @@ o.spec('plugin.decl for properties', function() { }) o('with flexbox 2009, `flex-flow` (no direction) box-lines', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.properties['box-orient'] = '-o-box-orient' fixers.properties['box-direction'] = '-o-box-direction' @@ -191,9 +218,11 @@ o.spec('plugin.decl for properties', function() { fixers.hasKeywords = true fixers.flexbox2009 = true - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({ 'box-orient': '-o-box-orient', @@ -216,9 +245,11 @@ o.spec('plugin.decl for properties', function() { o('the properties fixer can be specified manually', function(){ fixers.fixProperty = function() {return 'replaced'} - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) diff --git a/plugins/prefix-browser/tests/test-plugin-selectors.js b/plugins/prefix-browser/tests/test-plugin-selectors.js index 40fbf1fd..6d58551f 100644 --- a/plugins/prefix-browser/tests/test-plugin-selectors.js +++ b/plugins/prefix-browser/tests/test-plugin-selectors.js @@ -28,9 +28,11 @@ o.spec('plugin.rule', function() { o('it leaves unrelated selector as is', function() { fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.rule('.foo:active #baz[foo]') @@ -46,9 +48,11 @@ o.spec('plugin.rule', function() { fixers.hasSelectors = true fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.rule('.foo:active #baz[foo]') methods.rule('::placeholder .foo:any-link::selection:selection #baz[qux=":any-link"]/*::selection*/[quux=\'::selection\']') diff --git a/plugins/prefix-browser/tests/test-plugin-values-complex.js b/plugins/prefix-browser/tests/test-plugin-values-complex.js index 4f03d069..0513e252 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-complex.js +++ b/plugins/prefix-browser/tests/test-plugin-values-complex.js @@ -8,6 +8,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -26,13 +27,16 @@ o.spec('plugin.decl for complex values', function() { o('transition with a prefixed property and a prefixed function', function() { mocks(global, {properties: {'-o-foo': 'bar'}}) + initBrowser() fixers.functions = ['linear-gradient', 'repeating-linear-gradient', 'calc', 'element', 'cross-fade'] fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('transition', 'bar 1s, foo 2s step(calc(3 * var(--foo)), foo)') diff --git a/plugins/prefix-browser/tests/test-plugin-values-functions.js b/plugins/prefix-browser/tests/test-plugin-values-functions.js index 50db5f2a..75a0d93f 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-functions.js +++ b/plugins/prefix-browser/tests/test-plugin-values-functions.js @@ -8,6 +8,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -26,12 +27,16 @@ o.spec('plugin.decl for values that have functions', function() { o('leaves unknown functions alone', function() { mocks(global) + initBrowser() + fixers.functions = ['linear-gradient', 'repeating-linear-gradient', 'calc', 'element', 'cross-fade'] fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('foo', 'color(red a(0))') @@ -39,12 +44,16 @@ o.spec('plugin.decl for values that have functions', function() { }) o('fixes known functions', function() { mocks(global) + initBrowser() + fixers.functions = ['linear-gradient', 'repeating-linear-gradient', 'calc', 'element', 'cross-fade'] fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('foo', 'cross-fade(linear-gradient(89deg red, green),repeating-linear-gradient(-20deg rgb( calc(2 * var(--foo)), 0, 0), green))') methods.decl('foo', 'linear-gradient(100deg red, green)') @@ -56,12 +65,16 @@ o.spec('plugin.decl for values that have functions', function() { }) o('skips the gradient fixer if none are present (see coverage)', function() { mocks(global) + initBrowser() + fixers.functions = ['calc', 'element', 'cross-fade'] fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('foo', 'cross-fade(linear-gradient(89deg red, green),repeating-linear-gradient(-20deg rgb( calc(2 * var(--foo)), 0, 0), green))') methods.decl('foo', 'linear-gradient(100deg red, green)') diff --git a/plugins/prefix-browser/tests/test-plugin-values-keywords.js b/plugins/prefix-browser/tests/test-plugin-values-keywords.js index bbb0a161..9eb1e2be 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-keywords.js +++ b/plugins/prefix-browser/tests/test-plugin-values-keywords.js @@ -8,6 +8,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -39,11 +40,15 @@ o.spec('plugin.decl for keywords', function() { o('leaves unknown values as is (hasKeywords set to false)', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('display', 'inline') methods.decl('color', 'red') @@ -55,13 +60,17 @@ o.spec('plugin.decl for keywords', function() { }) o('leaves unknown values as is (hasKeywords set to true)', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.hasKeywords = true fixers.keywords = unPrefixedKeywords - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('display', 'inline') methods.decl('color', 'red') @@ -73,13 +82,17 @@ o.spec('plugin.decl for keywords', function() { }) o('leaves prefixable values as is when they don\'t need a prefix', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.hasKeywords = true fixers.keywords = unPrefixedKeywords - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('display', 'grid') @@ -89,14 +102,18 @@ o.spec('plugin.decl for keywords', function() { }) o('adds prefixes', function() { mocks(global) + initBrowser() + fixers.prefix = '-o-' fixers.hasKeywords = true fixers.keywords = prefixedKeywords fixers.initial = '-o-initial' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) methods.decl('display', 'box') methods.decl('display', 'inline-box') diff --git a/plugins/prefix-browser/tests/test-plugin-values-properties.js b/plugins/prefix-browser/tests/test-plugin-values-properties.js index 7a1b22f3..5c0d7d02 100644 --- a/plugins/prefix-browser/tests/test-plugin-values-properties.js +++ b/plugins/prefix-browser/tests/test-plugin-values-properties.js @@ -8,6 +8,7 @@ var mocks = require('../test-utils/mocks') var blankFixers = exposed.blankFixers var createPrefixPlugin = exposed.createPrefixPlugin var hasCleanState = exposed.hasCleanState +var initBrowser = exposed.initBrowser var referenceFixers = Object.keys(blankFixers()) @@ -26,11 +27,14 @@ o.spec('plugin.decl for properties whose values are properties', function() { o('it leaves unknowned properties as is', function() { mocks(global, {properties: {'-o-foo': null, 'foo': null}}) + initBrowser() fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) @@ -50,11 +54,15 @@ o.spec('plugin.decl for properties whose values are properties', function() { }) o('adds prefixes when necessary', function() { mocks(global, {properties: {'-o-foo': 'bar'}}) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) @@ -74,11 +82,15 @@ o.spec('plugin.decl for properties whose values are properties', function() { }) o('doesn\'t prefix when both prefix an unprefixed are supported', function() { mocks(global, {properties: {'-o-foo': 'bar', 'foo': 'bar'}}) + initBrowser() + fixers.prefix = '-o-' - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) @@ -98,9 +110,11 @@ o.spec('plugin.decl for properties whose values are properties', function() { }) o('the properties fixer can be specified manually', function(){ fixers.fixProperty = function() {return 'replaced'} - var plugin = createPrefixPlugin().setFixers(fixers) + var j2c = {} + var plugin = createPrefixPlugin(j2c) + j2c.setPrefixDb(fixers) var sink = makeSink() - var methods = plugin().$filter(sink) + var methods = plugin.$filter(sink) o(fixers.properties).deepEquals({}) diff --git a/plugins/prefix-browser/yarn.lock b/plugins/prefix-browser/yarn.lock new file mode 100644 index 00000000..f4b257a9 --- /dev/null +++ b/plugins/prefix-browser/yarn.lock @@ -0,0 +1,1411 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +abbrev@1: + version "1.0.9" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^4.0.1: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + +ajv-keywords@^1.0.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.0.tgz#c11e6859eafff83e0dafc416929472eca946aa2c" + +ajv@^4.7.0: + version "4.10.4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.10.4.tgz#c0974dd00b3464984892d6010aa9c2c945933254" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +ansi-escapes@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + +ansi-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +aproba@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.0.4.tgz#2713680775e7614c8ba186c065d4e2e52d1072c0" + +are-we-there-yet@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz#80e470e95a084794fe1899262c5667c6e88de1b3" + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.0 || ^1.1.13" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asap@~2.0.3: + version "2.0.5" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + +ast-types@0.9.2: + version "0.9.2" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.2.tgz#2cc19979d15c655108bf565323b8e7ee38751f6b" + +async@~0.2.6: + version "0.2.10" + resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws4@^1.2.1: + version "1.5.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.5.0.tgz#0a29ffb79c31c9e712eeb087e8e7a64b4a56d755" + +babylon@^6.4.2: + version "6.15.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" + +balanced-match@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" + +bcrypt-pbkdf@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz#3ca76b85241c7170bf7d9703e7b9aa74630040d4" + dependencies: + tweetnacl "^0.14.3" + +block-stream@*: + version "0.0.9" + resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + dependencies: + inherits "~2.0.0" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +brace-expansion@^1.0.0: + version "1.1.6" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" + dependencies: + balanced-match "^0.4.1" + concat-map "0.0.1" + +buffer-shims@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +caseless@~0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +circular-json@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + +cli-cursor@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-width@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +commander@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +compose-regexp@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/compose-regexp/-/compose-regexp-0.1.8.tgz#b213c63566d215e8a6568f601257113f6b7ed8ec" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.4.6: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +d@^0.1.1, d@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309" + dependencies: + es5-ext "~0.10.2" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + dependencies: + assert-plus "^1.0.0" + +debug@^2.1.1: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + dependencies: + ms "0.7.2" + +debug@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + +decamelize@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +deep-extend@~0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + +doctrine@^1.2.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.0" + +es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0.10.7: + version "0.10.12" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047" + dependencies: + es6-iterator "2" + es6-symbol "~3.1" + +es6-iterator@2: + version "2.0.0" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac" + dependencies: + d "^0.1.1" + es5-ext "^0.10.7" + es6-symbol "3" + +es6-map@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.4.tgz#a34b147be224773a4d7da8072794cefa3632b897" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + es6-iterator "2" + es6-set "~0.1.3" + es6-symbol "~3.1.0" + event-emitter "~0.3.4" + +es6-set@~0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.4.tgz#9516b6761c2964b92ff479456233a247dc707ce8" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + es6-iterator "2" + es6-symbol "3" + event-emitter "~0.3.4" + +es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + +es6-weak-map@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.1.tgz#0d2bbd8827eb5fb4ba8f97fbfea50d43db21ea81" + dependencies: + d "^0.1.1" + es5-ext "^0.10.8" + es6-iterator "2" + es6-symbol "3" + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escope@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + dependencies: + es6-map "^0.1.3" + es6-weak-map "^2.0.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@^2.3.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-2.13.1.tgz#e4cc8fa0f009fb829aaae23855a29360be1f6c11" + dependencies: + chalk "^1.1.3" + concat-stream "^1.4.6" + debug "^2.1.1" + doctrine "^1.2.2" + es6-map "^0.1.3" + escope "^3.6.0" + espree "^3.1.6" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^1.1.1" + glob "^7.0.3" + globals "^9.2.0" + ignore "^3.1.2" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + optionator "^0.8.1" + path-is-absolute "^1.0.0" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.6.0" + strip-json-comments "~1.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + +espree@^3.1.6: + version "3.3.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.3.2.tgz#dbf3fadeb4ecb4d4778303e50103b3d36c88b89c" + dependencies: + acorn "^4.0.1" + acorn-jsx "^3.0.0" + +esprima@^2.6.0, esprima@^2.7.1: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esprima@~3.1.0: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + +esrecurse@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + dependencies: + estraverse "~4.1.0" + object-assign "^4.0.1" + +estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +estraverse@~4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-emitter@~0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" + dependencies: + d "~0.1.1" + es5-ext "~0.10.7" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + +extend@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" + +extsprintf@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^1.3.5: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + +file-entry-cache@^1.1.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-1.3.1.tgz#44c61ea607ae4be9c1402f41f44270cbfe334ff8" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +flat-cache@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + +form-data@~2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.2.tgz#89c3534008b97eada4cbb157d58f6f5df025eae4" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +fs-extra@~0.26.2: + version "0.26.7" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^2.1.0" + klaw "^1.0.0" + path-is-absolute "^1.0.0" + rimraf "^2.2.8" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +fstream-ignore@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" + dependencies: + fstream "^1.0.0" + inherits "2" + minimatch "^3.0.0" + +fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.10.tgz#604e8a92fe26ffd9f6fae30399d4984e1ab22822" + dependencies: + graceful-fs "^4.1.2" + inherits "~2.0.0" + mkdirp ">=0.5 0" + rimraf "2" + +gauge@~2.7.1: + version "2.7.2" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.2.tgz#15cecc31b02d05345a5d6b0e171cdb3ad2307774" + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + supports-color "^0.2.0" + wide-align "^1.1.0" + +generate-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + dependencies: + is-property "^1.0.0" + +getpass@^0.1.1: + version "0.1.6" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" + dependencies: + assert-plus "^1.0.0" + +glob@^7.0.3, glob@^7.0.5: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^9.2.0: + version "9.14.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +har-validator@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" + dependencies: + chalk "^1.1.1" + commander "^2.9.0" + is-my-json-valid "^2.12.4" + pinkie-promise "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + +hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +ignore@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +in-publish@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +ini@~1.3.0: + version "1.3.4" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + +inquirer@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" + dependencies: + ansi-escapes "^1.1.0" + ansi-regex "^2.0.0" + chalk "^1.0.0" + cli-cursor "^1.0.1" + cli-width "^2.0.0" + figures "^1.3.5" + lodash "^4.3.0" + readline2 "^1.0.1" + run-async "^0.1.0" + rx-lite "^3.1.2" + string-width "^1.0.1" + strip-ansi "^3.0.0" + through "^2.3.6" + +is-buffer@^1.0.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + +is-property@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + +isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +jodid25519@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/jodid25519/-/jodid25519-1.0.2.tgz#06d4912255093419477d425633606e0e90782967" + dependencies: + jsbn "~0.1.0" + +js-yaml@^3.5.1: + version "3.7.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" + dependencies: + argparse "^1.0.7" + esprima "^2.6.0" + +jsbn@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + +jsonfile@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + +jsprim@^1.2.2: + version "1.3.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.3.1.tgz#2a7256f70412a29ee3670aaca625994c4dcff252" + dependencies: + extsprintf "1.0.2" + json-schema "0.2.3" + verror "1.3.6" + +kind-of@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" + dependencies: + is-buffer "^1.0.2" + +klaw@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" + optionalDependencies: + graceful-fs "^4.1.9" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +lodash.property@^4.1.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.property/-/lodash.property-4.4.2.tgz#da07124821c6409d025f30db8df851314515bffe" + +lodash@^4.0.0, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +mime-db@~1.25.0: + version "1.25.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.25.0.tgz#c18dbd7c73a5dbf6f44a024dc0d165a1e7b1c392" + +mime-types@^2.1.12, mime-types@~2.1.7: + version "2.1.13" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.13.tgz#e07aaa9c6c6b9a7ca3012c69003ad25a39e92a88" + dependencies: + mime-db "~1.25.0" + +minimatch@^3.0.0, minimatch@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" + dependencies: + brace-expansion "^1.0.0" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +ms@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + +ms@0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + +mute-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" + +node-pre-gyp@~0.6.15: + version "0.6.32" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz#fc452b376e7319b3d255f5f34853ef6fd8fe1fd5" + dependencies: + mkdirp "~0.5.1" + nopt "~3.0.6" + npmlog "^4.0.1" + rc "~1.1.6" + request "^2.79.0" + rimraf "~2.5.4" + semver "~5.3.0" + tar "~2.2.1" + tar-pack "~3.3.0" + +nodegit-promise@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/nodegit-promise/-/nodegit-promise-4.0.0.tgz#5722b184f2df7327161064a791d2e842c9167b34" + dependencies: + asap "~2.0.3" + +nodegit@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/nodegit/-/nodegit-0.8.0.tgz#aa3891d871c3acf4fdb77dfad76ddd1ef7f6f3a6" + dependencies: + fs-extra "~0.26.2" + node-pre-gyp "~0.6.15" + promisify-node "~0.3.0" + +nopt@~3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + dependencies: + abbrev "1" + +npmlog@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.1" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +oauth-sign@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +once@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" + dependencies: + wrappy "1" + +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + +optionator@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pluralize@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +private@~0.1.5: + version "0.1.6" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.6.tgz#55c6a976d0f9bafb9924851350fe47b9b5fbb7c1" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +progress@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + +promisify-node@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/promisify-node/-/promisify-node-0.3.0.tgz#b4b55acf90faa7d2b8b90ca396899086c03060cf" + dependencies: + nodegit-promise "~4.0.0" + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@~6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" + +rc@~1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.6.tgz#43651b76b6ae53b5c802f1151fa3fc3b059969c9" + dependencies: + deep-extend "~0.4.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~1.0.4" + +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readable-stream@~2.1.4: + version "2.1.5" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readline2@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + mute-stream "0.0.5" + +recast@^0.11.2: + version "0.11.18" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.18.tgz#07af6257ca769868815209401d4d60eef1b5b947" + dependencies: + ast-types "0.9.2" + esprima "~3.1.0" + private "~0.1.5" + source-map "~0.5.0" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +request@^2.79.0: + version "2.79.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.11.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~2.0.6" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + qs "~6.3.0" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "~0.4.1" + uuid "^3.0.0" + +require-uncached@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.0, rimraf@~2.5.1, rimraf@~2.5.4: + version "2.5.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" + dependencies: + glob "^7.0.5" + +rollup@^0.41.1: + version "0.41.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.1.tgz#5be8192c196c35977551e52ec0c98c3f83280525" + dependencies: + source-map-support "^0.4.0" + +run-async@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" + dependencies: + once "^1.3.0" + +rx-lite@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" + +semver@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +shelljs@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.6.1.tgz#ec6211bed1920442088fe0f70b2837232ed2c8a8" + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +source-map-support@^0.4.0: + version "0.4.8" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.8.tgz#4871918d8a3af07289182e974e32844327b2e98b" + dependencies: + source-map "^0.5.3" + +source-map@^0.5.3, source-map@~0.5.0, source-map@~0.5.1: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +sshpk@^1.7.0: + version "1.10.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.1.tgz#30e1a5d329244974a1af61511339d595af6638b0" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jodid25519 "^1.0.0" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^3.0.0" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + +stringstream@~0.0.4: + version "0.0.5" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-json-comments@~1.0.1, strip-json-comments@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" + +supports-color@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +table@^3.7.8: + version "3.8.3" + resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" + dependencies: + ajv "^4.7.0" + ajv-keywords "^1.0.0" + chalk "^1.1.1" + lodash "^4.0.0" + slice-ansi "0.0.4" + string-width "^2.0.0" + +tar-pack@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae" + dependencies: + debug "~2.2.0" + fstream "~1.0.10" + fstream-ignore "~1.0.5" + once "~1.3.3" + readable-stream "~2.1.4" + rimraf "~2.5.1" + tar "~2.2.1" + uid-number "~0.0.6" + +tar@~2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" + dependencies: + block-stream "*" + fstream "^1.0.2" + inherits "2" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +tough-cookie@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + dependencies: + punycode "^1.4.1" + +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +tunnel-agent@~0.4.1: + version "0.4.3" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +uglify-js@^2.6.2: + version "2.7.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" + dependencies: + async "~0.2.6" + source-map "~0.5.1" + uglify-to-browserify "~1.0.0" + yargs "~3.10.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +uid-number@~0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + +user-home@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" + dependencies: + os-homedir "^1.0.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +uuid@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" + +verror@1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" + dependencies: + extsprintf "1.0.2" + +wide-align@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" + dependencies: + string-width "^1.0.1" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +xtend@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" From 6952d7641bd699e0a8ae908b4f1221f3dc7b3a1e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 09:44:07 +0100 Subject: [PATCH 155/244] [prefix-plugin] v1.0.2 --- plugins/prefix-browser/npm-debug.log | 49 ---------------------------- plugins/prefix-browser/package.json | 2 +- 2 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 plugins/prefix-browser/npm-debug.log diff --git a/plugins/prefix-browser/npm-debug.log b/plugins/prefix-browser/npm-debug.log deleted file mode 100644 index 2b6ffafe..00000000 --- a/plugins/prefix-browser/npm-debug.log +++ /dev/null @@ -1,49 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/usr/local/Cellar/node/7.4.0/bin/node', -1 verbose cli '/usr/local/bin/npm', -1 verbose cli 'run', -1 verbose cli 'all' ] -2 info using npm@4.0.5 -3 info using node@v7.4.0 -4 verbose run-script [ 'preall', 'all', 'postall' ] -5 info lifecycle j2c-plugin-prefix-browser@1.0.1~preall: j2c-plugin-prefix-browser@1.0.1 -6 silly lifecycle j2c-plugin-prefix-browser@1.0.1~preall: no script for preall, continuing -7 info lifecycle j2c-plugin-prefix-browser@1.0.1~all: j2c-plugin-prefix-browser@1.0.1 -8 verbose lifecycle j2c-plugin-prefix-browser@1.0.1~all: unsafe-perm in lifecycle true -9 verbose lifecycle j2c-plugin-prefix-browser@1.0.1~all: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/pygy/dev/j2c/j2c/plugins/prefix-browser/node_modules/.bin:/Users/pygy/perl5/bin:/usr/local/heroku/bin:/Users/pygy/bin:/usr/local/bin:/opt/X11/bin:/usr/X11R6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin -10 verbose lifecycle j2c-plugin-prefix-browser@1.0.1~all: CWD: /Users/pygy/dev/j2c/j2c/plugins/prefix-browser -11 silly lifecycle j2c-plugin-prefix-browser@1.0.1~all: Args: [ '-c', -11 silly lifecycle 'yarn run go lint && yarn run build && yarn run go cover' ] -12 silly lifecycle j2c-plugin-prefix-browser@1.0.1~all: Returned: code: 1 signal: null -13 info lifecycle j2c-plugin-prefix-browser@1.0.1~all: Failed to exec all script -14 verbose stack Error: j2c-plugin-prefix-browser@1.0.1 all: `yarn run go lint && yarn run build && yarn run go cover` -14 verbose stack Exit status 1 -14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16) -14 verbose stack at emitTwo (events.js:106:13) -14 verbose stack at EventEmitter.emit (events.js:191:7) -14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14) -14 verbose stack at emitTwo (events.js:106:13) -14 verbose stack at ChildProcess.emit (events.js:191:7) -14 verbose stack at maybeClose (internal/child_process.js:885:16) -14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) -15 verbose pkgid j2c-plugin-prefix-browser@1.0.1 -16 verbose cwd /Users/pygy/dev/j2c/j2c/plugins/prefix-browser -17 error Darwin 14.5.0 -18 error argv "/usr/local/Cellar/node/7.4.0/bin/node" "/usr/local/bin/npm" "run" "all" -19 error node v7.4.0 -20 error npm v4.0.5 -21 error code ELIFECYCLE -22 error j2c-plugin-prefix-browser@1.0.1 all: `yarn run go lint && yarn run build && yarn run go cover` -22 error Exit status 1 -23 error Failed at the j2c-plugin-prefix-browser@1.0.1 all script 'yarn run go lint && yarn run build && yarn run go cover'. -23 error Make sure you have the latest version of node.js and npm installed. -23 error If you do, this is most likely a problem with the j2c-plugin-prefix-browser package, -23 error not with npm itself. -23 error Tell the author that this fails on your system: -23 error yarn run go lint && yarn run build && yarn run go cover -23 error You can get information on how to open an issue for this project with: -23 error npm bugs j2c-plugin-prefix-browser -23 error Or if that isn't available, you can get their info via: -23 error npm owner ls j2c-plugin-prefix-browser -23 error There is likely additional logging output above. -24 verbose exit [ 1, true ] diff --git a/plugins/prefix-browser/package.json b/plugins/prefix-browser/package.json index 3c87711e..01746b39 100644 --- a/plugins/prefix-browser/package.json +++ b/plugins/prefix-browser/package.json @@ -1,6 +1,6 @@ { "name": "j2c-plugin-prefix-browser", - "version": "1.0.1", + "version": "1.0.2", "description": "Vendor prefix handling for j2c in the browser, built on top of Lea Verou's PrefixFree", "main": "dist/j2c-plugin-prefix-browser.commonjs.js", "jsnext:main": "src/plugin.js", From 1ffe5b9dbfdc8704cec76739523cd36bea1c542b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 09:47:37 +0100 Subject: [PATCH 156/244] [prefix-plugin] Add a section to the TOC --- plugins/prefix-browser/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/prefix-browser/README.md b/plugins/prefix-browser/README.md index 4b79640f..6bc1400e 100644 --- a/plugins/prefix-browser/README.md +++ b/plugins/prefix-browser/README.md @@ -8,7 +8,7 @@ This j2c plugin does client side vendor prefix insertion (and some polyfilling) See below for a detailed feature set. -Unlike Autoprefixer and the Inline Style Prefixer, it relies on feature detection rather than browser sniffing. It weights ~3KB minified and gzipped. +Unlike Autoprefixer and the inline-style-prefixer, it relies on feature detection rather than browser sniffing. It weights ~3KB minified and gzipped. You can watch it at work [in your browser](https://cdn.rawgit.com/j2css/j2c/86db0ee4f2ea0e76eebac0b389c068463e3b1cd4/plugins/prefix-browser/tests/index.html). @@ -30,6 +30,7 @@ The plugin is well tested (385 assertions, many of which are `deepEquals` on nes - [Final spec, prefixed (`-webkit-flex`)](#final-spec-prefixed--webkit-flex) - [Selectors](#selectors) - [At rules](#at-rules) + - [At rules parameters (resolution and @supports)](#at-rules-parameters-resolution-and-supports) - [What about the server side?](#what-about-the-server-side) - [And what about speed?](#and-what-about-speed) - [Thanks](#thanks) From 038bf3a6ceb42e63a203d2904d1b1c4a054163a1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 11:27:25 +0100 Subject: [PATCH 157/244] [prefix-browser] README tweaks --- plugins/prefix-browser/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/prefix-browser/README.md b/plugins/prefix-browser/README.md index 6bc1400e..75012d1a 100644 --- a/plugins/prefix-browser/README.md +++ b/plugins/prefix-browser/README.md @@ -1,6 +1,6 @@ # j2c-plugin-prefix-browser -This j2c plugin does client side vendor prefix insertion (and some polyfilling) for +This j2c plugin does client side vendor prefix insertion (and some polyfilling) for: - properties and values (including flexbox). - selectors, @@ -184,7 +184,7 @@ The plugin translates the final flexbox spec to its older versions as much as po - **`flex`** => **`-ms-flexbox`** - **`inline-flex`** => **`-ms-inline-flexbox`** - `column` => `column` -- `column-reverse` => `column-reverse +- `column-reverse` => `column-reverse` - `row` => `row` - `row-reverse` => `row-reverse` - **`flex-end`** => **`end`** From e66a44348ee3dede2e7b630f9282ed2e3ee66b1b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 11:28:03 +0100 Subject: [PATCH 158/244] [prefix-browser] move a branch and a possibly costly function out of the critical path --- .../dist/j2c-plugin-prefix-browser.amd.js | 23 +++++++++------ .../dist/j2c-plugin-prefix-browser.amd.min.js | 2 +- .../j2c-plugin-prefix-browser.commonjs.js | 23 +++++++++------ .../j2c-plugin-prefix-browser.commonjs.min.js | 2 +- .../dist/j2c-plugin-prefix-browser.global.js | 23 +++++++++------ .../j2c-plugin-prefix-browser.global.min.js | 2 +- ...j2c-plugin-prefix-browser.global.min.js.gz | Bin 3143 -> 3170 bytes plugins/prefix-browser/package.json | 2 +- .../prefix-browser/src/detectors/functions.js | 4 +-- plugins/prefix-browser/src/detectors/utils.js | 18 +++++++----- plugins/prefix-browser/test-utils/exposed.js | 27 ++++++++++-------- .../tests/test-detector-properties.js | 2 +- 12 files changed, 75 insertions(+), 53 deletions(-) diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js index eb719261..2eba1a18 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.js @@ -5,13 +5,20 @@ define(['exports'], function (exports) { 'use strict'; var allStyles; var styleAttr; var styleElement; -var convert; +var supportedProperty; +var supportedDecl; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); - convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; + supportedDecl = _supportedDecl; + supportedProperty = _supportedProperty; + if ('zIndex' in styleAttr && !('z-index' in styleAttr)) { + // Some browsers like it dash-cased, some camelCased, most like both. + supportedDecl = function(property, value) {return _supportedDecl(camelCase(property), value)}; + supportedProperty = function(property) {return _supportedProperty(camelCase(property))}; + } } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -27,8 +34,7 @@ function camelCase(str) { function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } -function supportedDecl(property, value) { - property = convert(property); +function _supportedDecl(property, value) { styleAttr[property] = ''; styleAttr[property] = value; return !!styleAttr[property] @@ -40,9 +46,8 @@ function supportedMedia(condition) { // Opera 11/12, and Safari 6. TY SauceLabs. return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) } -function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return convert(property) in styleAttr +function _supportedProperty(property) { + return property in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; @@ -97,7 +102,7 @@ function detectFunctions(fixers) { if (fixers.prefix === '') return var functions = { 'linear-gradient': { - property: 'backgroundImage', + property: 'background-image', params: 'red, teal' }, 'calc': { @@ -105,7 +110,7 @@ function detectFunctions(fixers) { params: '1px + 5%' }, 'element': { - property: 'backgroundImage', + property: 'background-image', params: '#foo' }, 'cross-fade': { diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js index ca44d361..926e65f6 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.amd.min.js @@ -1 +1 @@ -define(["exports"],function(e){"use strict";function r(){k=getComputedStyle(document.documentElement,null),S=document.createElement("div").style,P=document.documentElement.appendChild(document.createElement("style")),R="zIndex"in S?function(e){return e}:t}function i(){"undefined"!=typeof document&&document.documentElement.removeChild(P),k=P=null}function n(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function t(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function o(e,r){return e=R(e),S[e]="",S[e]=r,!!S[e]}function l(e){return P.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(P.sheet.cssRules[0].cssText)}function a(e){return R(e)in S}function s(e){return P.textContent=e+"{}",!!P.sheet.cssRules.length}function p(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!s("@"+n)&&s("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=l("resolution:1dppx"),e.hasPixelRatio=l(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=l(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",l("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function f(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],t=n.property,l=i+"("+n.params+")";!o(t,l)&&o(t,e.prefix+l)&&e.functions.push(i)}}}function u(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=h("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=g("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),m=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||z)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(m,v):y(i).map(function(e){return e.replace(m,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function b(){A=d(),"function"==typeof getComputedStyle&&m(A),v(A)}function w(e){var r=A,i=[];return e&&(e.setPrefixDb=function(e){return i.indexOf(e)===-1&&(v(e),i.push(e)),r=e,w}),{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){return!n||"string"!=typeof t&&"number"!=typeof t?e.decl(r.properties[n]||r.fixProperty(n),t):(t+="",void("flex-flow"===n&&r.flexbox2009?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var k,S,P,R,A,j=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],M={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},O={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},C={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},E={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},z={},L=/[(),]|\/\*[\s\S]*?\*\//g;b(),e.prefixPlugin=w,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file +define(["exports"],function(e){"use strict";function r(){k=getComputedStyle(document.documentElement,null),S=document.createElement("div").style,P=document.documentElement.appendChild(document.createElement("style")),A=o,R=a,"zIndex"in S&&!("z-index"in S)&&(A=function(e,r){return o(n(e),r)},R=function(e){return a(n(e))})}function i(){"undefined"!=typeof document&&document.documentElement.removeChild(P),k=P=null}function n(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function t(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function o(e,r){return S[e]="",S[e]=r,!!S[e]}function l(e){return P.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(P.sheet.cssRules[0].cssText)}function a(e){return e in S}function s(e){return P.textContent=e+"{}",!!P.sheet.cssRules.length}function p(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!s("@"+n)&&s("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=l("resolution:1dppx"),e.hasPixelRatio=l(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=l(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",l("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function f(e){if(""!==e.prefix){var r={"linear-gradient":{property:"background-image",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"background-image",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],t=n.property,o=i+"("+n.params+")";!A(t,o)&&A(t,e.prefix+o)&&e.functions.push(i)}}}function u(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,s=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,f=function(e,r,i,n){return r+i+(90-n)+"deg"},u=!!e.functions.length,c=h("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),x=g("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),d=/^\s*([-\w]+)/gi,m=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||L)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(d,m):y(i).map(function(e){return e.replace(d,m)}).join(",")),u&&c.test(i)&&(a&&s.test(i)&&(t=t.replace(p,f)),t=t.replace(x,r)),t)};var v=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(v,b):e};var w=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(w,i)}}function b(){j=d(),"function"==typeof getComputedStyle&&m(j),v(j)}function w(e){var r=j,i=[];return e&&(e.setPrefixDb=function(e){return i.indexOf(e)===-1&&(v(e),i.push(e)),r=e,w}),{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){return!n||"string"!=typeof t&&"number"!=typeof t?e.decl(r.properties[n]||r.fixProperty(n),t):(t+="",void("flex-flow"===n&&r.flexbox2009?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var k,S,P,R,A,j,M=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],O={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},C={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},E={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},z={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},L={},V=/[(),]|\/\*[\s\S]*?\*\//g;b(),e.prefixPlugin=w,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js index df5ad075..83a5467b 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.js @@ -7,13 +7,20 @@ Object.defineProperty(exports, '__esModule', { value: true }); var allStyles; var styleAttr; var styleElement; -var convert; +var supportedProperty; +var supportedDecl; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); - convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; + supportedDecl = _supportedDecl; + supportedProperty = _supportedProperty; + if ('zIndex' in styleAttr && !('z-index' in styleAttr)) { + // Some browsers like it dash-cased, some camelCased, most like both. + supportedDecl = function(property, value) {return _supportedDecl(camelCase(property), value)}; + supportedProperty = function(property) {return _supportedProperty(camelCase(property))}; + } } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -29,8 +36,7 @@ function camelCase(str) { function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } -function supportedDecl(property, value) { - property = convert(property); +function _supportedDecl(property, value) { styleAttr[property] = ''; styleAttr[property] = value; return !!styleAttr[property] @@ -42,9 +48,8 @@ function supportedMedia(condition) { // Opera 11/12, and Safari 6. TY SauceLabs. return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) } -function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return convert(property) in styleAttr +function _supportedProperty(property) { + return property in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; @@ -99,7 +104,7 @@ function detectFunctions(fixers) { if (fixers.prefix === '') return var functions = { 'linear-gradient': { - property: 'backgroundImage', + property: 'background-image', params: 'red, teal' }, 'calc': { @@ -107,7 +112,7 @@ function detectFunctions(fixers) { params: '1px + 5%' }, 'element': { - property: 'backgroundImage', + property: 'background-image', params: '#foo' }, 'cross-fade': { diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js index 9e986c7a..8275adc1 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.commonjs.min.js @@ -1 +1 @@ -"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style")),convert="zIndex"in styleAttr?function(e){return e}:deCamelCase}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function supportedDecl(e,r){return e=convert(e),styleAttr[e]="",styleAttr[e]=r,!!styleAttr[e]}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function supportedProperty(e){return convert(e)in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,l=t+"("+i.params+")";!supportedDecl(n,l)&&supportedDecl(n,e.prefix+l)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,m=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,m):splitValue(t).map(function(e){return e.replace(x,m)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var y=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(y,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function initBrowser(){commonFixers=blankFixers(),"function"==typeof getComputedStyle&&browserDetector(commonFixers),finalizeFixers(commonFixers)}function prefixPlugin(e){var r=commonFixers,t=[];return e&&(e.setPrefixDb=function(e){return t.indexOf(e)===-1&&(finalizeFixers(e),t.push(e)),r=e,prefixPlugin}),{$filter:function(e){return{atrule:function(t,i,n,l){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,l)},decl:function t(i,n){return!i||"string"!=typeof n&&"number"!=typeof n?e.decl(r.properties[i]||r.fixProperty(i),n):(n+="",void("flex-flow"===i&&r.flexbox2009?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009?(e.decl(r.properties["box-orient"],n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}Object.defineProperty(exports,"__esModule",{value:!0});var allStyles,styleAttr,styleElement,convert,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,commonFixers;initBrowser(),exports.prefixPlugin=prefixPlugin; \ No newline at end of file +"use strict";function init(){allStyles=getComputedStyle(document.documentElement,null),styleAttr=document.createElement("div").style,styleElement=document.documentElement.appendChild(document.createElement("style")),supportedDecl=_supportedDecl,supportedProperty=_supportedProperty,"zIndex"in styleAttr&&!("z-index"in styleAttr)&&(supportedDecl=function(e,r){return _supportedDecl(camelCase(e),r)},supportedProperty=function(e){return _supportedProperty(camelCase(e))})}function finalize(){"undefined"!=typeof document&&document.documentElement.removeChild(styleElement),allStyles=styleElement=null}function camelCase(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function deCamelCase(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function _supportedDecl(e,r){return styleAttr[e]="",styleAttr[e]=r,!!styleAttr[e]}function supportedMedia(e){return styleElement.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText)}function _supportedProperty(e){return e in styleAttr}function supportedRule(e){return styleElement.textContent=e+"{}",!!styleElement.sheet.cssRules.length}function detectAtrules(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var t in r){var i=t+" "+(r[t]||"");!supportedRule("@"+i)&&supportedRule("@"+e.prefix+i)&&(e.hasAtrules=!0,e.atrules["@"+t]="@"+e.prefix+t)}e.hasDppx=supportedMedia("resolution:1dppx"),e.hasPixelRatio=supportedMedia(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=supportedMedia(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",supportedMedia("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function detectFunctions(e){if(""!==e.prefix){var r={"linear-gradient":{property:"background-image",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"background-image",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var t in r){var i=r[t],n=i.property,o=t+"("+i.params+")";!supportedDecl(n,o)&&supportedDecl(n,e.prefix+o)&&e.functions.push(t)}}}function detectKeywords(e){if(""!==e.prefix){for(var r=0;r0)for(var i=0;i-1,a=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,t,i){return r+t+(90-i)+"deg"},f=!!e.functions.length,c=makeDetector("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=makeLexer("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),x=/^\s*([-\w]+)/gi,y=function(r,t){return e.properties[t]||e.fixProperty(t)};e.fixValue=function(t,i){var n;return null!=e.initial&&"initial"===t?e.initial:e.hasKeywords&&(n=(e.keywords[i]||emptySet)[t])?n:(n=t,e.valueProperties.hasOwnProperty(i)&&(n=t.indexOf(",")===-1?t.replace(x,y):splitValue(t).map(function(e){return e.replace(x,y)}).join(",")),f&&c.test(t)&&(s&&a.test(t)&&(n=n.replace(p,u)),n=n.replace(d,r)),n)};var m=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,g=e.hasPixelRatio?function(r,t,i){return e.properties[t]+":"+i}:e.hasPixelRatioFraction?function(r,t,i){return e.properties[t]+":"+Math.round(10*i)+"/10"}:function(e,r,t){return r+":"+Math.round(96*t)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(m,g):e};var h=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(h,t)}}function initBrowser(){commonFixers=blankFixers(),"function"==typeof getComputedStyle&&browserDetector(commonFixers),finalizeFixers(commonFixers)}function prefixPlugin(e){var r=commonFixers,t=[];return e&&(e.setPrefixDb=function(e){return t.indexOf(e)===-1&&(finalizeFixers(e),t.push(e)),r=e,prefixPlugin}),{$filter:function(e){return{atrule:function(t,i,n,o){e.atrule(r.hasAtrules&&r.atrules[t]||t,i,"@media"===t?r.fixAtMediaParams(n):"@supports"===t?r.fixAtSupportsParams(n):n,o)},decl:function t(i,n){return!i||"string"!=typeof n&&"number"!=typeof n?e.decl(r.properties[i]||r.fixProperty(i),n):(n+="",void("flex-flow"===i&&r.flexbox2009?n.split(" ").forEach(function(e){e.indexOf("wrap")>-1?t("flex-wrap",e):""!==e&&t("flex-direction",e)}):"flex-direction"===i&&r.flexbox2009?(e.decl(r.properties["box-orient"],n.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],n.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[i]||r.fixProperty(i),r.fixValue(n,i))))},rule:function(t){e.rule(r.hasSelectors?r.fixSelector(t):t)}}}}}Object.defineProperty(exports,"__esModule",{value:!0});var allStyles,styleAttr,styleElement,supportedProperty,supportedDecl,keywords=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],flex2009Props={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},flex2009Values={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},flex2012Props={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},flex2012Values={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},emptySet={},valueTokenizer=/[(),]|\/\*[\s\S]*?\*\//g,commonFixers;initBrowser(),exports.prefixPlugin=prefixPlugin; \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js index 6e614f95..e42754ac 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.js @@ -6,13 +6,20 @@ var allStyles; var styleAttr; var styleElement; -var convert; +var supportedProperty; +var supportedDecl; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); - convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; + supportedDecl = _supportedDecl; + supportedProperty = _supportedProperty; + if ('zIndex' in styleAttr && !('z-index' in styleAttr)) { + // Some browsers like it dash-cased, some camelCased, most like both. + supportedDecl = function(property, value) {return _supportedDecl(camelCase(property), value)}; + supportedProperty = function(property) {return _supportedProperty(camelCase(property))}; + } } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -28,8 +35,7 @@ function camelCase(str) { function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } -function supportedDecl(property, value) { - property = convert(property); +function _supportedDecl(property, value) { styleAttr[property] = ''; styleAttr[property] = value; return !!styleAttr[property] @@ -41,9 +47,8 @@ function supportedMedia(condition) { // Opera 11/12, and Safari 6. TY SauceLabs. return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) } -function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return convert(property) in styleAttr +function _supportedProperty(property) { + return property in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; @@ -98,7 +103,7 @@ function detectFunctions(fixers) { if (fixers.prefix === '') return var functions = { 'linear-gradient': { - property: 'backgroundImage', + property: 'background-image', params: 'red, teal' }, 'calc': { @@ -106,7 +111,7 @@ function detectFunctions(fixers) { params: '1px + 5%' }, 'element': { - property: 'backgroundImage', + property: 'background-image', params: '#foo' }, 'cross-fade': { diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js index 7123a75c..61df91d3 100644 --- a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js +++ b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js @@ -1 +1 @@ -!function(e){"use strict";function r(){k=getComputedStyle(document.documentElement,null),P=document.createElement("div").style,S=document.documentElement.appendChild(document.createElement("style")),R="zIndex"in P?function(e){return e}:t}function i(){"undefined"!=typeof document&&document.documentElement.removeChild(S),k=S=null}function n(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function t(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function o(e,r){return e=R(e),P[e]="",P[e]=r,!!P[e]}function l(e){return S.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(S.sheet.cssRules[0].cssText)}function a(e){return R(e)in P}function s(e){return S.textContent=e+"{}",!!S.sheet.cssRules.length}function p(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!s("@"+n)&&s("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=l("resolution:1dppx"),e.hasPixelRatio=l(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=l(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",l("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function f(e){if(""!==e.prefix){var r={"linear-gradient":{property:"backgroundImage",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"backgroundImage",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],t=n.property,l=i+"("+n.params+")";!o(t,l)&&o(t,e.prefix+l)&&e.functions.push(i)}}}function u(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,p=/\blinear-gradient\(/,f=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,u=function(e,r,i,n){return r+i+(90-n)+"deg"},c=!!e.functions.length,x=h("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),d=g("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),m=/^\s*([-\w]+)/gi,v=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||z)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(m,v):y(i).map(function(e){return e.replace(m,v)}).join(",")),c&&x.test(i)&&(s&&p.test(i)&&(t=t.replace(f,u)),t=t.replace(d,r)),t)};var b=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,w=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(b,w):e};var k=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(k,i)}}function b(){A=d(),"function"==typeof getComputedStyle&&m(A),v(A)}function w(e){var r=A,i=[];return e&&(e.setPrefixDb=function(e){return i.indexOf(e)===-1&&(v(e),i.push(e)),r=e,w}),{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){return!n||"string"!=typeof t&&"number"!=typeof t?e.decl(r.properties[n]||r.fixProperty(n),t):(t+="",void("flex-flow"===n&&r.flexbox2009?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var k,P,S,R,A,j=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],C={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},E={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},M={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},O={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},z={},L=/[(),]|\/\*[\s\S]*?\*\//g;b(),e.prefixPlugin=w}(this.j2cPrefixPluginBrowser=this.j2cPrefixPluginBrowser||{}); \ No newline at end of file +!function(e){"use strict";function r(){k=getComputedStyle(document.documentElement,null),P=document.createElement("div").style,S=document.documentElement.appendChild(document.createElement("style")),A=o,R=a,"zIndex"in P&&!("z-index"in P)&&(A=function(e,r){return o(n(e),r)},R=function(e){return a(n(e))})}function i(){"undefined"!=typeof document&&document.documentElement.removeChild(S),k=S=null}function n(e){return e.replace(/-([a-z])/g,function(e,r){return r.toUpperCase()}).replace("-","")}function t(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function o(e,r){return P[e]="",P[e]=r,!!P[e]}function l(e){return S.textContent="@media ("+e+"){}",!/^@media(?:\s+not)?\s+all/.test(S.sheet.cssRules[0].cssText)}function a(e){return e in P}function s(e){return S.textContent=e+"{}",!!S.sheet.cssRules.length}function p(e){if(""!==e.prefix){var r={keyframes:"name",viewport:null,document:'regexp(".")'};for(var i in r){var n=i+" "+(r[i]||"");!s("@"+n)&&s("@"+e.prefix+n)&&(e.hasAtrules=!0,e.atrules["@"+i]="@"+e.prefix+i)}e.hasDppx=l("resolution:1dppx"),e.hasPixelRatio=l(e.prefix+"device-pixel-ratio:1"),e.hasPixelRatioFraction=l(e.prefix+"device-pixel-ratio:1/1"),(e.hasPixelRatio||e.hasPixelRatioFraction)&&(e.properties.resolution=e.prefix+"device-pixel-ratio",e.properties["min-resolution"]=e.prefix+"min-device-pixel-ratio",e.properties["max-resolution"]=e.prefix+"max-device-pixel-ratio",l("min-"+e.prefix+"device-pixel-ratio:1")&&(e.properties["min-resolution"]="min-"+e.prefix+"device-pixel-ratio",e.properties["max-resolution"]="max-"+e.prefix+"device-pixel-ratio"))}}function f(e){if(""!==e.prefix){var r={"linear-gradient":{property:"background-image",params:"red, teal"},calc:{property:"width",params:"1px + 5%"},element:{property:"background-image",params:"#foo"},"cross-fade":{property:"backgroundImage",params:"url(a.png), url(b.png), 50%"}};r["repeating-linear-gradient"]=r["repeating-radial-gradient"]=r["radial-gradient"]=r["linear-gradient"];for(var i in r){var n=r[i],t=n.property,o=i+"("+n.params+")";!A(t,o)&&A(t,e.prefix+o)&&e.functions.push(i)}}}function u(e){if(""!==e.prefix){for(var r=0;r0)for(var o=0;o-1,s=/\blinear-gradient\(/,p=/(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/gi,f=function(e,r,i,n){return r+i+(90-n)+"deg"},u=!!e.functions.length,c=h("(?:^|\\s|,|\\()",e.functions,"\\s*\\("),x=g("(^|\\s|,|\\()",e.functions,"(?=\\s*\\()"),d=/^\s*([-\w]+)/gi,m=function(r,i){return e.properties[i]||e.fixProperty(i)};e.fixValue=function(i,n){var t;return null!=e.initial&&"initial"===i?e.initial:e.hasKeywords&&(t=(e.keywords[n]||L)[i])?t:(t=i,e.valueProperties.hasOwnProperty(n)&&(t=i.indexOf(",")===-1?i.replace(d,m):y(i).map(function(e){return e.replace(d,m)}).join(",")),u&&c.test(i)&&(a&&s.test(i)&&(t=t.replace(p,f)),t=t.replace(x,r)),t)};var v=/((?:min-|max-)?resolution)\s*:\s*((?:\d*.)?\d+)dppx/g,b=e.hasPixelRatio?function(r,i,n){return e.properties[i]+":"+n}:e.hasPixelRatioFraction?function(r,i,n){return e.properties[i]+":"+Math.round(10*n)+"/10"}:function(e,r,i){return r+":"+Math.round(96*i)+"dpi"};e.fixAtMediaParams=e.hasDppx!==!1?function(e){return e}:function(e){return e.indexOf("reso")!==-1?e.replace(v,b):e};var w=/\(\s*([-\w]+)\s*:\s*((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\((?:"(?:\\[\S\s]|[^"])*"|'(?:\\[\S\s]|[^'])*'|\/\*[\S\s]*?\*\/|\([^\)]*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;e.fixAtSupportsParams=function(e){return e.replace(w,i)}}function b(){j=d(),"function"==typeof getComputedStyle&&m(j),v(j)}function w(e){var r=j,i=[];return e&&(e.setPrefixDb=function(e){return i.indexOf(e)===-1&&(v(e),i.push(e)),r=e,w}),{$filter:function(e){return{atrule:function(i,n,t,o){e.atrule(r.hasAtrules&&r.atrules[i]||i,n,"@media"===i?r.fixAtMediaParams(t):"@supports"===i?r.fixAtSupportsParams(t):t,o)},decl:function i(n,t){return!n||"string"!=typeof t&&"number"!=typeof t?e.decl(r.properties[n]||r.fixProperty(n),t):(t+="",void("flex-flow"===n&&r.flexbox2009?t.split(" ").forEach(function(e){e.indexOf("wrap")>-1?i("flex-wrap",e):""!==e&&i("flex-direction",e)}):"flex-direction"===n&&r.flexbox2009?(e.decl(r.properties["box-orient"],t.indexOf("column")>-1?"block-axis":"inline-axis"),e.decl(r.properties["box-direction"],t.indexOf("-reverse")>-1?"reverse":"normal")):e.decl(r.properties[n]||r.fixProperty(n),r.fixValue(t,n))))},rule:function(i){e.rule(r.hasSelectors?r.fixSelector(i):i)}}}}}var k,P,S,R,A,j,C=[{props:["cursor"],values:["grab","grabbing","zoom-in","zoom-out"]},{props:["display"],values:["box","inline-box","flexbox","inline-flexbox","flex","inline-flex","grid","inline-grid"]},{props:["position"],values:["sticky"]},{props:["width","column-width","height","max-height","max-width","min-height","min-width"],values:["contain-floats","fill-available","fit-content","max-content","min-content"]}],E={"align-items":"box-align",flex:"box-flex","box-direction":"box-direction","box-orient":"box-orient","flex-wrap":"box-lines","justify-content":"box-pack",order:"box-ordinal-group"},M={"flex-end":"end","flex-start":"start",nowrap:"single","space-around":"justify","space-between":"justify",wrap:"multiple","wrap-reverse":"multiple"},O={"align-content":"-ms-flex-line-pack","align-items":"-ms-flex-align","align-self":"-ms-flex-item-align","flex-basis":"-ms-preferred-size","flex-grow":"-ms-flex-positive","flex-shrink":"-ms-flex-negative","justify-content":"-ms-flex-pack",order:"-ms-flex-order"},z={"flex-end":"end","flex-start":"start","space-around":"distribute","space-between":"justify"},L={},V=/[(),]|\/\*[\s\S]*?\*\//g;b(),e.prefixPlugin=w}(this.j2cPrefixPluginBrowser=this.j2cPrefixPluginBrowser||{}); \ No newline at end of file diff --git a/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz b/plugins/prefix-browser/dist/j2c-plugin-prefix-browser.global.min.js.gz index fdf18b40a24e8da9c7e0a3299d8e1f9c9748563a..b94e01bbc81783c2c84652db022fec258eeb33bf 100644 GIT binary patch literal 3170 zcmV-o44v~IiwFP!000001LYZOlj6AXuYhu4twA=-Rb8sioR6FAZK|$vTRXLr+=l>L zWv~D(Ms~^KF$@0h>6TwI1G|$-zGXfPs9S2a`rS=;xswYm66tVyBD;)tGOffylTn4} zD2JXl!HVm*$u`|-9zE&jm^)Fj*loGgUiIZ&%<+TCT^v*P7}OgUiiet)Xoo~%PpFq6 z5%v_^BIAW=%4PI+E#kyR(5r~$Osa~^`` z!A#MU;(DiKCvi{!0LX!iEs_!+8a&NuUW-LIC@>(t6p}}z8|dehC(BO7Yp-|nX^L-? zJuja2MA;^I3Q%YbZTo5t+tWB)aA)8;lhFM#qk|Q@`U>Ug*TW__7xI)=|Mjt6iw)6SEZtvLtV$g+>Sm}isW z48Q*a$XX1B_JccU4h=55$qz7Lc<5eU;>BF9^tz#uA`P*02v|bEy;Ol+9O-Evs*Vay z8~(gh;g)AUk?=v-UhqSjDD9)-S!E#p8^u@rm^#EG^i4imCdxqy0vT2XH5rIL>5#so zCSrCzgH}h~%pt#!z61j=zE$@dki)%om_2BPdz{ox4;P!2N+6iJVjHf& zJ<<@o1)N3kh;=j%W0JE)7%%Ko2NCIYv-LhbcKV$k{tP>L5ocd_#h;c*0%yoVC0XV! z!-(JD?YH*1or;~%OX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{A(%f@tU$ny|-mslVWW@ zkPA~*q`%EBG1kT&QAQp(w6n!wS)mCC0nq%ieL>mt4-1(XsCZw}sTzdP4YSO!6ekcR z3TnN!bLe(;Gw#OFjk~Mg8OormUpN_*jv@IquOxl4>s0)>5pOP7Eapk*R6xK{&2L8? zj|6`jQ_J?(A_JjcZ8tOMv|1Q=Bhmr(ow$OrUZ12Jg^?1%eh+_R*`+e}>nO9;!AMqQErbaWiEX#L-5L=~U3bC)azS_w zy~K)l>4^leeyYonCNnKFa|rqyRkA~7NjhKq(Lv@AGOIa|U1589g=ovn30+@{ozU1j zSjzP(Br4S#oZUbqe61>UTe2F+4e(d6Gy6mVw|3cdpQTOJOV}3LDQh|3S+fWB$Ud=q z_Jxn_KpMJ4GT-Vv)$o{dND2@r!)B0w@neP-#>m$+-S|?~-_k7zwO|d2dT{5^z-bzD zM{DI!?*!Ze>~!t~Zts_I3$!cu(kv|-O83^>$ocx|WLq`Tuk`NM%axGJm4Po<44f?L z9at)~2w5L>ZkwmdM1TM%iNL4f8Q9H6yGSO{ED;u9{CWAaUq#(n!O40xEvD=(eFI$k_;;G@O#AeZaO&C;& z5H~A2u~ha~gmjxhk^K(Xwj_m$;SBz-?#NA~kxco?REn3v5=_bpCkNW#Znj2&ZPon^ zVkXSKoO3mplE7x07@1iT2=H51YcK`-&`7g=kH5*S`0SIbmz{~c*;2{9LPJxvaIv_( z*(>>@0=WBKC9nRn$8`V0)KFX}`M$pRaT|Uu})hGGnv8qp?#()Z;8SXwL+oe=|UwCFE h^We*m^9Kk17Z6Y`H2((fcziDC@ZXAy*LWr(002cc3|RmG diff --git a/plugins/prefix-browser/package.json b/plugins/prefix-browser/package.json index 01746b39..d0ab1626 100644 --- a/plugins/prefix-browser/package.json +++ b/plugins/prefix-browser/package.json @@ -1,6 +1,6 @@ { "name": "j2c-plugin-prefix-browser", - "version": "1.0.2", + "version": "1.0.3", "description": "Vendor prefix handling for j2c in the browser, built on top of Lea Verou's PrefixFree", "main": "dist/j2c-plugin-prefix-browser.commonjs.js", "jsnext:main": "src/plugin.js", diff --git a/plugins/prefix-browser/src/detectors/functions.js b/plugins/prefix-browser/src/detectors/functions.js index d4689cbc..8784720a 100644 --- a/plugins/prefix-browser/src/detectors/functions.js +++ b/plugins/prefix-browser/src/detectors/functions.js @@ -7,7 +7,7 @@ export function detectFunctions(fixers) { if (fixers.prefix === '') return var functions = { 'linear-gradient': { - property: 'backgroundImage', + property: 'background-image', params: 'red, teal' }, 'calc': { @@ -15,7 +15,7 @@ export function detectFunctions(fixers) { params: '1px + 5%' }, 'element': { - property: 'backgroundImage', + property: 'background-image', params: '#foo' }, 'cross-fade': { diff --git a/plugins/prefix-browser/src/detectors/utils.js b/plugins/prefix-browser/src/detectors/utils.js index 4cadc718..12fa01d4 100644 --- a/plugins/prefix-browser/src/detectors/utils.js +++ b/plugins/prefix-browser/src/detectors/utils.js @@ -1,12 +1,18 @@ // Derived from Lea Verou's PrefixFree -var allStyles, styleAttr, styleElement, convert +var allStyles, styleAttr, styleElement, supportedProperty, supportedDecl function init() { allStyles = getComputedStyle(document.documentElement, null) styleAttr = document.createElement('div').style styleElement = document.documentElement.appendChild(document.createElement('style')) - convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase + supportedDecl = _supportedDecl + supportedProperty = _supportedProperty + if ('zIndex' in styleAttr && !('z-index' in styleAttr)) { + // Some browsers like it dash-cased, some camelCased, most like both. + supportedDecl = function(property, value) {return _supportedDecl(camelCase(property), value)} + supportedProperty = function(property) {return _supportedProperty(camelCase(property))} + } } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement) @@ -29,8 +35,7 @@ function camelCase(str) { function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } -function supportedDecl(property, value) { - property = convert(property) +function _supportedDecl(property, value) { styleAttr[property] = '' styleAttr[property] = value return !!styleAttr[property] @@ -42,9 +47,8 @@ function supportedMedia(condition) { // Opera 11/12, and Safari 6. TY SauceLabs. return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) } -function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return convert(property) in styleAttr +function _supportedProperty(property) { + return property in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}' diff --git a/plugins/prefix-browser/test-utils/exposed.js b/plugins/prefix-browser/test-utils/exposed.js index e7cb45dc..8986f6a9 100644 --- a/plugins/prefix-browser/test-utils/exposed.js +++ b/plugins/prefix-browser/test-utils/exposed.js @@ -8,13 +8,19 @@ Object.defineProperty(exports, '__esModule', { value: true }); var allStyles; var styleAttr; var styleElement; -var convert; +var supportedDecl; function init() { allStyles = getComputedStyle(document.documentElement, null); styleAttr = document.createElement('div').style; styleElement = document.documentElement.appendChild(document.createElement('style')); - convert = ('zIndex' in styleAttr) ? function(p){return p} : deCamelCase; + supportedDecl = _supportedDecl; + exports.supportedProperty = _supportedProperty; + if ('zIndex' in styleAttr && !('z-index' in styleAttr)) { + // Some browsers like it dash-cased, some camelCased, most like both. + supportedDecl = function(property, value) {return _supportedDecl(camelCase(property), value)}; + exports.supportedProperty = function(property) {return _supportedProperty(camelCase(property))}; + } } function finalize() { if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement); @@ -37,8 +43,7 @@ function camelCase(str) { function deCamelCase(str) { return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() }) } -function supportedDecl(property, value) { - property = convert(property); +function _supportedDecl(property, value) { styleAttr[property] = ''; styleAttr[property] = value; return !!styleAttr[property] @@ -50,9 +55,8 @@ function supportedMedia(condition) { // Opera 11/12, and Safari 6. TY SauceLabs. return !/^@media(?:\s+not)?\s+all/.test(styleElement.sheet.cssRules[0].cssText) } -function supportedProperty(property) { - // Some browsers like it dash-cased, some camelCased, most like both. - return convert(property) in styleAttr +function _supportedProperty(property) { + return property in styleAttr } function supportedRule(selector) { styleElement.textContent = selector + '{}'; @@ -107,7 +111,7 @@ function detectFunctions(fixers) { if (fixers.prefix === '') return var functions = { 'linear-gradient': { - property: 'backgroundImage', + property: 'background-image', params: 'red, teal' }, 'calc': { @@ -115,7 +119,7 @@ function detectFunctions(fixers) { params: '1px + 5%' }, 'element': { - property: 'backgroundImage', + property: 'background-image', params: '#foo' }, 'cross-fade': { @@ -453,8 +457,8 @@ function finalizeFixers(fixers) { fixers.fixProperty = fixers.fixProperty || function(prop) { var prefixed; return fixers.properties[prop] = ( - supportedProperty(prop) || - !supportedProperty(prefixed = prefix + prop) + exports.supportedProperty(prop) || + !exports.supportedProperty(prefixed = prefix + prop) ) ? prop : prefixed }; @@ -638,7 +642,6 @@ exports.cleanupDetectorUtils = cleanupDetectorUtils; exports.hasCleanState = hasCleanState; exports.camelCase = camelCase; exports.deCamelCase = deCamelCase; -exports.supportedProperty = supportedProperty; exports.detectAtrules = detectAtrules; exports.detectFunctions = detectFunctions; exports.detectKeywords = detectKeywords; diff --git a/plugins/prefix-browser/tests/test-detector-properties.js b/plugins/prefix-browser/tests/test-detector-properties.js index c2c8a29a..ab9a4d78 100644 --- a/plugins/prefix-browser/tests/test-detector-properties.js +++ b/plugins/prefix-browser/tests/test-detector-properties.js @@ -8,7 +8,7 @@ var upToDate = require('../test-utils/misc').upToDate var init = exposed.init var hasCleanState = exposed.hasCleanState var finalize = exposed.finalize -var supportedProperty = exposed.supportedProperty +function supportedProperty (p) {return exposed.supportedProperty(p)} var blankFixers = exposed.blankFixers var referenceFixers = Object.keys(blankFixers()) From a83e187dbe99213aab3006ebe287d90e944e3141 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 11:36:01 +0100 Subject: [PATCH 159/244] [prefix-plugin] test-mocks: add a special case to simulate old Opera --- plugins/prefix-browser/test-utils/mocks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/prefix-browser/test-utils/mocks.js b/plugins/prefix-browser/test-utils/mocks.js index 4ab9270d..645ba0c3 100644 --- a/plugins/prefix-browser/test-utils/mocks.js +++ b/plugins/prefix-browser/test-utils/mocks.js @@ -86,7 +86,7 @@ module.exports = function (global, options) { } } }) - Object.defineProperty(proxy, deCamelCase(prop), { + if (prop != 'zIndex') Object.defineProperty(proxy, deCamelCase(prop), { configurable: true, enumerable: true, get: function() {return style[prop] == null ? null: style[prop]}, From 23612e7d41cc6c004a8ca67e338869fbc719faac Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 11:36:34 +0100 Subject: [PATCH 160/244] [prefix-plugin] v1.0.4 --- plugins/prefix-browser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/prefix-browser/package.json b/plugins/prefix-browser/package.json index d0ab1626..5acdb116 100644 --- a/plugins/prefix-browser/package.json +++ b/plugins/prefix-browser/package.json @@ -1,6 +1,6 @@ { "name": "j2c-plugin-prefix-browser", - "version": "1.0.3", + "version": "1.0.4", "description": "Vendor prefix handling for j2c in the browser, built on top of Lea Verou's PrefixFree", "main": "dist/j2c-plugin-prefix-browser.commonjs.js", "jsnext:main": "src/plugin.js", From e6782b307cec76c3ad1eb3d369758eec6d103927 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 11:40:27 +0100 Subject: [PATCH 161/244] [prefix-plugin] README use the latest version of the demo --- plugins/prefix-browser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/prefix-browser/README.md b/plugins/prefix-browser/README.md index 75012d1a..25fab9ff 100644 --- a/plugins/prefix-browser/README.md +++ b/plugins/prefix-browser/README.md @@ -10,7 +10,7 @@ See below for a detailed feature set. Unlike Autoprefixer and the inline-style-prefixer, it relies on feature detection rather than browser sniffing. It weights ~3KB minified and gzipped. -You can watch it at work [in your browser](https://cdn.rawgit.com/j2css/j2c/86db0ee4f2ea0e76eebac0b389c068463e3b1cd4/plugins/prefix-browser/tests/index.html). +You can watch it at work [in your browser](https://cdn.rawgit.com/j2css/j2c/23612e7d41cc6c004a8ca67e338869fbc719faac/plugins/prefix-browser/tests/index.html). The plugin is well tested (385 assertions, many of which are `deepEquals` on nested objects) and has 100% branch coverage (which doesn't mean it is bug free, off course). From 44b94fdd6889b2de9e9685bd93b42856120271f0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 15:01:21 +0100 Subject: [PATCH 162/244] [prefix-plugin] v1.0.5 --- plugins/prefix-browser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/prefix-browser/package.json b/plugins/prefix-browser/package.json index 5acdb116..21902be4 100644 --- a/plugins/prefix-browser/package.json +++ b/plugins/prefix-browser/package.json @@ -1,6 +1,6 @@ { "name": "j2c-plugin-prefix-browser", - "version": "1.0.4", + "version": "1.0.5", "description": "Vendor prefix handling for j2c in the browser, built on top of Lea Verou's PrefixFree", "main": "dist/j2c-plugin-prefix-browser.commonjs.js", "jsnext:main": "src/plugin.js", From ddb44ba739de45ccbfa7a752d8f9950fdf65d7d9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 12 Jan 2017 15:01:59 +0100 Subject: [PATCH 163/244] Improve error messages --- dist/j2c.amd.js | 9 +++------ dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 9 +++------ dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 9 +++------ dist/j2c.global.js | 9 +++------ dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 2424 -> 2407 bytes src/main.js | 6 +++--- 9 files changed, 18 insertions(+), 30 deletions(-) diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index cc3f53ab..ab9d622d 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -475,13 +475,13 @@ function j2c() { // the bottom of the 'codegen' stream. Mirrors the `$filter` plugin API. var $sink = { - init: function(){buf=[], err=0;}, + init: function(){buf=[], err=[];}, done: function (raw) { - if (err) throw new Error('j2c error, see below\n' + buf.join('')) + if (err.length != 0) throw new Error('j2c error(s): ' + JSON.stringify(err,null,2) + 'in context:\n' + buf.join('')) return raw ? buf : buf.join('') }, err: function(msg) { - err = 1; + err.push(msg); buf.push('/* +++ ERROR +++ ' + msg + ' */\n'); }, atrule: function (rule, kind, param, takesBlock) { @@ -653,9 +653,6 @@ function j2c() { return _instance } -var _j2c = j2c(); -'sheet|inline|names|at|global|kv|suffix'.split('|').map(function(m){j2c[m] = _j2c[m];}); - return j2c; }); diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index db2b128c..361b05a2 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n){for(var t in n)b.call(n,t)&&(!t.indexOf("$")||t in e||(e[t]=n[t]));return e}function n(e,n){var t,r,l=[];for(r in n)if(b.call(n,r))for(t in e)b.call(e,t)&&l.push(e[t]+n[r]);return l}function t(e){for(var n,t=[],r=[],l=0;n=A.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;t.push(n.index)}for(n=t.length;n--;)r.unshift(e.slice(t[n]+1)),e=e.slice(0,t[n]);return r.unshift(e),r}function r(e,t){for(var r,l,a=[],i=[];l=Z.exec(e);)"&"==l[0]&&a.push(l.index);for(l=a.length;l--;)i.unshift(e.slice(a[l]+1)),e=e.slice(0,a[l]);for(i.unshift(e),1===i.length&&i.unshift(""),r=[i[0]],l=1;l0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(i))if(s||(s=1,t.rule(n)),/\$/.test(i))for(c in i=i.split("$"))own.call(i,c)&&declarations(e,t,i[c],o,a);else declarations(e,t,i,o,a);else/^@/.test(i)?(s=0,atRules(e,t,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(i)||[i,"@","",""],o,n,a,l)):(s=0,rules(e,t,n.length>0&&(/,/.test(n)||/,/.test(i))?(c=splitSelector(n),splitSelector(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i).map(function(e){return/&/.test(e)?ampersand(e,c):c.map(function(t){return t+e}).join(",")}).join(",")):/&/.test(i)?ampersand(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i,[n]):n+(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i),o,a,l+1));break;case ARRAY:for(i=0;i0&&/^[-\w$]+$/.test(i))if(s||(s=1,t.rule(n)),/\$/.test(i))for(c in i=i.split("$"))own.call(i,c)&&declarations(e,t,i[c],o,a);else declarations(e,t,i,o,a);else/^@/.test(i)?(s=0,atRules(e,t,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(i)||[i,"@","",""],o,n,a,l)):(s=0,rules(e,t,n.length>0&&(/,/.test(n)||/,/.test(i))?(c=splitSelector(n),splitSelector(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i).map(function(e){return/&/.test(e)?ampersand(e,c):c.map(function(t){return t+e}).join(",")}).join(",")):/&/.test(i)?ampersand(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i,[n]):n+(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i),o,a,l+1));break;case ARRAY:for(i=0;i0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;fQus9y7?*K(UpdCQ?$x4I7W?(D=Dpi*Fw?N=AfLl|3b@ii*g@ zp@Kh*&9pFk4dg>BTRGWQF4tU!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qc6nZWrK}@E0ma4(!|H=Sp~s&C zS|~SnuWMD;!q?EC4`_M{y?Yp)rIq<^0IlgXrMPkQhU$$f_b{>V2fr!>ULc?EvH{0O z2HDOBOD@X&ToONZRh#s_{LIp@BOi>T`wFnhyRQ;tay{^UfAH(aj~_moCkuz`3CO;X zxo!;t``yPN2I&OoLE?-IUPwr$1YE~qb1Edil)No3IUJun(bUs{f{%s%mm&@HjxpK_ zh4llh#o~BuF-VVa_ugZKmeEV9!!5G~AgtJzXXrTw7$Ky(V+x_k5N3fBlEngIH75SQ zQoRXsQ9|^7xqJJ|+c$r?d;8|vP!(*J&uk>zOC~DU^U;=v&gD$`XS`mlU7V5RO4FbYcNaMv`pmb9drFYw_Z%$YN!eC}s zR@fDmbRF0b!O*H2xd-+>ieFAUatI0QNTGJ2bh*xYOMkd;z+YMz6&9eo1N)yuTHZs# z9wTuyh5fz^8gI5=btN_RsHNM_o0PekU*gxb@6f{}_+^PZ3_KsNiLNf2)lde*yb!Rd z*Y%pR<8%AtbE!6GcvB2vj2N1Sx?WNCh)0}F=G-s>LRH8wbv;BTNGvG3P=E15sEgL4 zx4zi2!0e@|jB8A=6?V+0Xw||DWV_pfo<;KvM(mqs{H*!C`SAqOfP0fxANKO!s@!s= zzp>}&!}2psL_w}N|IX|Bd{Q28gvTTXI3@L;85d#PdyFQdKg;_NL5p?1A|{n;n+CP@ qJ4D1Hy8iN9+tNast*bu${)R;z`_}{ffiP?iAo>rzA@mD+7ytnNDY=ON diff --git a/src/main.js b/src/main.js index 2de25696..d37f276f 100644 --- a/src/main.js +++ b/src/main.js @@ -12,13 +12,13 @@ export default function j2c() { // the bottom of the 'codegen' stream. Mirrors the `$filter` plugin API. var $sink = { - init: function(){buf=[], err=0}, + init: function(){buf=[], err=[]}, done: function (raw) { - if (err) throw new Error('j2c error, see below\n' + buf.join('')) + if (err.length != 0) throw new Error('j2c error(s): ' + JSON.stringify(err,null,2) + 'in context:\n' + buf.join('')) return raw ? buf : buf.join('') }, err: function(msg) { - err = 1 + err.push(msg) buf.push('/* +++ ERROR +++ ' + msg + ' */\n') }, atrule: function (rule, kind, param, takesBlock) { From d750a18a52d11ef46aa329d3b1f773761c0ffa02 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Fri, 13 Jan 2017 23:37:15 +0100 Subject: [PATCH 164/244] [prefix-plugin] Flesh out the package.json --- plugins/prefix-browser/package.json | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/prefix-browser/package.json b/plugins/prefix-browser/package.json index 21902be4..e72d3aec 100644 --- a/plugins/prefix-browser/package.json +++ b/plugins/prefix-browser/package.json @@ -1,6 +1,6 @@ { "name": "j2c-plugin-prefix-browser", - "version": "1.0.5", + "version": "1.0.6", "description": "Vendor prefix handling for j2c in the browser, built on top of Lea Verou's PrefixFree", "main": "dist/j2c-plugin-prefix-browser.commonjs.js", "jsnext:main": "src/plugin.js", @@ -13,14 +13,20 @@ "prepublish": "(in-publish && git push --follow-tags) || not-in-publish" }, "keywords": [ - "prefixfree", - "prefix", - "css", - "j2c", - "css-in-js" + "CSS", + "css-in-js", + "prefix" ], + "repository": { + "type": "git", + "url": "https://github.com/j2css/j2c.git" + }, "author": "Pierre-Yves Gérardy", "license": "MIT", + "bugs": { + "url": "https://github.com/j2css/j2c/issues" + }, + "homepage": "http://j2c.py.gy", "dependencies": {}, "devDependencies": { "acorn": "^2.7.0", From 60ac51738ce4219165a880332d1943182e4c8b15 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 14 Jan 2017 00:25:06 +0100 Subject: [PATCH 165/244] Localization should only apply to animation names --- dist/j2c.amd.js | 2 +- dist/j2c.amd.min.js | 2 +- dist/j2c.commonjs.js | 2 +- dist/j2c.commonjs.min.js | 2 +- dist/j2c.es6.js | 2 +- dist/j2c.global.js | 2 +- dist/j2c.global.min.js | 2 +- dist/j2c.global.min.js.gz | Bin 2407 -> 2413 bytes src/declarations.js | 2 +- tests/old_suite.js | 2515 +++++++++++++++++++++++++++++++++++++ 10 files changed, 2523 insertions(+), 8 deletions(-) create mode 100644 tests/old_suite.js diff --git a/dist/j2c.amd.js b/dist/j2c.amd.js index ab9d622d..75468557 100644 --- a/dist/j2c.amd.js +++ b/dist/j2c.amd.js @@ -153,7 +153,7 @@ function declarations(state, emit, prefix, o, local) { // We may 'localize' a comment, but it's not a big deal. o = o.split(',').map(function (o) { - return o.replace(/(var\([^)]+\))|:?global\(\s*([_A-Za-z][-\w]*)\s*\)|()(-?[_A-Za-z][-\w]*)/, state.localizeReplacer) + return o.replace(/^\s*(?:(var\([^)]+\))|:?global\(\s*([_A-Za-z][-\w]*)\s*\)|()(-?[_A-Za-z][-\w]*))/, state.localizeReplacer) }).join(','); } diff --git a/dist/j2c.amd.min.js b/dist/j2c.amd.min.js index 361b05a2..c36fbe7c 100644 --- a/dist/j2c.amd.min.js +++ b/dist/j2c.amd.min.js @@ -1 +1 @@ -define(function(){"use strict";function e(e,n){for(var t in n)b.call(n,t)&&(!t.indexOf("$")||t in e||(e[t]=n[t]));return e}function n(e,n){var t,r,l=[];for(r in n)if(b.call(n,r))for(t in e)b.call(e,t)&&l.push(e[t]+n[r]);return l}function t(e){for(var n,t=[],r=[],l=0;n=A.exec(e);)switch(n[0]){case"(":l++;break;case")":l--;break;case",":if(l)break;t.push(n.index)}for(n=t.length;n--;)r.unshift(e.slice(t[n]+1)),e=e.slice(0,t[n]);return r.unshift(e),r}function r(e,t){for(var r,l,a=[],i=[];l=S.exec(e);)"&"==l[0]&&a.push(l.index);for(l=a.length;l--;)i.unshift(e.slice(a[l]+1)),e=e.slice(0,a[l]);for(i.unshift(e),1===i.length&&i.unshift(""),r=[i[0]],l=1;l0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(i))if(s||(s=1,t.rule(n)),/\$/.test(i))for(c in i=i.split("$"))own.call(i,c)&&declarations(e,t,i[c],o,a);else declarations(e,t,i,o,a);else/^@/.test(i)?(s=0,atRules(e,t,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(i)||[i,"@","",""],o,n,a,l)):(s=0,rules(e,t,n.length>0&&(/,/.test(n)||/,/.test(i))?(c=splitSelector(n),splitSelector(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i).map(function(e){return/&/.test(e)?ampersand(e,c):c.map(function(t){return t+e}).join(",")}).join(",")):/&/.test(i)?ampersand(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i,[n]):n+(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i),o,a,l+1));break;case ARRAY:for(i=0;i0&&/^[-\w$]+$/.test(i))if(s||(s=1,t.rule(n)),/\$/.test(i))for(c in i=i.split("$"))own.call(i,c)&&declarations(e,t,i[c],o,a);else declarations(e,t,i,o,a);else/^@/.test(i)?(s=0,atRules(e,t,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(i)||[i,"@","",""],o,n,a,l)):(s=0,rules(e,t,n.length>0&&(/,/.test(n)||/,/.test(i))?(c=splitSelector(n),splitSelector(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i).map(function(e){return/&/.test(e)?ampersand(e,c):c.map(function(t){return t+e}).join(",")}).join(",")):/&/.test(i)?ampersand(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i,[n]):n+(a?i.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):i),o,a,l+1));break;case ARRAY:for(i=0;i0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f),p,c,s+1));break;case $:for(f=0;f0&&/^[-\w$]+$/.test(f))if(h||(h=1,n.rule(l)),/\$/.test(f))for(g in f=f.split("$"))b.call(f,g)&&i(e,n,f[g],p,c);else i(e,n,f,p,c);else/^@/.test(f)?(h=0,o(e,n,/^(.(?:-[\w]+-)?([_A-Za-z][-\w]*))\b\s*(.*?)\s*$/.exec(f)||[f,"@","",""],p,l,c,s)):(h=0,u(e,n,l.length>0&&(/,/.test(l)||/,/.test(f))?(g=t(l),t(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f).map(function(e){return/&/.test(e)?r(e,g):g.map(function(n){return n+e}).join(",")}).join(",")):/&/.test(f)?r(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-\w]*)\s*\)|(\.)(-?[_A-Za-z][-\w]*)/g,e.localizeReplacer):f,[l]):l+(c?f.replace(/("(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\/)|:global\(\s*(\.-?[_A-Za-z][-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