@skyux/core 6.0.0-beta.5 → 6.0.0-beta.6
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/documentation.json +361 -477
- package/esm2020/index.mjs +3 -1
- package/esm2020/lib/modules/log/log.service.mjs +119 -10
- package/esm2020/lib/modules/log/types/log-deprecation-args.mjs +2 -0
- package/esm2020/lib/modules/log/types/log-level-token.mjs +6 -0
- package/esm2020/lib/modules/log/types/log-level.mjs +2 -0
- package/fesm2015/skyux-core.mjs +127 -10
- package/fesm2015/skyux-core.mjs.map +1 -1
- package/fesm2020/skyux-core.mjs +121 -10
- package/fesm2020/skyux-core.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/lib/modules/log/log.service.d.ts +37 -3
- package/lib/modules/log/types/log-deprecation-args.d.ts +27 -0
- package/lib/modules/log/types/log-level-token.d.ts +6 -0
- package/lib/modules/log/types/log-level.d.ts +8 -0
- package/package.json +2 -2
package/fesm2020/skyux-core.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { NgModule, Injectable, EventEmitter, Directive, Input, Output, Injector, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, Pipe, ElementRef
|
2
|
+
import { NgModule, Injectable, EventEmitter, Directive, Input, Output, Injector, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, InjectionToken, Optional, Inject, Pipe, ElementRef } from '@angular/core';
|
3
3
|
import * as i4 from '@angular/common';
|
4
4
|
import { CommonModule } from '@angular/common';
|
5
5
|
import { Subject, fromEvent, BehaviorSubject, ReplaySubject, Observable, of } from 'rxjs';
|
@@ -1389,25 +1389,136 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1389
1389
|
}] });
|
1390
1390
|
|
1391
1391
|
/**
|
1392
|
-
* @
|
1392
|
+
* @internal
|
1393
|
+
*/
|
1394
|
+
const SKY_LOG_LEVEL = new InjectionToken('SkyLogLevel');
|
1395
|
+
|
1396
|
+
/**
|
1397
|
+
* Logs information to the console based on the application's log level as provided by the `SKY_LOG_LEVEL` injection token. If no token is provided, only `error` logs will be shown.
|
1398
|
+
* @internal
|
1393
1399
|
*/
|
1394
1400
|
class SkyLogService {
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1401
|
+
constructor(formatter, applicationLogLevel) {
|
1402
|
+
this.formatter = formatter;
|
1403
|
+
this.applicationLogLevel = applicationLogLevel;
|
1404
|
+
if (!this.applicationLogLevel) {
|
1405
|
+
this.applicationLogLevel = 3 /* Error */;
|
1406
|
+
}
|
1407
|
+
}
|
1408
|
+
/**
|
1409
|
+
* Logs a deprecation warning for a class, property, function, etc. This will be logged as a console warning unless a different log level is given in the the `args` parameter.
|
1410
|
+
* @param name The name of the deprecated class, property, function, etc.
|
1411
|
+
* @param args Information about the deprecation and replacement recommendations.
|
1412
|
+
* @returns
|
1413
|
+
*/
|
1414
|
+
async deprecated(name, args) {
|
1415
|
+
const logLevel = args?.logLevel ?? 2 /* Warn */;
|
1416
|
+
name = this.convertStringToCode(name);
|
1417
|
+
if (this.canLog(logLevel)) {
|
1418
|
+
const localizedStrings = [];
|
1419
|
+
if (args?.deprecationMajorVersion) {
|
1420
|
+
localizedStrings.push(this.formatter.formatText('{0} is deprecated starting in SKY UX {1}.', name, args.deprecationMajorVersion.toLocaleString()));
|
1421
|
+
}
|
1422
|
+
else {
|
1423
|
+
localizedStrings.push(this.formatter.formatText('{0} is deprecated.', name));
|
1424
|
+
}
|
1425
|
+
if (args?.removalMajorVersion) {
|
1426
|
+
localizedStrings.push(this.formatter.formatText('We will remove it in version {0}.', args.removalMajorVersion.toLocaleString()));
|
1427
|
+
}
|
1428
|
+
else {
|
1429
|
+
localizedStrings.push('We will remove it in a future major version.');
|
1430
|
+
}
|
1431
|
+
if (args?.replacementRecommendation) {
|
1432
|
+
localizedStrings.push(args.replacementRecommendation);
|
1433
|
+
}
|
1434
|
+
if (args?.moreInfoUrl) {
|
1435
|
+
localizedStrings.push(this.formatter.formatText('For more information, see {0}.', args.moreInfoUrl));
|
1436
|
+
}
|
1437
|
+
this.logBasedOnLevel(logLevel, localizedStrings.join(' '));
|
1438
|
+
}
|
1439
|
+
return Promise.resolve();
|
1440
|
+
}
|
1441
|
+
/**
|
1442
|
+
* Logs a console error if the application's log level is `SkyLogLevel.Error`.
|
1443
|
+
* @param message The error message
|
1444
|
+
* @param params Optional parameters for the error message.
|
1445
|
+
*/
|
1446
|
+
error(message, params) {
|
1447
|
+
if (this.canLog(3 /* Error */)) {
|
1448
|
+
if (params) {
|
1449
|
+
console.error(message, ...params);
|
1450
|
+
}
|
1451
|
+
else {
|
1452
|
+
console.error(message);
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
}
|
1456
|
+
/**
|
1457
|
+
* Logs console information if the application's log level is `SkyLogLevel.Info` or above.
|
1458
|
+
* @param message The infomational message
|
1459
|
+
* @param params Optional parameters for the informational message.
|
1460
|
+
*/
|
1461
|
+
info(message, params) {
|
1462
|
+
if (this.canLog(1 /* Info */)) {
|
1463
|
+
if (params) {
|
1464
|
+
console.log(message, ...params);
|
1465
|
+
}
|
1466
|
+
else {
|
1467
|
+
console.log(message);
|
1468
|
+
}
|
1469
|
+
}
|
1470
|
+
}
|
1471
|
+
/**
|
1472
|
+
* Logs a console warning if the application's log level is `SkyLogLevel.Warn` or above.
|
1473
|
+
* @param message The warning message
|
1474
|
+
* @param params Optional parameters for the warning message.
|
1475
|
+
*/
|
1476
|
+
warn(message, params) {
|
1477
|
+
if (this.canLog(2 /* Warn */)) {
|
1478
|
+
if (params) {
|
1479
|
+
console.warn(message, ...params);
|
1480
|
+
}
|
1481
|
+
else {
|
1482
|
+
console.warn(message);
|
1483
|
+
}
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
convertStringToCode(typeString) {
|
1487
|
+
if (typeString.charAt(0) !== '`' && typeString.charAt(-1) !== '`') {
|
1488
|
+
typeString = '`' + typeString + '`';
|
1489
|
+
}
|
1490
|
+
return typeString;
|
1491
|
+
}
|
1492
|
+
canLog(intendedLogLevel) {
|
1493
|
+
return intendedLogLevel >= this.applicationLogLevel;
|
1494
|
+
}
|
1495
|
+
logBasedOnLevel(logLevel, message, params) {
|
1496
|
+
switch (logLevel) {
|
1497
|
+
case 1 /* Info */:
|
1498
|
+
this.info(message, params);
|
1499
|
+
break;
|
1500
|
+
case 2 /* Warn */:
|
1501
|
+
this.warn(message, params);
|
1502
|
+
break;
|
1503
|
+
case 3 /* Error */:
|
1504
|
+
this.error(message, params);
|
1505
|
+
break;
|
1400
1506
|
}
|
1401
1507
|
}
|
1402
1508
|
}
|
1403
|
-
SkyLogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1509
|
+
SkyLogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, deps: [{ token: SkyAppFormat }, { token: SKY_LOG_LEVEL, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
1404
1510
|
SkyLogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, providedIn: 'root' });
|
1405
1511
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, decorators: [{
|
1406
1512
|
type: Injectable,
|
1407
1513
|
args: [{
|
1408
1514
|
providedIn: 'root',
|
1409
1515
|
}]
|
1410
|
-
}] }
|
1516
|
+
}], ctorParameters: function () { return [{ type: SkyAppFormat }, { type: undefined, decorators: [{
|
1517
|
+
type: Optional
|
1518
|
+
}, {
|
1519
|
+
type: Inject,
|
1520
|
+
args: [SKY_LOG_LEVEL]
|
1521
|
+
}] }]; } });
|
1411
1522
|
|
1412
1523
|
/**
|
1413
1524
|
* @deprecated The `SkyMediaQueryService` no longer needs the `SkyMediaQueryModule`.
|
@@ -3201,5 +3312,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
3201
3312
|
* Generated bundle index. Do not edit.
|
3202
3313
|
*/
|
3203
3314
|
|
3204
|
-
export { MutationObserverService, NumericOptions, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyIdModule, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScrollableHostService, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, getWindow, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3 };
|
3315
|
+
export { MutationObserverService, NumericOptions, SKY_LOG_LEVEL, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyIdModule, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScrollableHostService, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, getWindow, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3 };
|
3205
3316
|
//# sourceMappingURL=skyux-core.mjs.map
|