Line | |
---|
1 | import { Injectable } from '@angular/core';
|
---|
2 | import * as i0 from "@angular/core";
|
---|
3 | export class FaIconLibrary {
|
---|
4 | constructor() {
|
---|
5 | this.definitions = {};
|
---|
6 | }
|
---|
7 | addIcons(...icons) {
|
---|
8 | for (const icon of icons) {
|
---|
9 | if (!(icon.prefix in this.definitions)) {
|
---|
10 | this.definitions[icon.prefix] = {};
|
---|
11 | }
|
---|
12 | this.definitions[icon.prefix][icon.iconName] = icon;
|
---|
13 | }
|
---|
14 | }
|
---|
15 | addIconPacks(...packs) {
|
---|
16 | for (const pack of packs) {
|
---|
17 | const icons = Object.keys(pack).map((key) => pack[key]);
|
---|
18 | this.addIcons(...icons);
|
---|
19 | }
|
---|
20 | }
|
---|
21 | getIconDefinition(prefix, name) {
|
---|
22 | if (prefix in this.definitions && name in this.definitions[prefix]) {
|
---|
23 | return this.definitions[prefix][name];
|
---|
24 | }
|
---|
25 | return null;
|
---|
26 | }
|
---|
27 | }
|
---|
28 | FaIconLibrary.ɵprov = i0.ɵɵdefineInjectable({ factory: function FaIconLibrary_Factory() { return new FaIconLibrary(); }, token: FaIconLibrary, providedIn: "root" });
|
---|
29 | FaIconLibrary.decorators = [
|
---|
30 | { type: Injectable, args: [{ providedIn: 'root' },] }
|
---|
31 | ];
|
---|
32 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi1saWJyYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9pY29uLWxpYnJhcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFVM0MsTUFBTSxPQUFPLGFBQWE7SUFEMUI7UUFFVSxnQkFBVyxHQUE2RCxFQUFFLENBQUM7S0F3QnBGO0lBdEJDLFFBQVEsQ0FBQyxHQUFHLEtBQXVCO1FB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GFja3MoLi4ucGFja3M6IEljb25QYWNrW10pIHtcbiAgICBmb3IgKGNvbnN0IHBhY2sgb2YgcGFja3MpIHtcbiAgICAgIGNvbnN0IGljb25zID0gT2JqZWN0LmtleXMocGFjaykubWFwKChrZXkpID0+IHBhY2tba2V5XSk7XG4gICAgICB0aGlzLmFkZEljb25zKC4uLmljb25zKTtcbiAgICB9XG4gIH1cblxuICBnZXRJY29uRGVmaW5pdGlvbihwcmVmaXg6IEljb25QcmVmaXgsIG5hbWU6IEljb25OYW1lKTogSWNvbkRlZmluaXRpb24gfCBudWxsIHtcbiAgICBpZiAocHJlZml4IGluIHRoaXMuZGVmaW5pdGlvbnMgJiYgbmFtZSBpbiB0aGlzLmRlZmluaXRpb25zW3ByZWZpeF0pIHtcbiAgICAgIHJldHVybiB0aGlzLmRlZmluaXRpb25zW3ByZWZpeF1bbmFtZV07XG4gICAgfVxuICAgIHJldHVybiBudWxsO1xuICB9XG59XG4iXX0= |
---|
Note:
See
TracBrowser
for help on using the repository browser.