@acorex/core 5.3.0 → 5.3.4

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.
@@ -93,6 +93,45 @@ class AXStringUtil {
93
93
  }
94
94
  }
95
95
 
96
+ class AXColorUtil {
97
+ static rgba2Hex(rgba) {
98
+ let rgbaVal = typeof rgba == 'string' ? rgba : `rgba(${rgba.r},${rgba.g},${rgba.b},${rgba.a ?? '1'})`;
99
+ const rgbaArr = rgbaVal.replace(/^rgba?\(|\s+|\)$/g, '').split(',');
100
+ const hex = `#${((1 << 24) + (parseInt(rgbaArr[0]) << 16) + (parseInt(rgbaArr[1]) << 8) + parseInt(rgbaArr[2])).toString(16).slice(1)}`;
101
+ return hex == '#aN' ? null : hex;
102
+ }
103
+ ;
104
+ static hex2Rgb(hexColor) {
105
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
106
+ return result ? {
107
+ r: parseInt(result[1], 16),
108
+ g: parseInt(result[2], 16),
109
+ b: parseInt(result[3], 16)
110
+ } : null;
111
+ }
112
+ ;
113
+ static illuminance(hexColor) {
114
+ let rgbColor = AXColorUtil.hex2Rgb(hexColor);
115
+ if (!rgbColor)
116
+ return -1;
117
+ let r = rgbColor.r, g = rgbColor.g, b = rgbColor.b;
118
+ let a = [r, g, b].map(v => {
119
+ v /= 255;
120
+ return (v <= 0.03928) ?
121
+ v / 12.92 :
122
+ Math.pow(((v + 0.055) / 1.055), 2.4);
123
+ });
124
+ return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
125
+ }
126
+ ;
127
+ static contrastToWhite(hexColor) {
128
+ let whiteIlluminance = 1;
129
+ let illuminance = AXColorUtil.illuminance(hexColor);
130
+ return whiteIlluminance / illuminance;
131
+ }
132
+ ;
133
+ }
134
+
96
135
  class AXSafePipe {
97
136
  constructor(sanitizer) {
98
137
  this.sanitizer = sanitizer;
@@ -110,9 +149,9 @@ class AXSafePipe {
110
149
  }
111
150
  }
112
151
  }
113
- AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
114
- AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXSafePipe, name: "safe" });
115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXSafePipe, decorators: [{
152
+ AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
153
+ AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXSafePipe, name: "safe" });
154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXSafePipe, decorators: [{
116
155
  type: Pipe,
117
156
  args: [{
118
157
  name: 'safe',
@@ -122,10 +161,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
122
161
 
123
162
  class AXCoreModule {
124
163
  }
125
- AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
126
- AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
127
- AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXCoreModule, providers: [], imports: [[]] });
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXCoreModule, decorators: [{
164
+ AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
165
+ AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
166
+ AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, providers: [], imports: [[]] });
167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, decorators: [{
129
168
  type: NgModule,
130
169
  args: [{
131
170
  imports: [],
@@ -470,9 +509,9 @@ class AXDateTimePipe {
470
509
  }
471
510
  }
472
511
  }
473
- AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
474
- AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimePipe, decorators: [{
512
+ AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
513
+ AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
514
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimePipe, decorators: [{
476
515
  type: Pipe,
477
516
  args: [{ name: 'axDate' }]
478
517
  }], ctorParameters: function () { return []; } });
@@ -1037,10 +1076,10 @@ class AXDateTimeModule {
1037
1076
  });
1038
1077
  }
1039
1078
  }
1040
- AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1041
- AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
1042
- AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimeModule, providers: [], imports: [[]] });
1043
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXDateTimeModule, decorators: [{
1079
+ AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1080
+ AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
1081
+ AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, providers: [], imports: [[]] });
1082
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, decorators: [{
1044
1083
  type: NgModule,
1045
1084
  args: [{
1046
1085
  imports: [],
@@ -1077,9 +1116,9 @@ class AXEventService {
1077
1116
  }
1078
1117
  }
1079
1118
  }
1080
- AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1081
- AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXEventService, providedIn: 'root' });
1082
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXEventService, decorators: [{
1119
+ AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1120
+ AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXEventService, providedIn: 'root' });
1121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXEventService, decorators: [{
1083
1122
  type: Injectable,
1084
1123
  args: [{ providedIn: 'root' }]
1085
1124
  }] });
@@ -1107,9 +1146,9 @@ class AXHotkeysService {
1107
1146
  });
1108
1147
  }
1109
1148
  }
1110
- AXHotkeysService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXHotkeysService, deps: [{ token: i1.EventManager }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
1111
- AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXHotkeysService });
1112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXHotkeysService, decorators: [{
1149
+ AXHotkeysService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXHotkeysService, deps: [{ token: i1.EventManager }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
1150
+ AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXHotkeysService });
1151
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXHotkeysService, decorators: [{
1113
1152
  type: Injectable
1114
1153
  }], ctorParameters: function () { return [{ type: i1.EventManager }, { type: Document, decorators: [{
1115
1154
  type: Inject,
@@ -1160,19 +1199,19 @@ class AXTranslatorPipe {
1160
1199
  return AXTranslator.get(value, lang);
1161
1200
  }
1162
1201
  }
1163
- AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1164
- AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
1165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslatorPipe, decorators: [{
1202
+ AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1203
+ AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
1204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslatorPipe, decorators: [{
1166
1205
  type: Pipe,
1167
1206
  args: [{ name: 'trans', pure: true }]
1168
1207
  }] });
1169
1208
 
1170
1209
  class AXTranslationModule {
1171
1210
  }
1172
- AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1173
- AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
1174
- AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslationModule, providers: [], imports: [[]] });
1175
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXTranslationModule, decorators: [{
1211
+ AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1212
+ AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
1213
+ AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, providers: [], imports: [[]] });
1214
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, decorators: [{
1176
1215
  type: NgModule,
1177
1216
  args: [{
1178
1217
  imports: [],
@@ -1307,9 +1346,9 @@ class AXPlatform {
1307
1346
  document.querySelector(':root').style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
1308
1347
  }
1309
1348
  }
1310
- AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1311
- AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
1312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AXPlatform, decorators: [{
1349
+ AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1350
+ AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
1351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXPlatform, decorators: [{
1313
1352
  type: Injectable,
1314
1353
  args: [{
1315
1354
  providedIn: 'platform',
@@ -1325,5 +1364,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1325
1364
  * Generated bundle index. Do not edit.
1326
1365
  */
1327
1366
 
1328
- export { AXCalendarMonth, AXConfig, AXCoreModule, AXDateTime, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXDrawingUtil, AXEventService, AXHotkeysService, AXObjectUtil, AXPlatform, AXPlatformEvent, AXSafePipe, AXStringUtil, AXTranslationModule, AXTranslator, AXTranslatorPipe, GeorgianCalendar, JalaliCalendar, testUserAgent };
1367
+ export { AXCalendarMonth, AXColorUtil, AXConfig, AXCoreModule, AXDateTime, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXDrawingUtil, AXEventService, AXHotkeysService, AXObjectUtil, AXPlatform, AXPlatformEvent, AXSafePipe, AXStringUtil, AXTranslationModule, AXTranslator, AXTranslatorPipe, GeorgianCalendar, JalaliCalendar, testUserAgent };
1329
1368
  //# sourceMappingURL=acorex-core.mjs.map