UNPKG

@codebakery/origami

Version:
16 lines (14 loc) 9.69 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/router"),require("@polymer/polymer/lib/utils/style-gather"),require("@codebakery/origami/util"),require("@codebakery/origami/polyfills"),require("@angular/common"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("@codebakery/origami/styles",["exports","@angular/core","@angular/router","@polymer/polymer/lib/utils/style-gather","@codebakery/origami/util","@codebakery/origami/polyfills","@angular/common","@angular/platform-browser"],t):t(((e=e||self).codebakery=e.codebakery||{},e.codebakery.origami=e.codebakery.origami||{},e.codebakery.origami.styles={}),e.ng.core,e.ng.router,e.styleGather,e.codebakery.origami.util,e.codebakery.origami.polyfills,e.ng.common,e.ng.platformBrowser)}(this,(function(e,t,r,n,o,a,i,c){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var l;function s(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function f(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,c)}u((n=n.apply(e,t||[])).next())}))}function y(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(d(arguments[t]));return e}var h=new Map;var S=new Map;function g(){return Array.from(S.keys())}function v(e){return e&&S.get(e)||[]}var b=/:host-context\((.*)\)/g,w=/:host(?:\((.*)\))?/g;function _(e){var t=E(e);return t.forEach((function(e){!function e(t){if(Array.isArray(t.statements))t.statements.forEach((function(t){return e(t)}));else{var r=t.selector;r=(r=(r=(r=r.trim()).split(",").map((function(e){return e.trim().split(" ").map((function(e){return(e=e.trim()).includes(":host")?e:e+"[_ngcontent-%COMP%]"})).join(" ")})).join(",")).replace(b,"*$1 [_nghost-%COMP%]")).replace(w,"[_nghost-%COMP%]$1"),t.selector=r}}(e)})),R(t)}function E(e){for(var t=!1,r=!1,n=!1,o=0,a=!1,i=[],c={selector:"",block:""},u=0;u<e.length;u++){var l=e[u];switch(l){case"@":t=!0;break;case"'":r=!r;break;case'"':n=!n;break;case"{":case"}":r||n||("{"==l?o++:a=0===--o)}o?c.block+=l:a?(c.block+=l,t&&(c.statements=E(c.block.substring(c.block.indexOf("{")+1,c.block.lastIndexOf("}")))),c.selector=c.selector.trim(),c.block=c.block.trim(),i.push(c),c={selector:"",block:""},a=!1):c.selector+=l}return i}function R(e){return e.map((function(e){var t=Array.isArray(e.statements)?"{"+R(e.statements)+"}":e.block;return e.selector+" "+t})).join("\n")}var T=new Map,M=new Map;function k(e){Array.from(g()).forEach((function(t){if(!M.has(t))try{var r=e.resolveComponentFactory(t);M.set(t,r.selector),T.set(r.selector,t)}catch(e){}}))}function C(e){return T.get(e)}var O={provide:t.APP_INITIALIZER,multi:!0,useFactory:N,deps:[t.NgModuleRef]},A={provide:t.APP_INITIALIZER,multi:!0,useFactory:I,deps:[t.NgModuleRef]};function N(e){var n=I(e);return function(){n(),e.injector.get(r.Router).events.subscribe((function(e){"route"in e&&!e.route._loadedConfig&&o.whenSet(e.route,"_loadedConfig",void 0,(function(e){k(e.module.injector.get(t.ComponentFactoryResolver))}))}))}}function I(e){return function(){j(e.injector.get(t.RendererFactory2)),k(e.injector.get(t.ComponentFactoryResolver))}}var P=[];function j(e){var r=e.createRenderer;e.createRenderer=function(e,o){var a,i=e&&e.localName;if(i&&o&&-1===P.indexOf(i)){var c=v(C(i)),u=c.map((function(e){return n.stylesFromModule(e).map((function(e){return e.innerText})).join("\n")}));switch(o.encapsulation){case t.ViewEncapsulation.Emulated:default:u=u.map((function(e){return _(e)}));break;case t.ViewEncapsulation.None:case t.ViewEncapsulation.Native:case t.ViewEncapsulation.ShadowDom:}(a=o.styles).push.apply(a,m(u)),P.push(i)}return r.apply(this,arguments)}}var x=function(){function e(){}return e=s([t.NgModule({providers:[A]})],e)}(),F=function(){function e(){}return e=s([t.NgModule({providers:[O]})],e)}(),H=new t.InjectionToken("usingApply");function D(e){return p(this,void 0,void 0,(function(){var t;return y(this,(function(r){switch(r.label){case 0:return!(t=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface)||window.ShadyCSS.nativeCss&&!e?[3,2]:[4,Promise.all(Array.from(document.styleSheets).map((function(e){var r=e.ownerNode;if(L(r)&&!r.hasAttribute("scope"))return t.addCustomStyle(r),Promise.resolve();if(e.href){if(!e._fetching){var n=e.href;e._fetching=new Promise((function(e){var o=new XMLHttpRequest;o.addEventListener("load",(function(){var n=document.createElement("style");n.innerHTML=o.responseText,r.parentNode.insertBefore(n,r),r.parentNode.removeChild(r),t.addCustomStyle(n),e()})),o.open("GET",n),o.send()}))}return e._fetching}})))];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))}function L(e){return"style"===e.localName}var q=/(?:\\)(--\w[\w-_]*:\s*{[^}]*})(;)?/g,V=function(e){function r(t,r){var n=e.call(this,t)||this;return n.usingApply=r,n}return function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,e),r.prototype.addStyles=function(t){e.prototype.addStyles.call(this,t.map((function(e){return e.replace(q,"$1")})))},r.prototype.onStylesAdded=function(t){e.prototype.onStylesAdded.call(this,t),D(this.usingApply)},r=s([f(0,t.Inject(i.DOCUMENT)),f(1,t.Optional()),f(1,t.Inject(H))],r)}(c["ɵDomSharedStylesHost"]);function G(){return new V(document)}var Y={provide:c["ɵDomSharedStylesHost"],useFactory:G},X=function(){function e(){}var r;return r=e,e.usingApply=function(){return{ngModule:r,providers:[{provide:H,useValue:!0}]}},e=r=s([t.NgModule({imports:[a.WebComponentsReadyModule],providers:[Y]})],e)}();e.COMPONENT_VARIABLE="%COMP%",e.CONTENT_ATTR="_ngcontent-%COMP%",e.HOST_ATTR="_nghost-%COMP%",e.HOST_CONTEXT_REGEX=b,e.HOST_REGEX=w,e.INJECT_STYLES_NO_ROUTER_PROVIDER=A,e.INJECT_STYLES_PROVIDER=O,e.IncludeStyles=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return S.set(t,e),t}},e.IncludeStylesModule=F,e.IncludeStylesNoRouterModule=x,e.SHADYCSS_SHARED_STYLES_HOST_PROVIDER=Y,e.ShadyCSSModule=X,e.ShadyCSSSharedStylesHost=V,e.ShadyCSSSharedStylesHostFactory=G,e.USING_APPLY=H,e.clearStyleModuleCache=function(){h=new Map},e.getRegisteredTypes=g,e.getStyleModulesFor=v,e.getTypeFor=C,e.importStyleModule=function(e){if(!h.has(e)){l||(l=customElements.get("dom-module"));var t=l.import(e,"template");if(t){var r=t.content.querySelectorAll("style");h.set(e,Array.from(r).map((function(e){return e.innerText})).join("\n"))}else h.set(e,"")}return h.get(e)},e.injectIncludeStyles=N,e.injectIncludeStylesNoRouter=I,e.isStyleNode=L,e.parseStyleStatements=E,e.patchRendererFactory=j,e.processStylesheets=D,e.resetIncludeStyles=function(){S=new Map},e.resetTypeSelectors=function(){T=new Map,M=new Map},e.scanComponentFactoryResolver=k,e.statementsToString=R,e.styleToEmulatedEncapsulation=_,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=origami-styles.umd.min.js.map