@webcomponents/shadycss
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -11,19 +11,20 @@ (function(){/* | ||
'use strict';var k={};function n(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""} | ||
function p(a){a=a.replace(aa,"").replace(ba,"");var c=q,b=a,d=new n;d.start=0;d.end=b.length;for(var e=d,f=0,h=b.length;f<h;f++)if("{"===b[f]){e.rules||(e.rules=[]);var g=e,m=g.rules[g.rules.length-1]||null;e=new n;e.start=f+1;e.parent=g;e.previous=m;g.rules.push(e)}else"}"===b[f]&&(e.end=f+1,e=e.parent||d);return c(d,a)} | ||
function q(a,c){var b=c.substring(a.start,a.end-1);a.parsedCssText=a.cssText=b.trim();a.parent&&(b=c.substring(a.previous?a.previous.end:a.parent.start,a.start-1),b=ca(b),b=b.replace(r," "),b=b.substring(b.lastIndexOf(";")+1),b=a.parsedSelector=a.selector=b.trim(),a.atRule=0===b.indexOf("@"),a.atRule?0===b.indexOf("@media")?a.type=t:b.match(da)&&(a.type=u,a.keyframesName=a.selector.split(r).pop()):a.type=0===b.indexOf("--")?v:x);if(b=a.rules)for(var d=0,e=b.length,f;d<e&&(f=b[d]);d++)q(f,c);return a} | ||
function ca(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,b){a=b;for(b=6-a.length;b--;)a="0"+a;return"\\"+a})} | ||
function y(a,c,b){b=void 0===b?"":b;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var h=e.length,g;f<h&&(g=e[f]);f++)d=y(g,c,d)}else c?c=a.cssText:(c=a.cssText,c=c.replace(ea,"").replace(fa,""),c=c.replace(ha,"").replace(ia,"")),(d=c.trim())&&(d=" "+d+"\n")}d&&(a.selector&&(b+=a.selector+" {\n"),b+=d,a.selector&&(b+="}\n\n"));return b} | ||
var x=1,u=7,t=4,v=1E3,aa=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ba=/@import[^;]*;/gim,ea=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ha=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ia=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,da=/^@[^\s]*keyframes/,r=/\s+/g;var ja=Promise.resolve();function ka(a){if(a=k[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function z(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function la(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,ja.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.b=!1}))};var A=!(window.ShadyDOM&&window.ShadyDOM.inUse),B;function C(a){B=a&&a.shimcssproperties?!1:A||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?B=window.ShadyCSS.nativeCss:window.ShadyCSS?(C(window.ShadyCSS),window.ShadyCSS=void 0):C(window.WebComponents&&window.WebComponents.flags);var D=B;var F=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,G=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ma=/@media\s(.*)/;var H=new Set;function I(a){if(!a)return"";"string"===typeof a&&(a=p(a));return y(a,D)}function J(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function K(a,c,b,d){if(a){var e=!1,f=a.type;if(d&&f===t){var h=a.selector.match(ma);h&&(window.matchMedia(h[1]).matches||(e=!0))}f===x?c(a):b&&f===u?b(a):f===v&&(e=!0);if((a=a.rules)&&!e){e=0;f=a.length;for(var g;e<f&&(g=a[e]);e++)K(g,c,b,d)}}} | ||
function L(a,c){var b=a.indexOf("var(");if(-1===b)return c(a,"","","");a:{var d=0;var e=b+3;for(var f=a.length;e<f;e++)if("("===a[e])d++;else if(")"===a[e]&&0===--d)break a;e=-1}d=a.substring(b+4,e);b=a.substring(0,b);a=L(a.substring(e+1),c);e=d.indexOf(",");return-1===e?c(b,d.trim(),"",a):c(b,d.substring(0,e).trim(),d.substring(e+1).trim(),a)};var na=/;\s*/m,oa=/^\s*(initial)|(inherit)\s*$/;function M(){this.a={}}M.prototype.set=function(a,c){a=a.trim();this.a[a]={h:c,i:{}}};M.prototype.get=function(a){a=a.trim();return this.a[a]||null};var N=null;function O(){this.b=this.c=null;this.a=new M}O.prototype.o=function(a){a=G.test(a)||F.test(a);G.lastIndex=0;F.lastIndex=0;return a}; | ||
O.prototype.m=function(a,c){if(void 0===a.a){var b=[];for(var d=a.content.querySelectorAll("style"),e=0;e<d.length;e++){var f=d[e];if(f.hasAttribute("shady-unscoped")){if(!A){var h=f.textContent;H.has(h)||(H.add(h),h=f.cloneNode(!0),document.head.appendChild(h));f.parentNode.removeChild(f)}}else b.push(f.textContent),f.parentNode.removeChild(f)}(b=b.join("").trim())?(d=document.createElement("style"),d.textContent=b,a.content.insertBefore(d,a.content.firstChild),b=d):b=null;a.a=b}return(a=a.a)?this.j(a, | ||
c):null};O.prototype.j=function(a,c){c=void 0===c?"":c;var b=J(a);this.l(b,c);a.textContent=I(b);return b};O.prototype.f=function(a){var c=this,b=J(a);K(b,function(a){":root"===a.selector&&(a.selector="html");c.g(a)});a.textContent=I(b);return b};O.prototype.l=function(a,c){var b=this;this.c=c;K(a,function(a){b.g(a)});this.c=null};O.prototype.g=function(a){a.cssText=pa(this,a.parsedCssText);":root"===a.selector&&(a.selector=":host > *")}; | ||
function pa(a,c){c=c.replace(F,function(b,c,e,f){return qa(a,b,c,e,f)});return P(a,c)}function P(a,c){for(var b;b=G.exec(c);){var d=b[0],e=b[1];b=b.index;var f=c.slice(0,b+d.indexOf("@apply"));c=c.slice(b+d.length);var h=Q(a,f);d=void 0;var g=a;e=e.replace(na,"");var m=[];var l=g.a.get(e);l||(g.a.set(e,{}),l=g.a.get(e));if(l)for(d in g.c&&(l.i[g.c]=!0),l.h)g=h&&h[d],l=[d,": var(",e,"_-_",d],g&&l.push(",",g),l.push(")"),m.push(l.join(""));d=m.join("; ");c=""+f+d+c;G.lastIndex=b+d.length}return c} | ||
function Q(a,c){c=c.split(";");for(var b,d,e={},f=0,h;f<c.length;f++)if(b=c[f])if(h=b.split(":"),1<h.length){b=h[0].trim();var g=a;d=b;h=h.slice(1).join(":");var m=oa.exec(h);m&&(m[1]?(g.b||(g.b=document.createElement("meta"),g.b.setAttribute("apply-shim-measure",""),g.b.style.all="initial",document.head.appendChild(g.b)),d=window.getComputedStyle(g.b).getPropertyValue(d)):d="apply-shim-inherit",h=d);d=h;e[b]=d}return e}function ra(a,c){if(N)for(var b in c.i)b!==a.c&&N(b)} | ||
function qa(a,c,b,d,e){d&&L(d,function(c,b){b&&a.a.get(b)&&(e="@apply "+b+";")});if(!e)return c;var f=P(a,e),h=c.slice(0,c.indexOf("--")),g=f=Q(a,f),m=a.a.get(b),l=m&&m.h;l?g=Object.assign(Object.create(l),f):a.a.set(b,g);var Y=[],w,Z=!1;for(w in g){var E=f[w];void 0===E&&(E="initial");!l||w in l||(Z=!0);Y.push(""+b+"_-_"+w+": "+E)}Z&&ra(a,m);m&&(m.h=g);d&&(h=c+";"+h);return""+h+Y.join("; ")+";"}O.prototype.detectMixin=O.prototype.o;O.prototype.transformStyle=O.prototype.j; | ||
O.prototype.transformCustomStyle=O.prototype.f;O.prototype.transformRules=O.prototype.l;O.prototype.transformRule=O.prototype.g;O.prototype.transformTemplate=O.prototype.m;O.prototype._separator="_-_";Object.defineProperty(O.prototype,"invalidCallback",{get:function(){return N},set:function(a){N=a}});var R=null,sa=window.HTMLImports&&window.HTMLImports.whenReady||null,S;function ta(a){requestAnimationFrame(function(){sa?sa(a):(R||(R=new Promise(function(a){S=a}),"complete"===document.readyState?S():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&S()})),R.then(function(){a&&a()}))})};var T=new O;function U(){var a=this;this.a=null;ta(function(){V(a)});T.invalidCallback=ka}function V(a){a.a||(a.a=window.ShadyCSS.CustomStyleInterface,a.a&&(a.a.transformCallback=function(a){T.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&W(a)})}))}U.prototype.prepareTemplate=function(a,c){V(this);k[c]=a;c=T.m(a,c);a._styleAst=c}; | ||
function W(a){V(a);if(a.a){var c=a.a.processStyles();if(a.a.enqueued){for(var b=0;b<c.length;b++){var d=a.a.getStyleForCustomStyle(c[b]);d&&T.f(d)}a.a.enqueued=!1}}}U.prototype.styleSubtree=function(a,c){V(this);if(c)for(var b in c)null===b?a.style.removeProperty(b):a.style.setProperty(b,c[b]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,c=0;c<a.length;c++)this.styleSubtree(a[c]);else for(a=a.children||a.childNodes,c=0;c<a.length;c++)this.styleSubtree(a[c])}; | ||
U.prototype.styleElement=function(a){V(this);var c=a.localName,b;c?-1<c.indexOf("-")?b=c:b=a.getAttribute&&a.getAttribute("is")||"":b=a.is;if((c=k[b])&&!z(c)){if(z(c)||c._applyShimValidatingVersion!==c._applyShimNextVersion)this.prepareTemplate(c,b),la(c);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=c._styleAst,a.textContent=I(c._styleAst)}};U.prototype.styleDocument=function(a){V(this);this.styleSubtree(document.body,a)}; | ||
if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var X=new U,ua=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,c){W(X);X.prepareTemplate(a,c)},styleSubtree:function(a,c){W(X);X.styleSubtree(a,c)},styleElement:function(a){W(X);X.styleElement(a)},styleDocument:function(a){W(X);X.styleDocument(a)},getComputedStyleValue:function(a,c){return(a=window.getComputedStyle(a).getPropertyValue(c))?a.trim():""},nativeCss:D,nativeShadow:A};ua&&(window.ShadyCSS.CustomStyleInterface= | ||
ua)}window.ShadyCSS.ApplyShim=T;}).call(this); | ||
function p(a){a=a.replace(ba,"").replace(ca,"");var c=r,b=a,d=new n;d.start=0;d.end=b.length;for(var e=d,f=0,h=b.length;f<h;f++)if("{"===b[f]){e.rules||(e.rules=[]);var g=e,m=g.rules[g.rules.length-1]||null;e=new n;e.start=f+1;e.parent=g;e.previous=m;g.rules.push(e)}else"}"===b[f]&&(e.end=f+1,e=e.parent||d);return c(d,a)} | ||
function r(a,c){var b=c.substring(a.start,a.end-1);a.parsedCssText=a.cssText=b.trim();a.parent&&(b=c.substring(a.previous?a.previous.end:a.parent.start,a.start-1),b=da(b),b=b.replace(t," "),b=b.substring(b.lastIndexOf(";")+1),b=a.parsedSelector=a.selector=b.trim(),a.atRule=0===b.indexOf("@"),a.atRule?0===b.indexOf("@media")?a.type=u:b.match(ea)&&(a.type=v,a.keyframesName=a.selector.split(t).pop()):a.type=0===b.indexOf("--")?w:y);if(b=a.rules)for(var d=0,e=b.length,f;d<e&&(f=b[d]);d++)r(f,c);return a} | ||
function da(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,b){a=b;for(b=6-a.length;b--;)a="0"+a;return"\\"+a})} | ||
function z(a,c,b){b=void 0===b?"":b;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var h=e.length,g;f<h&&(g=e[f]);f++)d=z(g,c,d)}else c?c=a.cssText:(c=a.cssText,c=c.replace(fa,"").replace(ha,""),c=c.replace(ia,"").replace(ja,"")),(d=c.trim())&&(d=" "+d+"\n")}d&&(a.selector&&(b+=a.selector+" {\n"),b+=d,a.selector&&(b+="}\n\n"));return b} | ||
var y=1,v=7,u=4,w=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,ha=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ia=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ja=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ea=/^@[^\s]*keyframes/,t=/\s+/g;var ka=Promise.resolve();function la(a){if(a=k[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function A(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ma(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,ka.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.b=!1}))};var B=!(window.ShadyDOM&&window.ShadyDOM.inUse),C;function D(a){C=a&&a.shimcssproperties?!1:B||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?C=window.ShadyCSS.nativeCss:window.ShadyCSS?(D(window.ShadyCSS),window.ShadyCSS=void 0):D(window.WebComponents&&window.WebComponents.flags);var E=C;var G=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,H=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,na=/@media\s(.*)/;var I=new Set;function J(a){if(!a)return"";"string"===typeof a&&(a=p(a));return z(a,E)}function K(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function L(a,c,b,d){if(a){var e=!1,f=a.type;if(d&&f===u){var h=a.selector.match(na);h&&(window.matchMedia(h[1]).matches||(e=!0))}f===y?c(a):b&&f===v?b(a):f===w&&(e=!0);if((a=a.rules)&&!e){e=0;f=a.length;for(var g;e<f&&(g=a[e]);e++)L(g,c,b,d)}}} | ||
function M(a,c){var b=a.indexOf("var(");if(-1===b)return c(a,"","","");a:{var d=0;var e=b+3;for(var f=a.length;e<f;e++)if("("===a[e])d++;else if(")"===a[e]&&0===--d)break a;e=-1}d=a.substring(b+4,e);b=a.substring(0,b);a=M(a.substring(e+1),c);e=d.indexOf(",");return-1===e?c(b,d.trim(),"",a):c(b,d.substring(0,e).trim(),d.substring(e+1).trim(),a)};var oa=/;\s*/m,pa=/^\s*(initial)|(inherit)\s*$/,N=/\s*!important/;function O(){this.a={}}O.prototype.set=function(a,c){a=a.trim();this.a[a]={h:c,i:{}}};O.prototype.get=function(a){a=a.trim();return this.a[a]||null};var P=null;function Q(){this.b=this.c=null;this.a=new O}Q.prototype.o=function(a){a=H.test(a)||G.test(a);H.lastIndex=0;G.lastIndex=0;return a}; | ||
Q.prototype.m=function(a,c){if(void 0===a.a){var b=[];for(var d=a.content.querySelectorAll("style"),e=0;e<d.length;e++){var f=d[e];if(f.hasAttribute("shady-unscoped")){if(!B){var h=f.textContent;I.has(h)||(I.add(h),h=f.cloneNode(!0),document.head.appendChild(h));f.parentNode.removeChild(f)}}else b.push(f.textContent),f.parentNode.removeChild(f)}(b=b.join("").trim())?(d=document.createElement("style"),d.textContent=b,a.content.insertBefore(d,a.content.firstChild),b=d):b=null;a.a=b}return(a=a.a)?this.j(a, | ||
c):null};Q.prototype.j=function(a,c){c=void 0===c?"":c;var b=K(a);this.l(b,c);a.textContent=J(b);return b};Q.prototype.f=function(a){var c=this,b=K(a);L(b,function(a){":root"===a.selector&&(a.selector="html");c.g(a)});a.textContent=J(b);return b};Q.prototype.l=function(a,c){var b=this;this.c=c;L(a,function(a){b.g(a)});this.c=null};Q.prototype.g=function(a){a.cssText=qa(this,a.parsedCssText);":root"===a.selector&&(a.selector=":host > *")}; | ||
function qa(a,c){c=c.replace(G,function(b,c,e,f){return ra(a,b,c,e,f)});return R(a,c)} | ||
function R(a,c){for(var b;b=H.exec(c);){var d=b[0],e=b[1];b=b.index;var f=c.slice(0,b+d.indexOf("@apply"));c=c.slice(b+d.length);var h=S(a,f);d=void 0;var g=a;e=e.replace(oa,"");var m=[];var l=g.a.get(e);l||(g.a.set(e,{}),l=g.a.get(e));if(l){g.c&&(l.i[g.c]=!0);var q=l.h;for(d in q)g=h&&h[d],l=[d,": var(",e,"_-_",d],g&&l.push(",",g.replace(N,"")),l.push(")"),N.test(q[d])&&l.push(" !important"),m.push(l.join(""))}d=m.join("; ");c=""+f+d+c;H.lastIndex=b+d.length}return c} | ||
function S(a,c){c=c.split(";");for(var b,d,e={},f=0,h;f<c.length;f++)if(b=c[f])if(h=b.split(":"),1<h.length){b=h[0].trim();var g=a;d=b;h=h.slice(1).join(":");var m=pa.exec(h);m&&(m[1]?(g.b||(g.b=document.createElement("meta"),g.b.setAttribute("apply-shim-measure",""),g.b.style.all="initial",document.head.appendChild(g.b)),d=window.getComputedStyle(g.b).getPropertyValue(d)):d="apply-shim-inherit",h=d);d=h;e[b]=d}return e}function sa(a,c){if(P)for(var b in c.i)b!==a.c&&P(b)} | ||
function ra(a,c,b,d,e){d&&M(d,function(c,b){b&&a.a.get(b)&&(e="@apply "+b+";")});if(!e)return c;var f=R(a,e),h=c.slice(0,c.indexOf("--")),g=f=S(a,f),m=a.a.get(b),l=m&&m.h;l?g=Object.assign(Object.create(l),f):a.a.set(b,g);var q=[],x,aa=!1;for(x in g){var F=f[x];void 0===F&&(F="initial");!l||x in l||(aa=!0);q.push(""+b+"_-_"+x+": "+F)}aa&&sa(a,m);m&&(m.h=g);d&&(h=c+";"+h);return""+h+q.join("; ")+";"}Q.prototype.detectMixin=Q.prototype.o;Q.prototype.transformStyle=Q.prototype.j; | ||
Q.prototype.transformCustomStyle=Q.prototype.f;Q.prototype.transformRules=Q.prototype.l;Q.prototype.transformRule=Q.prototype.g;Q.prototype.transformTemplate=Q.prototype.m;Q.prototype._separator="_-_";Object.defineProperty(Q.prototype,"invalidCallback",{get:function(){return P},set:function(a){P=a}});var T=null,ta=window.HTMLImports&&window.HTMLImports.whenReady||null,U;function ua(a){requestAnimationFrame(function(){ta?ta(a):(T||(T=new Promise(function(a){U=a}),"complete"===document.readyState?U():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&U()})),T.then(function(){a&&a()}))})};var V=new Q;function W(){var a=this;this.a=null;ua(function(){X(a)});V.invalidCallback=la}function X(a){a.a||(a.a=window.ShadyCSS.CustomStyleInterface,a.a&&(a.a.transformCallback=function(a){V.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&Y(a)})}))}W.prototype.prepareTemplate=function(a,c){X(this);k[c]=a;c=V.m(a,c);a._styleAst=c}; | ||
function Y(a){X(a);if(a.a){var c=a.a.processStyles();if(a.a.enqueued){for(var b=0;b<c.length;b++){var d=a.a.getStyleForCustomStyle(c[b]);d&&V.f(d)}a.a.enqueued=!1}}}W.prototype.styleSubtree=function(a,c){X(this);if(c)for(var b in c)null===b?a.style.removeProperty(b):a.style.setProperty(b,c[b]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,c=0;c<a.length;c++)this.styleSubtree(a[c]);else for(a=a.children||a.childNodes,c=0;c<a.length;c++)this.styleSubtree(a[c])}; | ||
W.prototype.styleElement=function(a){X(this);var c=a.localName,b;c?-1<c.indexOf("-")?b=c:b=a.getAttribute&&a.getAttribute("is")||"":b=a.is;if((c=k[b])&&!A(c)){if(A(c)||c._applyShimValidatingVersion!==c._applyShimNextVersion)this.prepareTemplate(c,b),ma(c);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=c._styleAst,a.textContent=J(c._styleAst)}};W.prototype.styleDocument=function(a){X(this);this.styleSubtree(document.body,a)}; | ||
if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Z=new W,va=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,c){Y(Z);Z.prepareTemplate(a,c)},styleSubtree:function(a,c){Y(Z);Z.styleSubtree(a,c)},styleElement:function(a){Y(Z);Z.styleElement(a)},styleDocument:function(a){Y(Z);Z.styleDocument(a)},getComputedStyleValue:function(a,c){return(a=window.getComputedStyle(a).getPropertyValue(c))?a.trim():""},nativeCss:E,nativeShadow:B};va&&(window.ShadyCSS.CustomStyleInterface= | ||
va)}window.ShadyCSS.ApplyShim=V;}).call(this); | ||
//# sourceMappingURL=apply-shim.min.js.map |
{ | ||
"name": "@webcomponents/shadycss", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Styling helpers for ShadyDOM", | ||
@@ -35,10 +35,10 @@ "main": "shadycss.min.js", | ||
"devDependencies": { | ||
"@webcomponents/custom-elements": "^1.0.6", | ||
"@webcomponents/html-imports": "^1.1.0", | ||
"@webcomponents/shadydom": "^1.0.11", | ||
"@webcomponents/custom-elements": "^1.0.8", | ||
"@webcomponents/html-imports": "^1.1.1", | ||
"@webcomponents/shadydom": "^1.0.12", | ||
"@webcomponents/template": "^1.2.2", | ||
"@webcomponents/webcomponents-platform": "^1.0.0", | ||
"del": "^3.0.0", | ||
"es6-promise": "^4.2.2", | ||
"eslint": "^4.15.0", | ||
"es6-promise": "^4.2.4", | ||
"eslint": "^4.18.1", | ||
"eslint-plugin-html": "^3.2.2", | ||
@@ -49,3 +49,3 @@ "google-closure-compiler": "^20170910.0.0", | ||
"gulp-size": "^2.1.0", | ||
"gulp-sourcemaps": "^2.6.3", | ||
"gulp-sourcemaps": "^2.6.4", | ||
"rollup-stream": "=1.23.1", | ||
@@ -55,3 +55,4 @@ "run-sequence": "^2.2.1", | ||
"vinyl-source-stream": "^1.1.2", | ||
"web-component-tester": "^6.4.2" | ||
"wct-browser-legacy": "0.0.1-pre.11", | ||
"web-component-tester": "^6.5.0" | ||
}, | ||
@@ -58,0 +59,0 @@ "publishConfig": { |
@@ -96,2 +96,33 @@ # ShadyCSS | ||
### Status: | ||
The `@apply` proposal has been abandoned in favor of the ::part/::theme [Shadow Parts spec](https://tabatkins.github.io/specs/css-shadow-parts/). Therefore, the ApplyShim library is deprecated and provided only for backwards compatibility. Support going forward will be limited to critical bug fixes. | ||
### Known Issues: | ||
* Mixin properties cannot be modified at runtime. | ||
* Nested mixins are not supported. | ||
* Shorthand properties are not expanded and may conflict with more explicit properties. Whenever shorthand notations are used in conjunction with their expanded forms in `@apply`, depending in the order of usage of the mixins, properties can be overridden. This means that using both `background-color: green;` and `background: red;` in two separate CSS selectors | ||
can result in `background-color: transparent` in the selector that `background: red;` is specified. | ||
```css | ||
#nonexistent { | ||
--my-mixin: { | ||
background: red; | ||
} | ||
} | ||
``` | ||
with an element style definition of | ||
```css | ||
:host { | ||
display: block; | ||
background-color: green; | ||
@apply(--my-mixin); | ||
} | ||
``` | ||
results in the background being `transparent`, as an empty `background` definition replaces | ||
the `@apply` definition. | ||
For this reason, we recommend avoiding shorthand properties. | ||
### Example: | ||
@@ -319,5 +350,7 @@ | ||
You must have a selector to the left of the `::slotted` | ||
You must have a selector for ascendants of the `<slot>` element when using the `::slotted` | ||
pseudo-element. | ||
You cannot use any selector for the `<slot>` element. Rules like `.foo .bar::slotted(*)` are not supported. | ||
### Custom properties and `@apply` | ||
@@ -369,2 +402,2 @@ | ||
ShadyCSS works by processing a template for a given custom element class. Only the style | ||
elements present in that template will be scoped for the custom element's ShadowRoot. | ||
elements present in that template will be scoped for the custom element's ShadowRoot. |
@@ -20,34 +20,34 @@ (function(){/* | ||
function Ga(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var e=a.getAttribute(Ha);c?e&&(b=e.replace("style-scope","").replace(b,""),E(a,b)):E(a,(e?e+" ":"")+"style-scope "+b)}}function L(a,b,c){var e=K,d=a.__cssBuild;t||"shady"===d?b=z(b,c):(a=F(a),b=Ia(e,b,a.is,a.u,c)+"\n\n");return b.trim()} | ||
function Ia(a,b,c,e,d){var f=M(c,e);c=c?Ja+c:"";return z(b,function(b){b.c||(b.selector=b.g=Ka(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function M(a,b){return b?"[is="+a+"]":a}function Ka(a,b,c,e,d){var f=b.selector.split(La);if(!Aa(b)){b=0;for(var h=f.length,g;b<h&&(g=f[b]);b++)f[b]=c.call(a,g,e,d)}return f.join(La)}function Ma(a){return a.replace(Na,function(a,c,e){-1<e.indexOf("+")?e=e.replace(/\+/g,"___"):-1<e.indexOf("___")&&(e=e.replace(/___/g,"+"));return":"+c+"("+e+")"})} | ||
I.prototype.b=function(a,b,c){var e=!1;a=a.trim();var d=Na.test(a);d&&(a=a.replace(Na,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=Ma(a));a=a.replace(Oa,Pa+" $1");a=a.replace(Qa,function(a,d,g){e||(a=Ra(g,d,b,c),e=e||a.stop,d=a.H,g=a.value);return d+g});d&&(a=Ma(a));return a}; | ||
function Ra(a,b,c,e){var d=a.indexOf(Sa);0<=a.indexOf(Pa)?a=Ta(a,e):0!==d&&(a=c?Ua(a,c):a);c=!1;0<=d&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Va,function(a,b){return" > "+b}))}a=a.replace(Wa,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,H:b,stop:f}}function Ua(a,b){a=a.split(Xa);a[0]+=b;return a.join(Xa)} | ||
function Ta(a,b){var c=a.match(Ya);return(c=c&&c[2].trim()||"")?c[0].match(Za)?a.replace(Ya,function(a,c,f){return b+f}):c.split(Za)[0]===b?c:$a:a.replace(Pa,b)}function ab(a){a.selector===bb&&(a.selector="html")}I.prototype.c=function(a){return a.match(Sa)?this.b(a,cb):Ua(a.trim(),cb)};aa.Object.defineProperties(I.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}}); | ||
var Na=/:(nth[-\w]+)\(([^)]+)\)/,cb=":not(.style-scope)",La=",",Qa=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Za=/[[.:#*]/,Pa=":host",bb=":root",Sa="::slotted",Oa=new RegExp("^("+Sa+")"),Ya=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Va=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Wa=/(.*):dir\((?:(ltr|rtl))\)/,Ja=".",Xa=":",Ha="class",$a="should_not_match",K=new I;function db(){} | ||
function eb(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var e=0;e<c.addedNodes.length;e++){var d=c.addedNodes[e];if(d.nodeType===Node.ELEMENT_NODE){var f=d.getRootNode();var h=d;var g=[];h.classList?g=Array.from(h.classList):h instanceof window.SVGElement&&h.hasAttribute("class")&&(g=h.getAttribute("class").split(/\s+/));h=g;g=h.indexOf(K.a);if((h=-1<g?h[g+1]:"")&&f===d.ownerDocument)J(d,h,!0);else if(f.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f= | ||
function Ia(a,b,c,e,d){var f=M(c,e);c=c?Ja+c:"";return z(b,function(b){b.c||(b.selector=b.g=N(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function M(a,b){return b?"[is="+a+"]":a}function N(a,b,c,e,d){var f=b.selector.split(Ka);if(!Aa(b)){b=0;for(var h=f.length,g;b<h&&(g=f[b]);b++)f[b]=c.call(a,g,e,d)}return f.join(Ka)}function La(a){return a.replace(Ma,function(a,c,e){-1<e.indexOf("+")?e=e.replace(/\+/g,"___"):-1<e.indexOf("___")&&(e=e.replace(/___/g,"+"));return":"+c+"("+e+")"})} | ||
I.prototype.b=function(a,b,c){var e=!1;a=a.trim();var d=Ma.test(a);d&&(a=a.replace(Ma,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=La(a));a=a.replace(Na,Oa+" $1");a=a.replace(Pa,function(a,d,g){e||(a=Qa(g,d,b,c),e=e||a.stop,d=a.H,g=a.value);return d+g});d&&(a=La(a));return a}; | ||
function Qa(a,b,c,e){var d=a.indexOf(Ra);0<=a.indexOf(Oa)?a=Sa(a,e):0!==d&&(a=c?Ta(a,c):a);c=!1;0<=d&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Ua,function(a,b){return" > "+b}))}a=a.replace(Va,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,H:b,stop:f}}function Ta(a,b){a=a.split(Wa);a[0]+=b;return a.join(Wa)} | ||
function Sa(a,b){var c=a.match(Xa);return(c=c&&c[2].trim()||"")?c[0].match(Ya)?a.replace(Xa,function(a,c,f){return b+f}):c.split(Ya)[0]===b?c:Za:a.replace(Oa,b)}function $a(a){a.selector===ab&&(a.selector="html")}I.prototype.c=function(a){return a.match(Ra)?this.b(a,bb):Ta(a.trim(),bb)};aa.Object.defineProperties(I.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}}); | ||
var Ma=/:(nth[-\w]+)\(([^)]+)\)/,bb=":not(.style-scope)",Ka=",",Pa=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Ya=/[[.:#*]/,Oa=":host",ab=":root",Ra="::slotted",Na=new RegExp("^("+Ra+")"),Xa=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Ua=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Va=/(.*):dir\((?:(ltr|rtl))\)/,Ja=".",Wa=":",Ha="class",Za="should_not_match",K=new I;function cb(){} | ||
function db(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var e=0;e<c.addedNodes.length;e++){var d=c.addedNodes[e];if(d.nodeType===Node.ELEMENT_NODE){var f=d.getRootNode();var h=d;var g=[];h.classList?g=Array.from(h.classList):h instanceof window.SVGElement&&h.hasAttribute("class")&&(g=h.getAttribute("class").split(/\s+/));h=g;g=h.indexOf(K.a);if((h=-1<g?h[g+1]:"")&&f===d.ownerDocument)J(d,h,!0);else if(f.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f= | ||
f.host))if(f=F(f).is,h===f)for(d=window.ShadyDOM.nativeMethods.querySelectorAll.call(d,":not(."+K.a+")"),f=0;f<d.length;f++)Ga(d[f],h);else h&&J(d,h,!0),J(d,f)}}}} | ||
if(!t){var fb=new MutationObserver(eb),gb=function(a){fb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)gb(document);else{var hb=function(){gb(document.body)};window.HTMLImports?window.HTMLImports.whenReady(hb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){hb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",a)}else hb()})}db=function(){eb(fb.takeRecords())}} | ||
var ib=db;function N(a,b,c,e,d){this.j=a||null;this.b=b||null;this.B=c||[];this.s=null;this.u=d||"";this.a=this.h=this.m=null}function O(a){return a?a.__styleInfo:null}function jb(a,b){return a.__styleInfo=b}N.prototype.c=function(){return this.j};N.prototype._getStyleRules=N.prototype.c;var Q=window.Element.prototype,kb=Q.matches||Q.matchesSelector||Q.mozMatchesSelector||Q.msMatchesSelector||Q.oMatchesSelector||Q.webkitMatchesSelector,lb=navigator.userAgent.match("Trident");function mb(){}function nb(a){var b={},c=[],e=0;A(a,function(a){R(a);a.index=e++;a=a.f.cssText;for(var c;c=va.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var d in b)a.push(d);return a} | ||
if(!t){var eb=new MutationObserver(db),fb=function(a){eb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)fb(document);else{var gb=function(){fb(document.body)};window.HTMLImports?window.HTMLImports.whenReady(gb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){gb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",a)}else gb()})}cb=function(){db(eb.takeRecords())}} | ||
var hb=cb;function P(a,b,c,e,d){this.j=a||null;this.b=b||null;this.B=c||[];this.s=null;this.u=d||"";this.a=this.h=this.m=null}function Q(a){return a?a.__styleInfo:null}function ib(a,b){return a.__styleInfo=b}P.prototype.c=function(){return this.j};P.prototype._getStyleRules=P.prototype.c;function jb(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var kb=navigator.userAgent.match("Trident");function lb(){}function mb(a){var b={},c=[],e=0;A(a,function(a){R(a);a.index=e++;a=a.f.cssText;for(var c;c=va.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var d in b)a.push(d);return a} | ||
function R(a){if(!a.f){var b={},c={};S(a,c)&&(b.i=c,a.rules=null);b.cssText=a.parsedCssText.replace(ya,"").replace(w,"");a.f=b}}function S(a,b){var c=a.f;if(c){if(c.i)return Object.assign(b,c.i),!0}else{c=a.parsedCssText;for(var e;a=w.exec(c);){e=(a[2]||a[3]).trim();if("inherit"!==e||"unset"!==e)b[a[1].trim()]=e;e=!0}return e}} | ||
function T(a,b,c){b&&(b=0<=b.indexOf(";")?ob(a,b,c):Ca(b,function(b,d,f,h){if(!d)return b+h;(d=T(a,c[d],c))&&"initial"!==d?"apply-shim-inherit"===d&&(d="inherit"):d=T(a,c[f]||f,c)||f;return b+(d||"")+h}));return b&&b.trim()||""} | ||
function ob(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){y.lastIndex=0;if(f=y.exec(d))d=T(a,c[f[1]],c);else if(f=d.indexOf(":"),-1!==f){var h=d.substring(f);h=h.trim();h=T(a,h,c)||h;d=d.substring(0,f)+h}b[e]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return b.join(";")} | ||
function pb(a,b){var c={},e=[];A(a,function(a){a.f||R(a);var d=a.g||a.parsedSelector;b&&a.f.i&&d&&kb.call(b,d)&&(S(a,c),a=a.index,d=parseInt(a/32,10),e[d]=(e[d]||0)|1<<a%32)},null,!0);return{i:c,key:e}} | ||
function qb(a,b,c,e,d){c.f||R(c);if(c.f.i){b=F(b);a=b.is;b=b.u;b=a?M(a,b):"html";var f=c.parsedSelector,h=":host > *"===f||"html"===f,g=0===f.indexOf(":host")&&!h;"shady"===e&&(h=f===b+" > *."+b||-1!==f.indexOf("html"),g=!h&&0===f.indexOf(b));"shadow"===e&&(h=":host > *"===f||"html"===f,g=g&&!h);if(h||g)e=b,g&&(t&&!c.g&&(c.g=Ka(K,c,K.b,a?Ja+a:"",b)),e=c.g||b),d({M:e,K:g,S:h})}} | ||
function rb(a,b){var c={},e={},d=U,f=b&&b.__cssBuild;A(b,function(b){qb(d,a,b,f,function(d){kb.call(a.A||a,d.M)&&(d.K?S(b,c):S(b,e))})},null,!0);return{L:e,J:c}} | ||
function sb(a,b,c,e){var d=F(b),f=M(d.is,d.u),h=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])");d=O(b).j;var g=tb(d,e);return L(b,d,function(b){var d="";b.f||R(b);b.f.cssText&&(d=ob(a,b.f.cssText,c));b.cssText=d;if(!t&&!Aa(b)&&b.cssText){var k=d=b.cssText;null==b.C&&(b.C=wa.test(d));if(b.C)if(null==b.w){b.w=[];for(var q in g)k=g[q],k=k(d),d!==k&&(d=k,b.w.push(q))}else{for(q=0;q<b.w.length;++q)k=g[b.w[q]],d=k(d);k=d}b.cssText=k;b.g=b.g||b.selector;d="."+e;q=b.g.split(","); | ||
k=0;for(var zb=q.length,P;k<zb&&(P=q[k]);k++)q[k]=P.match(h)?P.replace(f,d):d+" "+P;b.selector=q.join(",")}})}function tb(a,b){a=a.b;var c={};if(!t&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,h=b;f.l=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+h;f.g=f.g||f.selector;f.selector=f.g.replace(f.keyframesName,f.a);c[d.keyframesName]=ub(d)}return c}function ub(a){return function(b){return b.replace(a.l,a.a)}} | ||
function vb(a,b){var c=U,e=B(a);a.textContent=z(e,function(a){var d=a.cssText=a.parsedCssText;a.f&&a.f.cssText&&(d=d.replace(ma,"").replace(na,""),a.cssText=ob(c,d,b))})}aa.Object.defineProperties(mb.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var U=new mb;var wb={},V=window.customElements;if(V&&!t){var xb=V.define;V.define=function(a,b,c){var e=document.createComment(" Shady DOM styles for "+a+" "),d=document.head;d.insertBefore(e,(D?D.nextSibling:null)||d.firstChild);D=e;wb[a]=e;return xb.call(V,a,b,c)}};var W=new function(){this.cache={};this.a=100};function X(){var a=this;this.A={};this.c=document.documentElement;var b=new n;b.rules=[];this.l=jb(this.c,new N(b));this.v=!1;this.b=this.a=null;Ea(function(){Y(a)})}l=X.prototype;l.F=function(){ib()};l.I=function(a){return B(a)};l.O=function(a){return z(a)}; | ||
function T(a,b,c){b&&(b=0<=b.indexOf(";")?nb(a,b,c):Ca(b,function(b,d,f,h){if(!d)return b+h;(d=T(a,c[d],c))&&"initial"!==d?"apply-shim-inherit"===d&&(d="inherit"):d=T(a,c[f]||f,c)||f;return b+(d||"")+h}));return b&&b.trim()||""} | ||
function nb(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){y.lastIndex=0;if(f=y.exec(d))d=T(a,c[f[1]],c);else if(f=d.indexOf(":"),-1!==f){var h=d.substring(f);h=h.trim();h=T(a,h,c)||h;d=d.substring(0,f)+h}b[e]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return b.join(";")} | ||
function ob(a,b){var c={},e=[];A(a,function(a){a.f||R(a);var d=a.g||a.parsedSelector;b&&a.f.i&&d&&jb.call(b,d)&&(S(a,c),a=a.index,d=parseInt(a/32,10),e[d]=(e[d]||0)|1<<a%32)},null,!0);return{i:c,key:e}} | ||
function pb(a,b,c,e,d){c.f||R(c);if(c.f.i){b=F(b);a=b.is;b=b.u;b=a?M(a,b):"html";var f=c.parsedSelector,h=":host > *"===f||"html"===f,g=0===f.indexOf(":host")&&!h;"shady"===e&&(h=f===b+" > *."+b||-1!==f.indexOf("html"),g=!h&&0===f.indexOf(b));"shadow"===e&&(h=":host > *"===f||"html"===f,g=g&&!h);if(h||g)e=b,g&&(c.g||(c.g=N(K,c,K.b,a?Ja+a:"",b)),e=c.g||b),d({M:e,K:g,S:h})}} | ||
function qb(a,b){var c={},e={},d=U,f=b&&b.__cssBuild;A(b,function(b){pb(d,a,b,f,function(d){jb.call(a.A||a,d.M)&&(d.K?S(b,c):S(b,e))})},null,!0);return{L:e,J:c}} | ||
function rb(a,b,c,e){var d=F(b),f=M(d.is,d.u),h=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])");d=Q(b).j;var g=sb(d,e);return L(b,d,function(b){var d="";b.f||R(b);b.f.cssText&&(d=nb(a,b.f.cssText,c));b.cssText=d;if(!t&&!Aa(b)&&b.cssText){var k=d=b.cssText;null==b.C&&(b.C=wa.test(d));if(b.C)if(null==b.w){b.w=[];for(var q in g)k=g[q],k=k(d),d!==k&&(d=k,b.w.push(q))}else{for(q=0;q<b.w.length;++q)k=g[b.w[q]],d=k(d);k=d}b.cssText=k;b.g=b.g||b.selector;d="."+e;q=b.g.split(","); | ||
k=0;for(var yb=q.length,O;k<yb&&(O=q[k]);k++)q[k]=O.match(h)?O.replace(f,d):d+" "+O;b.selector=q.join(",")}})}function sb(a,b){a=a.b;var c={};if(!t&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,h=b;f.l=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+h;f.g=f.g||f.selector;f.selector=f.g.replace(f.keyframesName,f.a);c[d.keyframesName]=tb(d)}return c}function tb(a){return function(b){return b.replace(a.l,a.a)}} | ||
function ub(a,b){var c=U,e=B(a);a.textContent=z(e,function(a){var d=a.cssText=a.parsedCssText;a.f&&a.f.cssText&&(d=d.replace(ma,"").replace(na,""),a.cssText=nb(c,d,b))})}aa.Object.defineProperties(lb.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var U=new lb;var vb={},V=window.customElements;if(V&&!t){var wb=V.define;V.define=function(a,b,c){var e=document.createComment(" Shady DOM styles for "+a+" "),d=document.head;d.insertBefore(e,(D?D.nextSibling:null)||d.firstChild);D=e;vb[a]=e;return wb.call(V,a,b,c)}};var W=new function(){this.cache={};this.a=100};function X(){var a=this;this.A={};this.c=document.documentElement;var b=new n;b.rules=[];this.l=ib(this.c,new P(b));this.v=!1;this.b=this.a=null;Ea(function(){Y(a)})}l=X.prototype;l.F=function(){hb()};l.I=function(a){return B(a)};l.O=function(a){return z(a)}; | ||
l.prepareTemplate=function(a,b,c){if(!a.l){a.l=!0;a.name=b;a.extends=c;m[b]=a;var e=(e=a.content.querySelector("style"))?e.getAttribute("css-build")||"":"";var d=[];for(var f=a.content.querySelectorAll("style"),h=0;h<f.length;h++){var g=f[h];if(g.hasAttribute("shady-unscoped")){if(!t){var k=g.textContent;za.has(k)||(za.add(k),k=g.cloneNode(!0),document.head.appendChild(k));g.parentNode.removeChild(g)}}else d.push(g.textContent),g.parentNode.removeChild(g)}d=d.join("").trim();c={is:b,extends:c,P:e}; | ||
t||J(a.content,b);Y(this);f=y.test(d)||w.test(d);y.lastIndex=0;w.lastIndex=0;d=p(d);f&&v&&this.a&&this.a.transformRules(d,b);a._styleAst=d;a.v=e;e=[];v||(e=nb(a._styleAst));if(!e.length||v)d=t?a.content:null,b=wb[b],f=L(c,a._styleAst),b=f.length?C(f,c.is,d,b):void 0,a.a=b;a.c=e}}; | ||
function yb(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.D(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.v)&&a.o()})})}function Y(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=ra);yb(a)} | ||
l.o=function(){Y(this);if(this.b){var a=this.b.processStyles();if(this.b.enqueued){if(v)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&v&&this.a){var e=B(c);Y(this);this.a.transformRules(e);c.textContent=z(e)}}else for(Ab(this,this.c,this.l),b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&vb(c,this.l.m);this.b.enqueued=!1;this.v&&!v&&this.styleDocument()}}}; | ||
l.styleElement=function(a,b){var c=F(a).is,e=O(a);if(!e){var d=F(a);e=d.is;d=d.u;var f=wb[e];e=m[e];if(e){var h=e._styleAst;var g=e.c}e=jb(a,new N(h,f,g,0,d))}a!==this.c&&(this.v=!0);b&&(e.s=e.s||{},Object.assign(e.s,b));if(v){if(e.s){b=e.s;for(var k in b)null===k?a.style.removeProperty(k):a.style.setProperty(k,b[k])}if(((k=m[c])||a===this.c)&&k&&k.a&&!sa(k)){if(sa(k)||k._applyShimValidatingVersion!==k._applyShimNextVersion)Y(this),this.a&&this.a.transformRules(k._styleAst,c),k.a.textContent=L(a, | ||
e.j),ta(k);t&&(c=a.shadowRoot)&&(c.querySelector("style").textContent=L(a,e.j));e.j=k._styleAst}}else if(Ab(this,a,e),e.B&&e.B.length){c=e;k=F(a).is;a:{if(b=W.cache[k])for(h=b.length-1;0<=h;h--){g=b[h];b:{e=c.B;for(d=0;d<e.length;d++)if(f=e[d],g.i[f]!==c.m[f]){e=!1;break b}e=!0}if(e){b=g;break a}}b=void 0}e=b?b.styleElement:null;h=c.h;(g=b&&b.h)||(g=this.A[k]=(this.A[k]||0)+1,g=k+"-"+g);c.h=g;g=c.h;d=U;d=e?e.textContent||"":sb(d,a,c.m,g);f=O(a);var x=f.a;x&&!t&&x!==e&&(x._useCount--,0>=x._useCount&& | ||
x.parentNode&&x.parentNode.removeChild(x));t?f.a?(f.a.textContent=d,e=f.a):d&&(e=C(d,g,a.shadowRoot,f.b)):e?e.parentNode||(lb&&-1<d.indexOf("@media")&&(e.textContent=d),Ba(e,null,f.b)):d&&(e=C(d,g,null,f.b));e&&(e._useCount=e._useCount||0,f.a!=e&&e._useCount++,f.a=e);g=e;t||(e=c.h,f=d=a.getAttribute("class")||"",h&&(f=d.replace(new RegExp("\\s*x-scope\\s*"+h+"\\s*","g")," ")),f+=(f?" ":"")+"x-scope "+e,d!==f&&E(a,f));b||(a=W.cache[k]||[],a.push({i:c.m,styleElement:g,h:c.h}),a.length>W.a&&a.shift(), | ||
W.cache[k]=a)}};function Bb(a,b){return(b=b.getRootNode().host)?O(b)?b:Bb(a,b):a.c}function Ab(a,b,c){a=Bb(a,b);var e=O(a);a=Object.create(e.m||null);var d=rb(b,c.j);b=pb(e.j,b).i;Object.assign(a,d.J,b,d.L);b=c.s;for(var f in b)if((d=b[f])||0===d)a[f]=d;f=U;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=T(f,a[e],a);c.m=a}l.styleDocument=function(a){this.styleSubtree(this.c,a)}; | ||
l.styleSubtree=function(a,b){var c=a.shadowRoot;(c||a===this.c)&&this.styleElement(a,b);if(b=c&&(c.children||c.childNodes))for(a=0;a<b.length;a++)this.styleSubtree(b[a]);else if(a=a.children||a.childNodes)for(b=0;b<a.length;b++)this.styleSubtree(a[b])};l.D=function(a){var b=this,c=B(a);A(c,function(a){if(t)ab(a);else{var c=K;a.selector=a.parsedSelector;ab(a);a.selector=a.g=Ka(c,a,c.c,void 0,void 0)}v&&(Y(b),b.a&&b.a.transformRule(a))});v?a.textContent=z(c):this.l.j.rules.push(c)}; | ||
l.getComputedStyleValue=function(a,b){var c;v||(c=(O(a)||O(Bb(this,a))).m[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};l.N=function(a,b){var c=a.getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var e=a.getAttribute("class");if(e){e=e.split(/\s/);for(var d=0;d<e.length;d++)if(e[d]===K.a){c=e[d+1];break}}}c&&b.push(K.a,c);v||(c=O(a))&&c.h&&b.push(U.a,c.h);E(a,b.join(" "))};l.G=function(a){return O(a)};X.prototype.flush=X.prototype.F; | ||
t||J(a.content,b);Y(this);f=y.test(d)||w.test(d);y.lastIndex=0;w.lastIndex=0;d=p(d);f&&v&&this.a&&this.a.transformRules(d,b);a._styleAst=d;a.v=e;e=[];v||(e=mb(a._styleAst));if(!e.length||v)d=t?a.content:null,b=vb[b],f=L(c,a._styleAst),b=f.length?C(f,c.is,d,b):void 0,a.a=b;a.c=e}}; | ||
function xb(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.D(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.v)&&a.o()})})}function Y(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=ra);xb(a)} | ||
l.o=function(){Y(this);if(this.b){var a=this.b.processStyles();if(this.b.enqueued){if(v)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&v&&this.a){var e=B(c);Y(this);this.a.transformRules(e);c.textContent=z(e)}}else for(zb(this,this.c,this.l),b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&ub(c,this.l.m);this.b.enqueued=!1;this.v&&!v&&this.styleDocument()}}}; | ||
l.styleElement=function(a,b){var c=F(a).is,e=Q(a);if(!e){var d=F(a);e=d.is;d=d.u;var f=vb[e];e=m[e];if(e){var h=e._styleAst;var g=e.c}e=ib(a,new P(h,f,g,0,d))}a!==this.c&&(this.v=!0);b&&(e.s=e.s||{},Object.assign(e.s,b));if(v){if(e.s){b=e.s;for(var k in b)null===k?a.style.removeProperty(k):a.style.setProperty(k,b[k])}if(((k=m[c])||a===this.c)&&k&&k.a&&!sa(k)){if(sa(k)||k._applyShimValidatingVersion!==k._applyShimNextVersion)Y(this),this.a&&this.a.transformRules(k._styleAst,c),k.a.textContent=L(a, | ||
e.j),ta(k);t&&(c=a.shadowRoot)&&(c.querySelector("style").textContent=L(a,e.j));e.j=k._styleAst}}else if(zb(this,a,e),e.B&&e.B.length){c=e;k=F(a).is;a:{if(b=W.cache[k])for(h=b.length-1;0<=h;h--){g=b[h];b:{e=c.B;for(d=0;d<e.length;d++)if(f=e[d],g.i[f]!==c.m[f]){e=!1;break b}e=!0}if(e){b=g;break a}}b=void 0}e=b?b.styleElement:null;h=c.h;(g=b&&b.h)||(g=this.A[k]=(this.A[k]||0)+1,g=k+"-"+g);c.h=g;g=c.h;d=U;d=e?e.textContent||"":rb(d,a,c.m,g);f=Q(a);var x=f.a;x&&!t&&x!==e&&(x._useCount--,0>=x._useCount&& | ||
x.parentNode&&x.parentNode.removeChild(x));t?f.a?(f.a.textContent=d,e=f.a):d&&(e=C(d,g,a.shadowRoot,f.b)):e?e.parentNode||(kb&&-1<d.indexOf("@media")&&(e.textContent=d),Ba(e,null,f.b)):d&&(e=C(d,g,null,f.b));e&&(e._useCount=e._useCount||0,f.a!=e&&e._useCount++,f.a=e);g=e;t||(e=c.h,f=d=a.getAttribute("class")||"",h&&(f=d.replace(new RegExp("\\s*x-scope\\s*"+h+"\\s*","g")," ")),f+=(f?" ":"")+"x-scope "+e,d!==f&&E(a,f));b||(a=W.cache[k]||[],a.push({i:c.m,styleElement:g,h:c.h}),a.length>W.a&&a.shift(), | ||
W.cache[k]=a)}};function Ab(a,b){return(b=b.getRootNode().host)?Q(b)?b:Ab(a,b):a.c}function zb(a,b,c){a=Ab(a,b);var e=Q(a);a=Object.create(e.m||null);var d=qb(b,c.j);b=ob(e.j,b).i;Object.assign(a,d.J,b,d.L);b=c.s;for(var f in b)if((d=b[f])||0===d)a[f]=d;f=U;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=T(f,a[e],a);c.m=a}l.styleDocument=function(a){this.styleSubtree(this.c,a)}; | ||
l.styleSubtree=function(a,b){var c=a.shadowRoot;(c||a===this.c)&&this.styleElement(a,b);if(b=c&&(c.children||c.childNodes))for(a=0;a<b.length;a++)this.styleSubtree(b[a]);else if(a=a.children||a.childNodes)for(b=0;b<a.length;b++)this.styleSubtree(a[b])};l.D=function(a){var b=this,c=B(a);A(c,function(a){if(t)$a(a);else{var c=K;a.selector=a.parsedSelector;$a(a);a.selector=a.g=N(c,a,c.c,void 0,void 0)}v&&(Y(b),b.a&&b.a.transformRule(a))});v?a.textContent=z(c):this.l.j.rules.push(c)}; | ||
l.getComputedStyleValue=function(a,b){var c;v||(c=(Q(a)||Q(Ab(this,a))).m[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};l.N=function(a,b){var c=a.getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var e=a.getAttribute("class");if(e){e=e.split(/\s/);for(var d=0;d<e.length;d++)if(e[d]===K.a){c=e[d+1];break}}}c&&b.push(K.a,c);v||(c=Q(a))&&c.h&&b.push(U.a,c.h);E(a,b.join(" "))};l.G=function(a){return Q(a)};X.prototype.flush=X.prototype.F; | ||
X.prototype.prepareTemplate=X.prototype.prepareTemplate;X.prototype.styleElement=X.prototype.styleElement;X.prototype.styleDocument=X.prototype.styleDocument;X.prototype.styleSubtree=X.prototype.styleSubtree;X.prototype.getComputedStyleValue=X.prototype.getComputedStyleValue;X.prototype.setElementClass=X.prototype.N;X.prototype._styleInfoForNode=X.prototype.G;X.prototype.transformCustomStyleForDocument=X.prototype.D;X.prototype.getStyleAst=X.prototype.I;X.prototype.styleAstToString=X.prototype.O; | ||
X.prototype.flushCustomStyles=X.prototype.o;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return t}},nativeCss:{get:function(){return v}}});var Z=new X,Cb,Db;window.ShadyCSS&&(Cb=window.ShadyCSS.ApplyShim,Db=window.ShadyCSS.CustomStyleInterface);window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.o();Z.prepareTemplate(a,b,c)},styleSubtree:function(a,b){Z.o();Z.styleSubtree(a,b)},styleElement:function(a){Z.o();Z.styleElement(a)},styleDocument:function(a){Z.o();Z.styleDocument(a)},getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:v,nativeShadow:t};Cb&&(window.ShadyCSS.ApplyShim=Cb); | ||
Db&&(window.ShadyCSS.CustomStyleInterface=Db);}).call(this); | ||
X.prototype.flushCustomStyles=X.prototype.o;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return t}},nativeCss:{get:function(){return v}}});var Z=new X,Bb,Cb;window.ShadyCSS&&(Bb=window.ShadyCSS.ApplyShim,Cb=window.ShadyCSS.CustomStyleInterface);window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.o();Z.prepareTemplate(a,b,c)},styleSubtree:function(a,b){Z.o();Z.styleSubtree(a,b)},styleElement:function(a){Z.o();Z.styleElement(a)},styleDocument:function(a){Z.o();Z.styleDocument(a)},getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:v,nativeShadow:t};Bb&&(window.ShadyCSS.ApplyShim=Bb); | ||
Cb&&(window.ShadyCSS.CustomStyleInterface=Cb);}).call(this); | ||
//# sourceMappingURL=scoping-shim.min.js.map |
@@ -81,2 +81,3 @@ /** | ||
const INITIAL_INHERIT = /^\s*(initial)|(inherit)\s*$/; | ||
const IMPORTANT = /\s*!important/; | ||
@@ -311,9 +312,13 @@ // separator used between mixin-name and mixin-property-name when producing properties | ||
let p, parts, f; | ||
for (p in mixinEntry.properties) { | ||
const properties = mixinEntry.properties; | ||
for (p in properties) { | ||
f = fallbacks && fallbacks[p]; | ||
parts = [p, ': var(', mixinName, MIXIN_VAR_SEP, p]; | ||
if (f) { | ||
parts.push(',', f); | ||
parts.push(',', f.replace(IMPORTANT, '')); | ||
} | ||
parts.push(')'); | ||
if (IMPORTANT.test(properties[p])) { | ||
parts.push(' !important'); | ||
} | ||
vars.push(parts.join('')); | ||
@@ -479,2 +484,2 @@ } | ||
export default ApplyShim; | ||
export default ApplyShim; |
@@ -22,7 +22,12 @@ /** | ||
/** | ||
* @const {function(string):boolean} | ||
* @param {string} selector | ||
* @return {boolean} | ||
* @this {Element} | ||
*/ | ||
const matchesSelector = ((p) => p.matches || p.matchesSelector || | ||
p.mozMatchesSelector || p.msMatchesSelector || | ||
p.oMatchesSelector || p.webkitMatchesSelector)(window.Element.prototype); | ||
const matchesSelector = function(selector) { | ||
const method = this.matches || this.matchesSelector || | ||
this.mozMatchesSelector || this.msMatchesSelector || | ||
this.oMatchesSelector || this.webkitMatchesSelector; | ||
return method && method.call(this, selector); | ||
}; | ||
@@ -331,4 +336,4 @@ const IS_IE = navigator.userAgent.match('Trident'); | ||
if (isHost) { | ||
// need to transform :host under ShadowDOM because `:host` does not work with `matches` | ||
if (nativeShadow && !rule.transformedSelector) { | ||
// need to transform :host because `:host` does not work with `matches` | ||
if (!rule.transformedSelector) { | ||
// transform :host into a matchable selector | ||
@@ -335,0 +340,0 @@ rule.transformedSelector = |
{ | ||
"suites": ["tests/runner.html"] | ||
"suites": ["tests/runner.html"], | ||
"plugins": { | ||
"local": { | ||
"browserOptions": { | ||
"chrome": [ | ||
"no-sandbox" | ||
] | ||
} | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
535477
82
4077
401
20