@acorex/core 5.6.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.
- package/config/ax-preset.js +6 -0
- package/esm2020/lib/config/configs.mjs +2 -2
- package/esm2020/lib/core.module.mjs +5 -5
- package/esm2020/lib/dateTime/datetime.class.mjs +2 -2
- package/esm2020/lib/dateTime/datetime.module.mjs +5 -5
- package/esm2020/lib/dateTime/datetime.pipe.mjs +3 -3
- package/esm2020/lib/events/event.service.mjs +3 -3
- package/esm2020/lib/hotkeys/hotkeys.service.mjs +6 -5
- package/esm2020/lib/platform/platform.service.mjs +3 -3
- package/esm2020/lib/translation/translation.module.mjs +5 -5
- package/esm2020/lib/translation/translator.mjs +2 -2
- package/esm2020/lib/translation/translator.pipe.mjs +3 -3
- package/esm2020/lib/utils/color-util.mjs +14 -25
- package/esm2020/lib/utils/safe.pipe.mjs +3 -3
- package/fesm2015/acorex-core.mjs +46 -56
- package/fesm2015/acorex-core.mjs.map +1 -1
- package/fesm2020/acorex-core.mjs +46 -56
- package/fesm2020/acorex-core.mjs.map +1 -1
- package/{acorex-core.d.ts → index.d.ts} +0 -0
- package/lib/dateTime/datetime.pipe.d.ts +1 -1
- package/lib/translation/translator.pipe.d.ts +1 -1
- package/lib/utils/color-util.d.ts +17 -11
- package/lib/utils/safe.pipe.d.ts +1 -1
- package/package.json +3 -3
package/fesm2020/acorex-core.mjs
CHANGED
|
@@ -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,14 +96,11 @@ 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) {
|
|
103
100
|
const _color = tinycolor(color);
|
|
104
101
|
switch (mode) {
|
|
105
102
|
case 'rgba':
|
|
103
|
+
;
|
|
106
104
|
return _color.toRgb();
|
|
107
105
|
case 'hsla':
|
|
108
106
|
return _color.toHsl();
|
|
@@ -128,13 +126,15 @@ class AXColorUtil {
|
|
|
128
126
|
}
|
|
129
127
|
;
|
|
130
128
|
static mix(baseColor, hex, percentage) {
|
|
131
|
-
return tinycolor.mix(baseColor, hex, percentage);
|
|
129
|
+
return tinycolor.mix(baseColor, hex, percentage).toString('rgb');
|
|
132
130
|
}
|
|
133
|
-
static multiply(
|
|
131
|
+
static multiply(color1, color2) {
|
|
132
|
+
let rgb1 = tinycolor(color1).toRgb();
|
|
133
|
+
let rgb2 = tinycolor(color2).toRgb();
|
|
134
134
|
rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);
|
|
135
135
|
rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);
|
|
136
136
|
rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);
|
|
137
|
-
return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b);
|
|
137
|
+
return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b).toString('rgb');
|
|
138
138
|
}
|
|
139
139
|
static toHexSting(color) {
|
|
140
140
|
const _color = tinycolor(color);
|
|
@@ -146,24 +146,7 @@ class AXColorUtil {
|
|
|
146
146
|
return _color.toRgbString();
|
|
147
147
|
}
|
|
148
148
|
;
|
|
149
|
-
static illuminance(hexColor) {
|
|
150
|
-
let rgbColor = AXColorUtil.toRGBString(hexColor);
|
|
151
|
-
if (!rgbColor)
|
|
152
|
-
return -1;
|
|
153
|
-
let r = rgbColor.r, g = rgbColor.g, b = rgbColor.b;
|
|
154
|
-
let a = [r, g, b].map(v => {
|
|
155
|
-
v /= 255;
|
|
156
|
-
return (v <= 0.03928) ?
|
|
157
|
-
v / 12.92 :
|
|
158
|
-
Math.pow(((v + 0.055) / 1.055), 2.4);
|
|
159
|
-
});
|
|
160
|
-
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
161
|
-
}
|
|
162
|
-
;
|
|
163
149
|
static contrastToWhite(color) {
|
|
164
|
-
// let whiteIlluminance = 1;
|
|
165
|
-
// let illuminance = AXColorUtil.illuminance(hexColor);
|
|
166
|
-
// return whiteIlluminance / illuminance;
|
|
167
150
|
return tinycolor.readability("#fff", color);
|
|
168
151
|
}
|
|
169
152
|
;
|
|
@@ -173,6 +156,12 @@ class AXColorUtil {
|
|
|
173
156
|
static darken(hex, percentage) {
|
|
174
157
|
return tinycolor(hex).darken(percentage);
|
|
175
158
|
}
|
|
159
|
+
static equal(color1, color2) {
|
|
160
|
+
return tinycolor.equals(color1, color2);
|
|
161
|
+
}
|
|
162
|
+
static gradient(values) {
|
|
163
|
+
return tinygradient([...values]);
|
|
164
|
+
}
|
|
176
165
|
}
|
|
177
166
|
|
|
178
167
|
class AXSafePipe {
|
|
@@ -192,9 +181,9 @@ class AXSafePipe {
|
|
|
192
181
|
}
|
|
193
182
|
}
|
|
194
183
|
}
|
|
195
|
-
AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
196
|
-
AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "
|
|
197
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
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: [{
|
|
198
187
|
type: Pipe,
|
|
199
188
|
args: [{
|
|
200
189
|
name: 'safe',
|
|
@@ -204,10 +193,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImpor
|
|
|
204
193
|
|
|
205
194
|
class AXCoreModule {
|
|
206
195
|
}
|
|
207
|
-
AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
208
|
-
AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
209
|
-
AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
210
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
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: [{
|
|
211
200
|
type: NgModule,
|
|
212
201
|
args: [{
|
|
213
202
|
imports: [],
|
|
@@ -552,9 +541,9 @@ class AXDateTimePipe {
|
|
|
552
541
|
}
|
|
553
542
|
}
|
|
554
543
|
}
|
|
555
|
-
AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
556
|
-
AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "
|
|
557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
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: [{
|
|
558
547
|
type: Pipe,
|
|
559
548
|
args: [{ name: 'axDate' }]
|
|
560
549
|
}], ctorParameters: function () { return []; } });
|
|
@@ -1119,10 +1108,10 @@ class AXDateTimeModule {
|
|
|
1119
1108
|
});
|
|
1120
1109
|
}
|
|
1121
1110
|
}
|
|
1122
|
-
AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1123
|
-
AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
1124
|
-
AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1125
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
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: [{
|
|
1126
1115
|
type: NgModule,
|
|
1127
1116
|
args: [{
|
|
1128
1117
|
imports: [],
|
|
@@ -1159,9 +1148,9 @@ class AXEventService {
|
|
|
1159
1148
|
}
|
|
1160
1149
|
}
|
|
1161
1150
|
}
|
|
1162
|
-
AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1163
|
-
AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
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: [{
|
|
1165
1154
|
type: Injectable,
|
|
1166
1155
|
args: [{ providedIn: 'root' }]
|
|
1167
1156
|
}] });
|
|
@@ -1189,10 +1178,11 @@ class AXHotkeysService {
|
|
|
1189
1178
|
});
|
|
1190
1179
|
}
|
|
1191
1180
|
}
|
|
1192
|
-
AXHotkeysService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1193
|
-
AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1194
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1195
|
-
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' }]
|
|
1196
1186
|
}], ctorParameters: function () { return [{ type: i1.EventManager }, { type: Document, decorators: [{
|
|
1197
1187
|
type: Inject,
|
|
1198
1188
|
args: [DOCUMENT]
|
|
@@ -1243,19 +1233,19 @@ class AXTranslatorPipe {
|
|
|
1243
1233
|
return AXTranslator.get(value, arg1, arg2);
|
|
1244
1234
|
}
|
|
1245
1235
|
}
|
|
1246
|
-
AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1247
|
-
AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "
|
|
1248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1236
|
+
AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1237
|
+
AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
|
|
1238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslatorPipe, decorators: [{
|
|
1249
1239
|
type: Pipe,
|
|
1250
1240
|
args: [{ name: 'trans', pure: true }]
|
|
1251
1241
|
}] });
|
|
1252
1242
|
|
|
1253
1243
|
class AXTranslationModule {
|
|
1254
1244
|
}
|
|
1255
|
-
AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1256
|
-
AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
1257
|
-
AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1258
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1245
|
+
AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1246
|
+
AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
|
|
1247
|
+
AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, providers: [] });
|
|
1248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXTranslationModule, decorators: [{
|
|
1259
1249
|
type: NgModule,
|
|
1260
1250
|
args: [{
|
|
1261
1251
|
imports: [],
|
|
@@ -1390,9 +1380,9 @@ class AXPlatform {
|
|
|
1390
1380
|
document.querySelector(':root').style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
|
1391
1381
|
}
|
|
1392
1382
|
}
|
|
1393
|
-
AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1394
|
-
AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1395
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1383
|
+
AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1384
|
+
AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
|
|
1385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0", ngImport: i0, type: AXPlatform, decorators: [{
|
|
1396
1386
|
type: Injectable,
|
|
1397
1387
|
args: [{
|
|
1398
1388
|
providedIn: 'platform',
|