@angular/flex-layout
Version:
Angular 2 Flexbox Layout
73 lines • 2.65 kB
JavaScript
import { Injectable, Inject } from '@angular/core';
import { BREAKPOINTS } from "./break-points";
/**
* Registry of 1..n MediaQuery breakpoint ranges
* This is published as a provider and may be overriden from custom, application-specific ranges
*
*/
export var BreakPointRegistry = (function () {
function BreakPointRegistry(_registry) {
this._registry = _registry;
}
Object.defineProperty(BreakPointRegistry.prototype, "items", {
/**
* Accessor to raw list
*/
get: function () {
return this._registry.slice();
},
enumerable: true,
configurable: true
});
/**
* Search breakpoints by alias (e.g. gt-xs)
*/
BreakPointRegistry.prototype.findByAlias = function (alias) {
return this._registry.find(function (bp) { return bp.alias == alias; });
};
BreakPointRegistry.prototype.findByQuery = function (query) {
return this._registry.find(function (bp) { return bp.mediaQuery == query; });
};
Object.defineProperty(BreakPointRegistry.prototype, "overlappings", {
/**
* Get all the breakpoints whose ranges could overlapping `normal` ranges;
* e.g. gt-sm overlaps md, lg, and xl
*/
get: function () {
return this._registry.filter(function (it) { return it.overlapping == true; });
},
enumerable: true,
configurable: true
});
Object.defineProperty(BreakPointRegistry.prototype, "aliases", {
/**
* Get list of all registered (non-empty) breakpoint aliases
*/
get: function () {
return this._registry.map(function (it) { return it.alias; });
},
enumerable: true,
configurable: true
});
Object.defineProperty(BreakPointRegistry.prototype, "suffixes", {
/**
* Aliases are mapped to properties using suffixes
* e.g. 'gt-sm' for property 'layout' uses suffix 'GtSm'
* for property layoutGtSM.
*/
get: function () {
return this._registry.map(function (it) { return it.suffix; });
},
enumerable: true,
configurable: true
});
BreakPointRegistry.decorators = [
{ type: Injectable },
];
/** @nocollapse */
BreakPointRegistry.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: Inject, args: [BREAKPOINTS,] },] },
]; };
return BreakPointRegistry;
}());
//# sourceMappingURL=/usr/local/google/home/tinagao/WebstormProjects/caretaker/flex-layout/src/lib/media-query/breakpoints/break-point-registry.js.map