@stemy/ngx-utils 13.0.7 → 13.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/ngx-utils/common-types.mjs +2 -1
- package/esm2020/ngx-utils/ngx-utils.module.mjs +21 -6
- package/esm2020/ngx-utils/services/config.service.mjs +8 -18
- package/esm2020/ngx-utils/utils/string.utils.mjs +14 -1
- package/esm2020/public_api.mjs +2 -2
- package/esm2020/tools/config.mjs +71 -0
- package/esm2020/tools/public_api.mjs +2 -0
- package/esm2020/tools/stemy-ngx-utils-tools.mjs +5 -0
- package/{tools/config.js → fesm2015/stemy-ngx-utils-tools.mjs} +8 -10
- package/fesm2015/stemy-ngx-utils-tools.mjs.map +1 -0
- package/fesm2015/stemy-ngx-utils.mjs +40 -21
- package/fesm2015/stemy-ngx-utils.mjs.map +1 -1
- package/fesm2020/stemy-ngx-utils-tools.mjs +77 -0
- package/fesm2020/stemy-ngx-utils-tools.mjs.map +1 -0
- package/fesm2020/stemy-ngx-utils.mjs +40 -21
- package/fesm2020/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +2 -1
- package/ngx-utils/ngx-utils.module.d.ts +2 -1
- package/ngx-utils/services/config.service.d.ts +2 -3
- package/ngx-utils/utils/string.utils.d.ts +2 -0
- package/package.json +9 -1
- package/public_api.d.ts +1 -1
- package/tools/config.d.ts +7 -0
- package/tools/package.json +10 -0
- package/tools/public_api.d.ts +1 -0
- package/tools/stemy-ngx-utils-tools.d.ts +5 -0
- package/tools/circular.js +0 -117
- package/tools/circular.js.map +0 -1
- package/tools/config.js.map +0 -1
- package/tools/icons.js +0 -14
- package/tools/icons.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function isPrimitive(value) {
|
|
2
|
+
const type = typeof value;
|
|
3
|
+
return value == null || (type !== "object" && type !== "function");
|
|
4
|
+
}
|
|
5
|
+
function isDate(value) {
|
|
6
|
+
return null !== value && !isNaN(value) && "undefined" !== typeof value.getDate;
|
|
7
|
+
}
|
|
8
|
+
function convertValue(value, type) {
|
|
9
|
+
switch (type) {
|
|
10
|
+
case "boolean":
|
|
11
|
+
value = typeof value == "string" ? value.toLowerCase() : value;
|
|
12
|
+
return (value == "no" || value == "false" || value == "0") ? false : !!value;
|
|
13
|
+
case "number":
|
|
14
|
+
const val = parseFloat(value);
|
|
15
|
+
return isNaN(val) ? 0 : val;
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function getFromEnv(path, alternatives, value) {
|
|
20
|
+
const name = path.replace(/\.?([A-Z|0-9]+)/g, function (x, y) {
|
|
21
|
+
return "_" + y.toLowerCase();
|
|
22
|
+
}).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
|
|
23
|
+
const alts = Array.from(alternatives[name] || []);
|
|
24
|
+
alts.unshift(name);
|
|
25
|
+
for (const envName of alts) {
|
|
26
|
+
const envValue = process.env[envName];
|
|
27
|
+
if (typeof envValue !== "undefined") {
|
|
28
|
+
const val = convertValue(envValue, typeof value);
|
|
29
|
+
console.log(name, envName, val);
|
|
30
|
+
return convertValue(envValue, typeof value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
console.log(name, value);
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function createConfigRecursive(target, source, path, alternatives) {
|
|
37
|
+
if (isPrimitive(source) || isDate(source)) {
|
|
38
|
+
return getFromEnv(path, alternatives, source);
|
|
39
|
+
}
|
|
40
|
+
if (Array.isArray(source)) {
|
|
41
|
+
target = Array.isArray(target) ? Array.from(target) : [];
|
|
42
|
+
source.forEach((item, index) => {
|
|
43
|
+
if (target.length > index)
|
|
44
|
+
target[index] = createConfigRecursive(target[index], item, !path ? `${index}` : `${path}.${index}`, alternatives);
|
|
45
|
+
else
|
|
46
|
+
target.push(createConfigRecursive(null, item, !path ? `${index}` : `${path}.${index}`, alternatives));
|
|
47
|
+
});
|
|
48
|
+
return target;
|
|
49
|
+
}
|
|
50
|
+
return Object.keys(source).reduce((result, key) => {
|
|
51
|
+
result[key] = createConfigRecursive(result[key], source[key], !path ? `${key}` : `${path}.${key}`, alternatives);
|
|
52
|
+
return result;
|
|
53
|
+
}, Object.assign({}, target));
|
|
54
|
+
}
|
|
55
|
+
function parseConfig(config) {
|
|
56
|
+
if (typeof config == "string") {
|
|
57
|
+
try {
|
|
58
|
+
config = JSON.parse(config);
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return config;
|
|
65
|
+
}
|
|
66
|
+
function createConfig(config, alternatives) {
|
|
67
|
+
alternatives = alternatives || {};
|
|
68
|
+
console.log("Parsing config...");
|
|
69
|
+
return createConfigRecursive(null, parseConfig(config), "", alternatives);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generated bundle index. Do not edit.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export { createConfig };
|
|
77
|
+
//# sourceMappingURL=stemy-ngx-utils-tools.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stemy-ngx-utils-tools.mjs","sources":["../../tools/config.ts","../../tools/stemy-ngx-utils-tools.ts"],"sourcesContent":["export function isPrimitive(value: any): boolean {\r\n const type = typeof value;\r\n return value == null || (type !== \"object\" && type !== \"function\");\r\n}\r\n\r\nexport function isDate(value: any): value is Date {\r\n return null !== value && !isNaN(value) && \"undefined\" !== typeof value.getDate;\r\n}\r\n\r\nexport interface IEnvironmentAlternatives {\r\n [name: string]: string[]\r\n}\r\n\r\nfunction convertValue(value: any, type: string): any {\r\n switch (type) {\r\n case \"boolean\":\r\n value = typeof value == \"string\" ? value.toLowerCase() : value;\r\n return (value == \"no\" || value == \"false\" || value == \"0\") ? false : !!value;\r\n case \"number\":\r\n const val = parseFloat(value);\r\n return isNaN(val) ? 0 : val;\r\n }\r\n return value;\r\n}\r\n\r\nfunction getFromEnv(path: string, alternatives: IEnvironmentAlternatives, value: any): any {\r\n const name = path.replace(/\\.?([A-Z|0-9]+)/g, function (x,y){\r\n return \"_\" + y.toLowerCase()\r\n }).replace(/\\./gi, \"_\").replace(/^_/, \"\").toUpperCase();\r\n const alts = Array.from(alternatives[name] || []);\r\n alts.unshift(name);\r\n for (const envName of alts) {\r\n const envValue = process.env[envName];\r\n if (typeof envValue !== \"undefined\") {\r\n const val = convertValue(envValue, typeof value);\r\n console.log(name, envName, val);\r\n return convertValue(envValue, typeof value);\r\n }\r\n }\r\n console.log(name, value);\r\n return value;\r\n}\r\n\r\nfunction createConfigRecursive(target: any, source: any, path: string, alternatives: IEnvironmentAlternatives): any {\r\n if (isPrimitive(source) || isDate(source)) {\r\n return getFromEnv(path, alternatives, source);\r\n }\r\n if (Array.isArray(source)) {\r\n target = Array.isArray(target) ? Array.from(target) : [];\r\n source.forEach((item, index) => {\r\n if (target.length > index)\r\n target[index] = createConfigRecursive(target[index], item, !path ? `${index}` : `${path}.${index}`, alternatives);\r\n else\r\n target.push(createConfigRecursive(null, item, !path ? `${index}` : `${path}.${index}`, alternatives));\r\n });\r\n return target;\r\n }\r\n return Object.keys(source).reduce((result, key) => {\r\n result[key] = createConfigRecursive(result[key], source[key], !path ? `${key}` : `${path}.${key}`, alternatives);\r\n return result;\r\n }, Object.assign({}, target));\r\n}\r\n\r\nexport function parseConfig(config: any): any {\r\n if (typeof config == \"string\") {\r\n try {\r\n config = JSON.parse(config);\r\n } catch (e) {\r\n return {};\r\n }\r\n }\r\n return config;\r\n}\r\n\r\nexport function createConfig(config: any, alternatives?: IEnvironmentAlternatives): any {\r\n alternatives = alternatives || {};\r\n console.log(\"Parsing config...\");\r\n return createConfigRecursive(null, parseConfig(config), \"\", alternatives);\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":"AAAM,SAAU,WAAW,CAAC,KAAU,EAAA;AAClC,IAAA,MA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AAG,YAAY,IAAI,EAAE,CAAC;AAClC,IAAA,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACjC,IAAA,OAAO,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;AAC9E;;AC9EA;;AAEG;;;;"}
|
|
@@ -8,7 +8,7 @@ import { Invokable } from 'invokable';
|
|
|
8
8
|
import * as i2 from '@angular/router';
|
|
9
9
|
import { ActivatedRouteSnapshot, NavigationEnd, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer } from '@angular/router';
|
|
10
10
|
import * as i1$3 from '@angular/common';
|
|
11
|
-
import { isPlatformBrowser, isPlatformServer,
|
|
11
|
+
import { isPlatformBrowser, isPlatformServer, DOCUMENT, APP_BASE_HREF, CommonModule } from '@angular/common';
|
|
12
12
|
import * as i1 from 'ngx-device-detector';
|
|
13
13
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
14
14
|
import * as i1$1 from '@angular/common/http';
|
|
@@ -413,6 +413,7 @@ const API_SERVICE = new InjectionToken("api-service");
|
|
|
413
413
|
class ResourceIfContext {
|
|
414
414
|
}
|
|
415
415
|
// --- ConfigService ---
|
|
416
|
+
const APP_BASE_URL = new InjectionToken("app-base-url");
|
|
416
417
|
class IConfiguration {
|
|
417
418
|
}
|
|
418
419
|
const CONFIG_SERVICE = new InjectionToken("config-service");
|
|
@@ -1753,6 +1754,19 @@ class StringUtils {
|
|
|
1753
1754
|
static ucFirst(str) {
|
|
1754
1755
|
return str ? str.charAt(0).toUpperCase() + str.substring(1) : "";
|
|
1755
1756
|
}
|
|
1757
|
+
static isObjectId(id) {
|
|
1758
|
+
return typeof id === "string" && id.length == 12 && !isNaN(Number("0x" + id));
|
|
1759
|
+
}
|
|
1760
|
+
static parseDomain(baseUrl) {
|
|
1761
|
+
try {
|
|
1762
|
+
const url = new URL(baseUrl);
|
|
1763
|
+
const port = url.port && url.port !== "443" && url.port !== "80" ? `:${url.port}` : ``;
|
|
1764
|
+
return `${url.protocol}//${url.hostname}${port}/`;
|
|
1765
|
+
}
|
|
1766
|
+
catch {
|
|
1767
|
+
return "/";
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1756
1770
|
}
|
|
1757
1771
|
|
|
1758
1772
|
class ArrayUtils {
|
|
@@ -2469,18 +2483,18 @@ class StaticAuthService {
|
|
|
2469
2483
|
}
|
|
2470
2484
|
|
|
2471
2485
|
class ConfigService {
|
|
2472
|
-
constructor(http, universal, rootElement,
|
|
2486
|
+
constructor(http, universal, rootElement, baseUrl, baseConfig = null, scriptParams = null) {
|
|
2473
2487
|
this.http = http;
|
|
2474
2488
|
this.universal = universal;
|
|
2475
2489
|
this.rootElement = rootElement;
|
|
2476
|
-
this.
|
|
2490
|
+
this.baseUrl = baseUrl;
|
|
2477
2491
|
for (const key in []) {
|
|
2478
2492
|
Object.defineProperty(Array.prototype, key, {
|
|
2479
2493
|
enumerable: false
|
|
2480
2494
|
});
|
|
2481
2495
|
}
|
|
2482
2496
|
this.baseConfig = baseConfig || {};
|
|
2483
|
-
this.loadedConfig = Object.assign(!this.
|
|
2497
|
+
this.loadedConfig = Object.assign(!this.baseUrl ? {} : { baseUrl: this.baseUrl, baseDomain: StringUtils.parseDomain(this.baseUrl) }, this.baseConfig);
|
|
2484
2498
|
this.scriptParameters = scriptParams || {};
|
|
2485
2499
|
this.loaderFunc = () => {
|
|
2486
2500
|
this.loader = this.loader || new Promise((resolve, reject) => {
|
|
@@ -2506,16 +2520,6 @@ class ConfigService {
|
|
|
2506
2520
|
get configUrl() {
|
|
2507
2521
|
return `${this.loadedConfig.baseUrl}config/config.json`;
|
|
2508
2522
|
}
|
|
2509
|
-
parseDomain(baseUrl) {
|
|
2510
|
-
try {
|
|
2511
|
-
const url = new URL(baseUrl);
|
|
2512
|
-
const port = url.port && url.port !== "443" && url.port !== "80" ? `:${url.port}` : ``;
|
|
2513
|
-
return `${url.protocol}//${url.hostname}${port}/`;
|
|
2514
|
-
}
|
|
2515
|
-
catch {
|
|
2516
|
-
return "/";
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
2523
|
initService() {
|
|
2520
2524
|
}
|
|
2521
2525
|
async loadJson() {
|
|
@@ -2562,7 +2566,7 @@ class ConfigService {
|
|
|
2562
2566
|
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
|
2563
2567
|
}
|
|
2564
2568
|
}
|
|
2565
|
-
ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, deps: [{ token: i1$1.HttpClient }, { token: UniversalService }, { token: ROOT_ELEMENT }, { token:
|
|
2569
|
+
ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, deps: [{ token: i1$1.HttpClient }, { token: UniversalService }, { token: ROOT_ELEMENT }, { token: APP_BASE_URL }, { token: BASE_CONFIG, optional: true }, { token: SCRIPT_PARAMS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2566
2570
|
ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService });
|
|
2567
2571
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ConfigService, decorators: [{
|
|
2568
2572
|
type: Injectable
|
|
@@ -2571,7 +2575,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
2571
2575
|
args: [ROOT_ELEMENT]
|
|
2572
2576
|
}] }, { type: undefined, decorators: [{
|
|
2573
2577
|
type: Inject,
|
|
2574
|
-
args: [
|
|
2578
|
+
args: [APP_BASE_URL]
|
|
2575
2579
|
}] }, { type: IConfiguration, decorators: [{
|
|
2576
2580
|
type: Optional
|
|
2577
2581
|
}, {
|
|
@@ -4964,7 +4968,7 @@ function loadConfig(config) {
|
|
|
4964
4968
|
return config.load;
|
|
4965
4969
|
}
|
|
4966
4970
|
|
|
4967
|
-
function
|
|
4971
|
+
function loadBaseUrl() {
|
|
4968
4972
|
if (typeof (document) === "undefined" || typeof (location) === "undefined")
|
|
4969
4973
|
return "/";
|
|
4970
4974
|
const currentScript = document.currentScript;
|
|
@@ -4975,7 +4979,8 @@ function loadBaseHref() {
|
|
|
4975
4979
|
}
|
|
4976
4980
|
catch (e) {
|
|
4977
4981
|
const qualifiedUrl = location.protocol + "//" + location.host;
|
|
4978
|
-
const
|
|
4982
|
+
const stack = (e.stack || "");
|
|
4983
|
+
const srcUrl = (stack.match(new RegExp(qualifiedUrl + ".*?\\.js", "g")) || stack.match(/http([A-Z:\/\-.]+)\.js/gi)).shift();
|
|
4979
4984
|
const lastIndex = srcUrl.lastIndexOf("/");
|
|
4980
4985
|
return lastIndex < 0 ? "/" : srcUrl.substring(0, lastIndex + 1);
|
|
4981
4986
|
}
|
|
@@ -4984,6 +4989,15 @@ function loadBaseHref() {
|
|
|
4984
4989
|
const lastIndex = scriptSrc.lastIndexOf("/");
|
|
4985
4990
|
return lastIndex < 0 ? "/" : scriptSrc.substring(0, lastIndex + 1);
|
|
4986
4991
|
}
|
|
4992
|
+
function loadBaseHref(baseUrl) {
|
|
4993
|
+
try {
|
|
4994
|
+
return new URL(baseUrl).pathname;
|
|
4995
|
+
}
|
|
4996
|
+
catch (e) {
|
|
4997
|
+
console.log(e);
|
|
4998
|
+
return "/";
|
|
4999
|
+
}
|
|
5000
|
+
}
|
|
4987
5001
|
class NgxUtilsModule {
|
|
4988
5002
|
constructor() {
|
|
4989
5003
|
}
|
|
@@ -5024,6 +5038,11 @@ class NgxUtilsModule {
|
|
|
5024
5038
|
provide: GLOBAL_TEMPLATES,
|
|
5025
5039
|
useExisting: (!config ? null : config.globalTemplates) || GlobalTemplateService
|
|
5026
5040
|
},
|
|
5041
|
+
{
|
|
5042
|
+
provide: APP_BASE_URL,
|
|
5043
|
+
useFactory: (!config ? null : config.baseUrl) || loadBaseUrl,
|
|
5044
|
+
deps: [Injector]
|
|
5045
|
+
},
|
|
5027
5046
|
{
|
|
5028
5047
|
provide: ROOT_ELEMENT,
|
|
5029
5048
|
useValue: null
|
|
@@ -5036,8 +5055,8 @@ class NgxUtilsModule {
|
|
|
5036
5055
|
},
|
|
5037
5056
|
{
|
|
5038
5057
|
provide: APP_BASE_HREF,
|
|
5039
|
-
useFactory:
|
|
5040
|
-
deps: [
|
|
5058
|
+
useFactory: loadBaseHref,
|
|
5059
|
+
deps: [APP_BASE_URL]
|
|
5041
5060
|
}
|
|
5042
5061
|
]
|
|
5043
5062
|
};
|
|
@@ -5076,5 +5095,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
5076
5095
|
* Generated bundle index. Do not edit.
|
|
5077
5096
|
*/
|
|
5078
5097
|
|
|
5079
|
-
export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector };
|
|
5098
|
+
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector };
|
|
5080
5099
|
//# sourceMappingURL=stemy-ngx-utils.mjs.map
|