blob: ea976e688943bbe510f5ed7fbc876d2200870376 [file] [log] [blame]
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/core"),require("@angular/flex-layout/core"),require("@angular/platform-server")):"function"==typeof define&&define.amd?define("@angular/flex-layout/server",["exports","@angular/common","@angular/core","@angular/flex-layout/core","@angular/platform-server"],t):t((e.ng=e.ng||{},e.ng.flexLayout=e.ng.flexLayout||{},e.ng.flexLayout.server={}),e.ng.common,e.ng.core,e.ng.flexLayout.core,e.ng.platformServer)}(this,function(e,t,r,n,o){"use strict";function i(e,t){function r(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,o){var i=new Map,a=new Map(e.stylesheet),u=c(a,"all",i);r.slice().sort(n.sortAscendingPriority).forEach(function(n,o){e.clearStyles(),t.activateBreakpoint(n);var a=new Map(e.stylesheet);a.size>0&&(u+=c(a,n.mediaQuery,i)),t.deactivateBreakpoint(r[o])});var s=o.ssrObserveBreakpoints;return s&&s.reduce(function(e,t){var n=r.find(function(e){return t===e.alias});return n?e.push(n):console.warn('FlexLayoutServerModule: unknown breakpoint alias "'+t+'"'),e},[]).forEach(t.activateBreakpoint),u}function u(e,t,r,o,i){return function(){var u=r.createElement("style"),c=a(e,t,o,i);u.classList.add(n.CLASS_NAME+"ssr"),u.textContent=c,r.head.appendChild(u)}}function c(e,t,r){var n="";return e.forEach(function(e,t){var o="",i=f(t,r);e.forEach(function(e,t){o+=e?s(t+":"+e+";"):""}),n+=s("."+i+" {",o,"}")}),s("@media "+t+" {",n,"}")}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r="";return e.forEach(function(e,t){r+=_?l(e,0!==t):e}),r}function l(e,t){return void 0===t&&(t=!0),t?"\n"+e:e+"\n"}function f(e,t){var r=t.get(e);return r||(r=""+n.CLASS_NAME+h++,t.set(e,r)),e.classList.add(r),r}var p=function(e,t){return(p=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)},d=function(){function e(e){this._mediaQuery=e,this._isActive=!1,this._listeners=[],this.onchange=null}return Object.defineProperty(e.prototype,"matches",{get:function(){return this._isActive},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"media",{get:function(){return this._mediaQuery},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.deactivate(),this._listeners=[]},e.prototype.activate=function(){var e=this;return this._isActive||(this._isActive=!0,this._listeners.forEach(function(t){t.call(null,e)})),this},e.prototype.deactivate=function(){var e=this;return this._isActive&&(this._isActive=!1,this._listeners.forEach(function(t){t.call(null,e)})),this},e.prototype.addListener=function(e){if(-1===this._listeners.indexOf(e)&&this._listeners.push(e),this._isActive){e.call(null,this)}},e.prototype.removeListener=function(e){},e.prototype.addEventListener=function(e,t,r){},e.prototype.removeEventListener=function(e,t,r){},e.prototype.dispatchEvent=function(e){return!1},e}(),y=function(e){function n(t,r,n){var o=e.call(this,t,r,n)||this;return o._zone=t,o._platformId=r,o._document=n,o}return i(n,e),n.prototype.activateBreakpoint=function(e){var t=this.registry.get(e.mediaQuery);t&&t.activate()},n.prototype.deactivateBreakpoint=function(e){var t=this.registry.get(e.mediaQuery);t&&t.deactivate()},n.prototype.buildMQL=function(e){return new d(e)},n.decorators=[{type:r.Injectable}],n.ctorParameters=function(){return[{type:r.NgZone},{type:Object,decorators:[{type:r.Inject,args:[r.PLATFORM_ID]}]},{type:void 0,decorators:[{type:r.Inject,args:[t.DOCUMENT]}]}]},n}(nMatchMedia),v=[{provide:o.BEFORE_APP_SERIALIZED,useFactory:u,deps:[n.StylesheetMap,nMatchMedia,t.DOCUMENT,n.BREAKPOINTS,n.LAYOUT_CONFIG],multi:!0},{provide:n.SERVER_TOKEN,useValue:!0},{provide:nMatchMedia,useClass:y}],h=0,_=!1,g=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{providers:[v]}]}],e}();e.FlexLayoutServerModule=g,e.generateStaticFlexLayoutStyles=a,e.FLEX_SSR_SERIALIZER_FACTORY=u,e.SERVER_PROVIDERS=v,ea1=y,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=flex-layout-server.umd.min.js.map