@acorex/core 5.4.0 → 5.7.0

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.
@@ -1,8 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Pipe, NgModule, Injectable, Inject } from '@angular/core';
3
3
  import tinycolor from 'tinycolor2';
4
+ import tinygradient from 'tinygradient';
4
5
  import * as i1 from '@angular/platform-browser';
5
- import _ from 'lodash';
6
+ import * as _ from 'lodash';
6
7
  import { Subject, fromEvent } from 'rxjs';
7
8
  import { DOCUMENT } from '@angular/common';
8
9
  import { Observable } from 'rxjs/internal/Observable';
@@ -95,11 +96,22 @@ class AXStringUtil {
95
96
  }
96
97
 
97
98
  class AXColorUtil {
98
- static testa(color) {
99
- var _color = tinycolor(color);
100
- console.log(_color);
101
- }
102
99
  static to(color, mode) {
100
+ const _color = tinycolor(color);
101
+ switch (mode) {
102
+ case 'rgba':
103
+ ;
104
+ return _color.toRgb();
105
+ case 'hsla':
106
+ return _color.toHsl();
107
+ case 'hsva':
108
+ return _color.toHsv();
109
+ default:
110
+ return _color.toHex();
111
+ }
112
+ }
113
+ ;
114
+ static toString(color, mode) {
103
115
  const _color = tinycolor(color);
104
116
  switch (mode) {
105
117
  case 'rgba':
@@ -113,37 +125,43 @@ class AXColorUtil {
113
125
  }
114
126
  }
115
127
  ;
116
- static toHex(color) {
128
+ static mix(baseColor, hex, percentage) {
129
+ return tinycolor.mix(baseColor, hex, percentage).toString('rgb');
130
+ }
131
+ static multiply(color1, color2) {
132
+ let rgb1 = tinycolor(color1).toRgb();
133
+ let rgb2 = tinycolor(color2).toRgb();
134
+ rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);
135
+ rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);
136
+ rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);
137
+ return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b).toString('rgb');
138
+ }
139
+ static toHexSting(color) {
117
140
  const _color = tinycolor(color);
118
141
  return _color.toHexString();
119
142
  }
120
143
  ;
121
- static toRGB(color) {
144
+ static toRGBString(color) {
122
145
  const _color = tinycolor(color);
123
146
  return _color.toRgbString();
124
147
  }
125
148
  ;
126
- static illuminance(hexColor) {
127
- let rgbColor = AXColorUtil.toRGB(hexColor);
128
- if (!rgbColor)
129
- return -1;
130
- let r = rgbColor.r, g = rgbColor.g, b = rgbColor.b;
131
- let a = [r, g, b].map(v => {
132
- v /= 255;
133
- return (v <= 0.03928) ?
134
- v / 12.92 :
135
- Math.pow(((v + 0.055) / 1.055), 2.4);
136
- });
137
- return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
138
- }
139
- ;
140
149
  static contrastToWhite(color) {
141
- // let whiteIlluminance = 1;
142
- // let illuminance = AXColorUtil.illuminance(hexColor);
143
- // return whiteIlluminance / illuminance;
144
150
  return tinycolor.readability("#fff", color);
145
151
  }
146
152
  ;
153
+ static lighten(hex, percentage) {
154
+ return tinycolor(hex).lighten(percentage);
155
+ }
156
+ static darken(hex, percentage) {
157
+ return tinycolor(hex).darken(percentage);
158
+ }
159
+ static equal(color1, color2) {
160
+ return tinycolor.equals(color1, color2);
161
+ }
162
+ static gradient(values) {
163
+ return tinygradient([...values]);
164
+ }
147
165
  }
148
166
 
149
167
  class AXSafePipe {
@@ -163,9 +181,9 @@ class AXSafePipe {
163
181
  }
164
182
  }
165
183
  }
166
- AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
167
- AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXSafePipe, name: "safe" });
168
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXSafePipe, decorators: [{
184
+ AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
185
+ AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXSafePipe, name: "safe" });
186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXSafePipe, decorators: [{
169
187
  type: Pipe,
170
188
  args: [{
171
189
  name: 'safe',
@@ -175,10 +193,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImpor
175
193
 
176
194
  class AXCoreModule {
177
195
  }
178
- AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
179
- AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
180
- AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, providers: [], imports: [[]] });
181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXCoreModule, decorators: [{
196
+ AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
197
+ AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
198
+ AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXCoreModule, providers: [] });
199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXCoreModule, decorators: [{
182
200
  type: NgModule,
183
201
  args: [{
184
202
  imports: [],
@@ -523,9 +541,9 @@ class AXDateTimePipe {
523
541
  }
524
542
  }
525
543
  }
526
- AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
527
- AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimePipe, decorators: [{
544
+ AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
545
+ AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimePipe, decorators: [{
529
547
  type: Pipe,
530
548
  args: [{ name: 'axDate' }]
531
549
  }], ctorParameters: function () { return []; } });
@@ -1090,10 +1108,10 @@ class AXDateTimeModule {
1090
1108
  });
1091
1109
  }
1092
1110
  }
1093
- AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1094
- AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
1095
- AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, providers: [], imports: [[]] });
1096
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXDateTimeModule, decorators: [{
1111
+ AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1112
+ AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
1113
+ AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimeModule, providers: [] });
1114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXDateTimeModule, decorators: [{
1097
1115
  type: NgModule,
1098
1116
  args: [{
1099
1117
  imports: [],
@@ -1130,9 +1148,9 @@ class AXEventService {
1130
1148
  }
1131
1149
  }
1132
1150
  }
1133
- AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1134
- AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXEventService, providedIn: 'root' });
1135
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXEventService, decorators: [{
1151
+ AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1152
+ AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXEventService, providedIn: 'root' });
1153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXEventService, decorators: [{
1136
1154
  type: Injectable,
1137
1155
  args: [{ providedIn: 'root' }]
1138
1156
  }] });
@@ -1160,10 +1178,11 @@ class AXHotkeysService {
1160
1178
  });
1161
1179
  }
1162
1180
  }
1163
- 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 });
1164
- AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXHotkeysService });
1165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXHotkeysService, decorators: [{
1166
- type: Injectable
1181
+ AXHotkeysService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXHotkeysService, deps: [{ token: i1.EventManager }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
1182
+ AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXHotkeysService, providedIn: 'root' });
1183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXHotkeysService, decorators: [{
1184
+ type: Injectable,
1185
+ args: [{ providedIn: 'root' }]
1167
1186
  }], ctorParameters: function () {
1168
1187
  return [{ type: i1.EventManager }, { type: Document, decorators: [{
1169
1188
  type: Inject,
@@ -1187,8 +1206,9 @@ class AXTranslator {
1187
1206
  static use(lang) {
1188
1207
  AXTranslator.lang = lang;
1189
1208
  }
1190
- static get(key, lang, params) {
1191
- lang = lang || AXTranslator.lang;
1209
+ static get(key, arg1, arg2) {
1210
+ const lang = arg1 && typeof arg1 == 'string' ? arg1 : AXTranslator.lang;
1211
+ const params = arg1 && typeof arg1 == 'object' ? arg1 : arg2;
1192
1212
  let result = _.get(AXTranslator[`__data__${lang}`], key, key);
1193
1213
  const vars = typeof (result) == 'string' ? result === null || result === void 0 ? void 0 : result.match(this._varsRegx) : [];
1194
1214
  if (vars === null || vars === void 0 ? void 0 : vars.length) {
@@ -1212,23 +1232,23 @@ AXTranslator._varsRegx = /((\$\{[a-zA-Z_0-9\.]+\})+)/gm;
1212
1232
  AXTranslator._varNameRegx = /[a-zA-Z_0-9\.]+/gm;
1213
1233
 
1214
1234
  class AXTranslatorPipe {
1215
- transform(value, lang) {
1216
- return AXTranslator.get(value, lang);
1235
+ transform(value, arg1, arg2) {
1236
+ return AXTranslator.get(value, arg1, arg2);
1217
1237
  }
1218
1238
  }
1219
- AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1220
- AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
1221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslatorPipe, decorators: [{
1239
+ AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1240
+ AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
1241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslatorPipe, decorators: [{
1222
1242
  type: Pipe,
1223
1243
  args: [{ name: 'trans', pure: true }]
1224
1244
  }] });
1225
1245
 
1226
1246
  class AXTranslationModule {
1227
1247
  }
1228
- AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1229
- AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
1230
- AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, providers: [], imports: [[]] });
1231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXTranslationModule, decorators: [{
1248
+ AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1249
+ AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
1250
+ AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, providers: [] });
1251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, decorators: [{
1232
1252
  type: NgModule,
1233
1253
  args: [{
1234
1254
  imports: [],
@@ -1363,9 +1383,9 @@ class AXPlatform {
1363
1383
  document.querySelector(':root').style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
1364
1384
  }
1365
1385
  }
1366
- AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1367
- AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
1368
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: AXPlatform, decorators: [{
1386
+ AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1387
+ AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
1388
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXPlatform, decorators: [{
1369
1389
  type: Injectable,
1370
1390
  args: [{
1371
1391
  providedIn: 'platform',