@acorex/core 16.0.2 → 17.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/common/README.md +3 -0
- package/common/countries/countries.data.d.ts +2 -0
- package/common/countries/country.d.ts +13 -0
- package/common/index.d.ts +2 -0
- package/config/README.md +3 -0
- package/config/index.d.ts +2 -0
- package/config/lib/configs.d.ts +6 -0
- package/config/lib/configs.service.d.ts +12 -0
- package/date-time/README.md +3 -0
- package/date-time/index.d.ts +10 -0
- package/date-time/lib/calendar.service.d.ts +27 -0
- package/date-time/lib/dateTime.config.d.ts +12 -0
- package/date-time/lib/datetime.class.d.ts +138 -0
- package/date-time/lib/datetime.module.d.ts +8 -0
- package/date-time/lib/datetime.pipe.d.ts +12 -0
- package/date-time/lib/formatters/datetime-formatter.d.ts +19 -0
- package/date-time/lib/formatters/timeleft-formatter.d.ts +16 -0
- package/date-time/lib/georgian.calendar.d.ts +21 -0
- package/date-time/lib/holidays.loader.d.ts +21 -0
- package/date-time/lib/jalali.calendar.d.ts +40 -0
- package/esm2022/common/acorex-core-common.mjs +5 -0
- package/esm2022/common/countries/countries.data.mjs +2625 -0
- package/esm2022/common/countries/country.mjs +2 -0
- package/esm2022/common/index.mjs +3 -0
- package/esm2022/config/acorex-core-config.mjs +5 -0
- package/esm2022/config/index.mjs +3 -0
- package/esm2022/config/lib/configs.mjs +7 -0
- package/esm2022/config/lib/configs.service.mjs +27 -0
- package/esm2022/date-time/acorex-core-date-time.mjs +5 -0
- package/esm2022/date-time/index.mjs +11 -0
- package/esm2022/date-time/lib/calendar.service.mjs +100 -0
- package/esm2022/date-time/lib/dateTime.config.mjs +50 -0
- package/esm2022/date-time/lib/datetime.class.mjs +337 -0
- package/esm2022/date-time/lib/datetime.module.mjs +27 -0
- package/esm2022/date-time/lib/datetime.pipe.mjs +29 -0
- package/esm2022/date-time/lib/formatters/datetime-formatter.mjs +32 -0
- package/esm2022/date-time/lib/formatters/timeleft-formatter.mjs +91 -0
- package/esm2022/date-time/lib/georgian.calendar.mjs +203 -0
- package/esm2022/date-time/lib/holidays.loader.mjs +13 -0
- package/esm2022/date-time/lib/jalali.calendar.mjs +440 -0
- package/esm2022/events/acorex-core-events.mjs +5 -0
- package/esm2022/events/index.mjs +3 -0
- package/esm2022/events/lib/event.service.mjs +43 -0
- package/esm2022/events/lib/event.type.mjs +6 -0
- package/esm2022/file/acorex-core-file.mjs +5 -0
- package/esm2022/file/index.mjs +7 -0
- package/esm2022/file/lib/file-download-ref.class.mjs +12 -0
- package/esm2022/file/lib/file-download-result.class.mjs +45 -0
- package/esm2022/file/lib/file-size-formatter.mjs +24 -0
- package/esm2022/file/lib/file-upload-ref.class.mjs +12 -0
- package/esm2022/file/lib/file.module.mjs +20 -0
- package/esm2022/file/lib/file.service.mjs +103 -0
- package/esm2022/format/acorex-core-format.mjs +5 -0
- package/esm2022/format/index.mjs +8 -0
- package/esm2022/format/lib/format.config.mjs +3 -0
- package/esm2022/format/lib/format.module.mjs +64 -0
- package/esm2022/format/lib/format.pipe.mjs +37 -0
- package/esm2022/format/lib/format.service.mjs +95 -0
- package/esm2022/format/lib/format.types.mjs +2 -0
- package/esm2022/format/lib/formatters/number-formatter.mjs +74 -0
- package/esm2022/format/lib/formatters/string-formatter.mjs +15 -0
- package/esm2022/image/acorex-core-image.mjs +5 -0
- package/esm2022/image/index.mjs +2 -0
- package/esm2022/image/lib/image.service.mjs +43 -0
- package/esm2022/index.mjs +2 -44
- package/esm2022/memorize/acorex-core-memorize.mjs +5 -0
- package/esm2022/memorize/index.mjs +2 -0
- package/esm2022/memorize/lib/memorize.decorator.mjs +19 -0
- package/esm2022/pipes/acorex-core-pipes.mjs +5 -0
- package/esm2022/pipes/index.mjs +2 -0
- package/esm2022/pipes/lib/safe/safe.pipe.mjs +38 -0
- package/esm2022/platform/acorex-core-platform.mjs +5 -0
- package/esm2022/platform/index.mjs +2 -0
- package/esm2022/platform/lib/platform.service.mjs +225 -0
- package/esm2022/storage/acorex-core-storage.mjs +5 -0
- package/esm2022/storage/cookie-storage.service.mjs +202 -0
- package/esm2022/storage/index.mjs +5 -0
- package/esm2022/storage/local-storage.service.mjs +58 -0
- package/esm2022/storage/session-storage.service.mjs +22 -0
- package/esm2022/storage/storage.interface.mjs +2 -0
- package/esm2022/translation/acorex-core-translation.mjs +5 -0
- package/esm2022/translation/index.mjs +9 -0
- package/esm2022/translation/lib/translation-scope.resolver.mjs +11 -0
- package/esm2022/translation/lib/translation.config.mjs +20 -0
- package/esm2022/translation/lib/translation.loader.mjs +14 -0
- package/esm2022/translation/lib/translation.module.mjs +40 -0
- package/esm2022/translation/lib/translation.service.mjs +173 -0
- package/esm2022/translation/lib/translation.types.mjs +2 -0
- package/esm2022/translation/lib/translator.directive.mjs +28 -0
- package/esm2022/translation/lib/translator.pipe.mjs +23 -0
- package/esm2022/types/acorex-core-types.mjs +5 -0
- package/esm2022/types/index.mjs +2 -0
- package/esm2022/utils/acorex-core-utils.mjs +5 -0
- package/esm2022/utils/index.mjs +6 -0
- package/esm2022/utils/lib/auto-unsubscribe.mjs +36 -0
- package/esm2022/utils/lib/color-util.mjs +111 -0
- package/esm2022/utils/lib/drawing-util.mjs +35 -0
- package/esm2022/utils/lib/html-util.mjs +39 -0
- package/esm2022/utils/lib/string-util.mjs +19 -0
- package/esm2022/validation/acorex-core-validation.mjs +5 -0
- package/esm2022/validation/index.mjs +18 -0
- package/esm2022/validation/lib/rules/between-rule.mjs +31 -0
- package/esm2022/validation/lib/rules/callback-rule.mjs +29 -0
- package/esm2022/validation/lib/rules/equal-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/greater-than.mjs +29 -0
- package/esm2022/validation/lib/rules/length-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/less-than-rule.mjs +29 -0
- package/esm2022/validation/lib/rules/maxlength-rule.mjs +27 -0
- package/esm2022/validation/lib/rules/minlength-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/regex-rule.mjs +49 -0
- package/esm2022/validation/lib/rules/required-rule.mjs +36 -0
- package/esm2022/validation/lib/validation.config.mjs +33 -0
- package/esm2022/validation/lib/validation.module.mjs +84 -0
- package/esm2022/validation/lib/validation.service.mjs +98 -0
- package/esm2022/validation/lib/validation.types.mjs +3 -0
- package/events/README.md +3 -0
- package/events/index.d.ts +2 -0
- package/{lib/services → events/lib}/event.service.d.ts +8 -0
- package/events/lib/event.type.d.ts +5 -0
- package/fesm2022/acorex-core-common.mjs +2631 -0
- package/fesm2022/acorex-core-common.mjs.map +1 -0
- package/fesm2022/acorex-core-config.mjs +39 -0
- package/fesm2022/acorex-core-config.mjs.map +1 -0
- package/fesm2022/acorex-core-date-time.mjs +1305 -0
- package/fesm2022/acorex-core-date-time.mjs.map +1 -0
- package/fesm2022/acorex-core-events.mjs +56 -0
- package/fesm2022/acorex-core-events.mjs.map +1 -0
- package/fesm2022/acorex-core-file.mjs +214 -0
- package/fesm2022/acorex-core-file.mjs.map +1 -0
- package/fesm2022/acorex-core-format.mjs +282 -0
- package/fesm2022/acorex-core-format.mjs.map +1 -0
- package/fesm2022/acorex-core-image.mjs +50 -0
- package/fesm2022/acorex-core-image.mjs.map +1 -0
- package/fesm2022/acorex-core-memorize.mjs +26 -0
- package/fesm2022/acorex-core-memorize.mjs.map +1 -0
- package/fesm2022/acorex-core-pipes.mjs +44 -0
- package/fesm2022/acorex-core-pipes.mjs.map +1 -0
- package/fesm2022/acorex-core-platform.mjs +232 -0
- package/fesm2022/acorex-core-platform.mjs.map +1 -0
- package/fesm2022/acorex-core-storage.mjs +285 -0
- package/fesm2022/acorex-core-storage.mjs.map +1 -0
- package/fesm2022/acorex-core-translation.mjs +293 -0
- package/fesm2022/acorex-core-translation.mjs.map +1 -0
- package/fesm2022/acorex-core-types.mjs +6 -0
- package/fesm2022/acorex-core-types.mjs.map +1 -0
- package/fesm2022/acorex-core-utils.mjs +247 -0
- package/fesm2022/acorex-core-utils.mjs.map +1 -0
- package/fesm2022/acorex-core-validation.mjs +488 -0
- package/fesm2022/acorex-core-validation.mjs.map +1 -0
- package/fesm2022/acorex-core.mjs +2 -2309
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/file/README.md +3 -0
- package/file/index.d.ts +6 -0
- package/file/lib/file-download-ref.class.d.ts +6 -0
- package/file/lib/file-download-result.class.d.ts +8 -0
- package/file/lib/file-size-formatter.d.ts +16 -0
- package/file/lib/file-upload-ref.class.d.ts +5 -0
- package/file/lib/file.module.d.ts +7 -0
- package/file/lib/file.service.d.ts +18 -0
- package/format/README.md +3 -0
- package/format/index.d.ts +7 -0
- package/format/lib/format.config.d.ts +5 -0
- package/format/lib/format.module.d.ts +18 -0
- package/format/lib/format.pipe.d.ts +12 -0
- package/format/lib/format.service.d.ts +43 -0
- package/format/lib/format.types.d.ts +4 -0
- package/format/lib/formatters/number-formatter.d.ts +23 -0
- package/format/lib/formatters/string-formatter.d.ts +14 -0
- package/image/README.md +3 -0
- package/image/index.d.ts +1 -0
- package/image/lib/image.service.d.ts +11 -0
- package/index.d.ts +1 -43
- package/memorize/README.md +3 -0
- package/memorize/index.d.ts +1 -0
- package/memorize/lib/memorize.decorator.d.ts +1 -0
- package/package.json +98 -5
- package/pipes/README.md +3 -0
- package/pipes/index.d.ts +1 -0
- package/pipes/lib/safe/safe.pipe.d.ts +10 -0
- package/platform/README.md +3 -0
- package/platform/index.d.ts +1 -0
- package/{lib/platform → platform/lib}/platform.service.d.ts +14 -6
- package/storage/README.md +3 -0
- package/storage/cookie-storage.service.d.ts +104 -0
- package/storage/index.d.ts +4 -0
- package/storage/local-storage.service.d.ts +16 -0
- package/storage/session-storage.service.d.ts +10 -0
- package/storage/storage.interface.d.ts +14 -0
- package/translation/README.md +3 -0
- package/translation/index.d.ts +8 -0
- package/translation/lib/translation-scope.resolver.d.ts +2 -0
- package/translation/lib/translation.config.d.ts +14 -0
- package/translation/lib/translation.loader.d.ts +14 -0
- package/translation/lib/translation.module.d.ts +8 -0
- package/translation/lib/translation.service.d.ts +31 -0
- package/translation/lib/translation.types.d.ts +10 -0
- package/translation/lib/translator.directive.d.ts +12 -0
- package/translation/lib/translator.pipe.d.ts +12 -0
- package/types/README.md +3 -0
- package/types/index.d.ts +2 -0
- package/utils/README.md +3 -0
- package/utils/index.d.ts +5 -0
- package/utils/lib/auto-unsubscribe.d.ts +12 -0
- package/utils/lib/color-util.d.ts +24 -0
- package/utils/lib/drawing-util.d.ts +18 -0
- package/utils/lib/html-util.d.ts +5 -0
- package/utils/lib/string-util.d.ts +6 -0
- package/validation/README.md +3 -0
- package/validation/index.d.ts +14 -0
- package/validation/lib/rules/between-rule.d.ts +18 -0
- package/validation/lib/rules/callback-rule.d.ts +23 -0
- package/validation/lib/rules/equal-rule.d.ts +17 -0
- package/validation/lib/rules/greater-than.d.ts +17 -0
- package/validation/lib/rules/length-rule.d.ts +17 -0
- package/validation/lib/rules/less-than-rule.d.ts +17 -0
- package/validation/lib/rules/maxlength-rule.d.ts +16 -0
- package/validation/lib/rules/minlength-rule.d.ts +16 -0
- package/validation/lib/rules/regex-rule.d.ts +17 -0
- package/validation/lib/rules/required-rule.d.ts +16 -0
- package/validation/lib/validation.config.d.ts +15 -0
- package/validation/lib/validation.module.d.ts +17 -0
- package/validation/lib/validation.service.d.ts +35 -0
- package/validation/lib/validation.types.d.ts +21 -0
- package/esm2022/lib/classes/base-page.class.mjs +0 -26
- package/esm2022/lib/classes/color.class.mjs +0 -49
- package/esm2022/lib/classes/datetime.class.mjs +0 -323
- package/esm2022/lib/classes/menu.class.mjs +0 -35
- package/esm2022/lib/classes/navigator.class.mjs +0 -2
- package/esm2022/lib/classes/popup.class.mjs +0 -2
- package/esm2022/lib/classes/promise.class.mjs +0 -21
- package/esm2022/lib/classes/sectionlist.class.mjs +0 -2
- package/esm2022/lib/classes/select.class.mjs +0 -8
- package/esm2022/lib/core.module.mjs +0 -27
- package/esm2022/lib/error/error.class.mjs +0 -2
- package/esm2022/lib/error/error.module.mjs +0 -19
- package/esm2022/lib/error/error.service.mjs +0 -22
- package/esm2022/lib/events/keyboard.mjs +0 -2
- package/esm2022/lib/http/http-error.class.mjs +0 -2
- package/esm2022/lib/http/http-events.interceptor.mjs +0 -3
- package/esm2022/lib/http/http-request.class.mjs +0 -2
- package/esm2022/lib/http/http-result.class.mjs +0 -25
- package/esm2022/lib/http/http.module.mjs +0 -35
- package/esm2022/lib/http/http.service.mjs +0 -148
- package/esm2022/lib/locale/en.json +0 -255
- package/esm2022/lib/locale/fa.json +0 -245
- package/esm2022/lib/pipe/datetime.pipe.mjs +0 -25
- package/esm2022/lib/pipe/htmlToText.pipe.mjs +0 -25
- package/esm2022/lib/platform/index.mjs +0 -2
- package/esm2022/lib/platform/platform.service.mjs +0 -152
- package/esm2022/lib/services/config.mjs +0 -29
- package/esm2022/lib/services/event.service.mjs +0 -34
- package/esm2022/lib/services/navigator.service.mjs +0 -10
- package/esm2022/lib/services/storage.service.mjs +0 -16
- package/esm2022/lib/translator/translator.mjs +0 -26
- package/esm2022/lib/translator/translator.module.mjs +0 -25
- package/esm2022/lib/translator/translator.pipe.mjs +0 -24
- package/esm2022/lib/translator/translator.service.mjs +0 -21
- package/esm2022/lib/utils/array/array-util.mjs +0 -133
- package/esm2022/lib/utils/html/html-util.mjs +0 -200
- package/esm2022/lib/utils/html/html.module.mjs +0 -19
- package/esm2022/lib/utils/math/math-util.mjs +0 -6
- package/esm2022/lib/utils/object/object-util.mjs +0 -83
- package/esm2022/lib/utils/render/on-demand-preload-strategy.service.mjs +0 -21
- package/esm2022/lib/utils/render/render.service.mjs +0 -109
- package/esm2022/lib/utils/render/rendering.module.mjs +0 -35
- package/esm2022/lib/utils/scroll/scroll.directive.mjs +0 -56
- package/esm2022/lib/utils/scroll/scroll.module.mjs +0 -19
- package/esm2022/lib/utils/separator/separator.module.mjs +0 -19
- package/esm2022/lib/utils/separator/separator.pipe.mjs +0 -33
- package/lib/classes/base-page.class.d.ts +0 -13
- package/lib/classes/color.class.d.ts +0 -17
- package/lib/classes/datetime.class.d.ts +0 -63
- package/lib/classes/menu.class.d.ts +0 -34
- package/lib/classes/navigator.class.d.ts +0 -5
- package/lib/classes/popup.class.d.ts +0 -12
- package/lib/classes/promise.class.d.ts +0 -7
- package/lib/classes/sectionlist.class.d.ts +0 -8
- package/lib/classes/select.class.d.ts +0 -7
- package/lib/core.module.d.ts +0 -9
- package/lib/error/error.class.d.ts +0 -4
- package/lib/error/error.module.d.ts +0 -7
- package/lib/error/error.service.d.ts +0 -13
- package/lib/events/keyboard.d.ts +0 -2
- package/lib/http/http-error.class.d.ts +0 -7
- package/lib/http/http-events.interceptor.d.ts +0 -10
- package/lib/http/http-request.class.d.ts +0 -14
- package/lib/http/http-result.class.d.ts +0 -11
- package/lib/http/http.module.d.ts +0 -10
- package/lib/http/http.service.d.ts +0 -23
- package/lib/pipe/datetime.pipe.d.ts +0 -8
- package/lib/pipe/htmlToText.pipe.d.ts +0 -7
- package/lib/platform/index.d.ts +0 -1
- package/lib/services/config.d.ts +0 -9
- package/lib/services/navigator.service.d.ts +0 -8
- package/lib/services/storage.service.d.ts +0 -7
- package/lib/translator/translator.d.ts +0 -9
- package/lib/translator/translator.module.d.ts +0 -8
- package/lib/translator/translator.pipe.d.ts +0 -8
- package/lib/translator/translator.service.d.ts +0 -8
- package/lib/utils/array/array-util.d.ts +0 -6
- package/lib/utils/html/html-util.d.ts +0 -62
- package/lib/utils/html/html.module.d.ts +0 -8
- package/lib/utils/math/math-util.d.ts +0 -3
- package/lib/utils/object/object-util.d.ts +0 -7
- package/lib/utils/render/on-demand-preload-strategy.service.d.ts +0 -10
- package/lib/utils/render/render.service.d.ts +0 -18
- package/lib/utils/render/rendering.module.d.ts +0 -8
- package/lib/utils/scroll/scroll.directive.d.ts +0 -18
- package/lib/utils/scroll/scroll.module.d.ts +0 -8
- package/lib/utils/separator/separator.module.d.ts +0 -8
- package/lib/utils/separator/separator.pipe.d.ts +0 -8
@@ -0,0 +1,232 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Injectable } from '@angular/core';
|
3
|
+
import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
|
4
|
+
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
5
|
+
|
6
|
+
const isChrome = (win) => testUserAgent(win, /Chrome/i);
|
7
|
+
const isFirefox = (win) => testUserAgent(win, /Firefox/i);
|
8
|
+
const isEdge = (win) => testUserAgent(win, /Edge/i);
|
9
|
+
const isSafari = (win) => testUserAgent(win, /Safari/i);
|
10
|
+
const isOpera = (win) => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
|
11
|
+
const isMSIE = (win) => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
|
12
|
+
const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
|
13
|
+
const isIpad = (win) => {
|
14
|
+
// iOS 12 and below
|
15
|
+
if (testUserAgent(win, /iPad/i)) {
|
16
|
+
return true;
|
17
|
+
}
|
18
|
+
// iOS 13+
|
19
|
+
if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
return false;
|
23
|
+
};
|
24
|
+
const isIphone = (win) => testUserAgent(win, /iPhone/i);
|
25
|
+
const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
|
26
|
+
const isAndroid = (win) => testUserAgent(win, /android|sink/i);
|
27
|
+
const isAndroidTablet = (win) => {
|
28
|
+
return isAndroid(win) && !testUserAgent(win, /mobile/i);
|
29
|
+
};
|
30
|
+
const isPhablet = (win) => {
|
31
|
+
const width = win.innerWidth;
|
32
|
+
const height = win.innerHeight;
|
33
|
+
const smallest = Math.min(width, height);
|
34
|
+
const largest = Math.max(width, height);
|
35
|
+
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
|
36
|
+
};
|
37
|
+
const isTablet = (win) => {
|
38
|
+
const width = win.innerWidth;
|
39
|
+
const height = win.innerHeight;
|
40
|
+
const smallest = Math.min(width, height);
|
41
|
+
const largest = Math.max(width, height);
|
42
|
+
return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);
|
43
|
+
};
|
44
|
+
const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');
|
45
|
+
const isTouch = (win) => matchMedia(win, '(any-pointer:coarse)');
|
46
|
+
const isDesktop = (win) => !isMobile(win);
|
47
|
+
const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
|
48
|
+
const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
49
|
+
const isCapacitorNative = (win) => {
|
50
|
+
const capacitor = win['Capacitor'];
|
51
|
+
return !!(capacitor && capacitor.isNative);
|
52
|
+
};
|
53
|
+
const isElectron = (win) => testUserAgent(win, /electron/i);
|
54
|
+
const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
|
55
|
+
const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
|
56
|
+
const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');
|
57
|
+
const isServer = new Function('try {return this===global;}catch(e){return false;}');
|
58
|
+
const matchMedia = (win, query) => {
|
59
|
+
if (isBrowser())
|
60
|
+
return win.matchMedia(query).matches;
|
61
|
+
return false;
|
62
|
+
};
|
63
|
+
const isSMScreen = (win) => matchMedia(win, '(max-width: 578px)');
|
64
|
+
const isMDScreen = (win) => matchMedia(win, '(max-width: 768px)');
|
65
|
+
const isLGScreen = (win) => matchMedia(win, '(max-width: 992px)');
|
66
|
+
const isXLScreen = (win) => matchMedia(win, '(max-width: 1200px)');
|
67
|
+
const is2XLScreen = (win) => matchMedia(win, '(max-width: 1440px)');
|
68
|
+
const is3XLScreen = (win) => matchMedia(win, '(max-width: 1920px)');
|
69
|
+
const is4XLScreen = (win) => matchMedia(win, '(max-width: 2560px)');
|
70
|
+
const PLATFORMS_MAP = {
|
71
|
+
Android: isAndroid,
|
72
|
+
iOS: isIOS,
|
73
|
+
Desktop: isDesktop,
|
74
|
+
Mobile: isMobile,
|
75
|
+
Touch: isTouch,
|
76
|
+
Chrome: isChrome,
|
77
|
+
Firefox: isFirefox,
|
78
|
+
Safari: isSafari,
|
79
|
+
Edge: isEdge,
|
80
|
+
Opera: isOpera,
|
81
|
+
Hybrid: isHybrid,
|
82
|
+
PWA: isPWA,
|
83
|
+
Electron: isElectron,
|
84
|
+
SM: isSMScreen,
|
85
|
+
MD: isMDScreen,
|
86
|
+
LG: isLGScreen,
|
87
|
+
XL: isXLScreen,
|
88
|
+
'2XL': is2XLScreen,
|
89
|
+
'3XL': is3XLScreen,
|
90
|
+
'4XL': is4XLScreen,
|
91
|
+
};
|
92
|
+
class AXPlatformEvent {
|
93
|
+
}
|
94
|
+
class AXPlatform {
|
95
|
+
isRtl() {
|
96
|
+
return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';
|
97
|
+
}
|
98
|
+
isLandscape() {
|
99
|
+
return window.innerHeight < window.innerWidth;
|
100
|
+
}
|
101
|
+
isPortrate() {
|
102
|
+
return !this.isLandscape();
|
103
|
+
}
|
104
|
+
is(name) {
|
105
|
+
if (isBrowser()) {
|
106
|
+
return PLATFORMS_MAP[name](window) || false;
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
return false;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
get screenSize() {
|
113
|
+
return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find((name) => PLATFORMS_MAP[name](window) == true) || '5XL');
|
114
|
+
}
|
115
|
+
switchLightMode() {
|
116
|
+
const _html = document.getElementsByTagName('html')[0];
|
117
|
+
_html.classList.remove('ax-dark');
|
118
|
+
localStorage.setItem('AX_THEME_MODE', 'light');
|
119
|
+
this.themeMode$.next('light');
|
120
|
+
return 'light';
|
121
|
+
}
|
122
|
+
switchDarkMode() {
|
123
|
+
const _html = document.getElementsByTagName('html')[0];
|
124
|
+
_html.classList.add('ax-dark');
|
125
|
+
localStorage.setItem('AX_THEME_MODE', 'dark');
|
126
|
+
this.themeMode$.next('dark');
|
127
|
+
}
|
128
|
+
switchSystemMode() {
|
129
|
+
if (isBrowser()) {
|
130
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
131
|
+
const _html = document.getElementsByTagName('html')[0];
|
132
|
+
_html.classList.add('ax-dark');
|
133
|
+
}
|
134
|
+
else {
|
135
|
+
const _html = document.getElementsByTagName('html')[0];
|
136
|
+
_html.classList.remove('ax-dark');
|
137
|
+
}
|
138
|
+
localStorage.setItem('AX_THEME_MODE', 'system');
|
139
|
+
this.themeMode$.next('system');
|
140
|
+
}
|
141
|
+
}
|
142
|
+
autoDetectThemeMode() {
|
143
|
+
if (isBrowser()) {
|
144
|
+
const mode = localStorage.getItem('AX_THEME_MODE') || 'system';
|
145
|
+
switch (mode) {
|
146
|
+
case 'light':
|
147
|
+
return this.switchLightMode();
|
148
|
+
case 'dark':
|
149
|
+
return this.switchDarkMode();
|
150
|
+
case 'system':
|
151
|
+
return this.switchSystemMode();
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
_setFullHeightRatio() {
|
156
|
+
try {
|
157
|
+
if (isBrowser()) {
|
158
|
+
document.querySelector(':root')?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
159
|
+
}
|
160
|
+
}
|
161
|
+
catch (error) {
|
162
|
+
console.error(error);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
autoSystemModeDetection(event) {
|
166
|
+
if (this.themeMode$.getValue() === 'system') {
|
167
|
+
const themeMode = event.matches ? 'dark' : 'light';
|
168
|
+
if (themeMode === 'dark') {
|
169
|
+
const _html = document.getElementsByTagName('html')[0];
|
170
|
+
_html.classList.add('ax-dark');
|
171
|
+
}
|
172
|
+
else {
|
173
|
+
const _html = document.getElementsByTagName('html')[0];
|
174
|
+
_html.classList.remove('ax-dark');
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
constructor() {
|
179
|
+
this.resize = new Subject();
|
180
|
+
this.click = new Subject();
|
181
|
+
this.scroll = new Subject();
|
182
|
+
this.themeMode$ = new BehaviorSubject('system');
|
183
|
+
if (isBrowser()) {
|
184
|
+
fromEvent(window, 'resize')
|
185
|
+
.pipe(debounceTime(100))
|
186
|
+
.pipe(distinctUntilChanged())
|
187
|
+
.subscribe((e) => {
|
188
|
+
this.resize.next({
|
189
|
+
nativeEvent: e,
|
190
|
+
source: this,
|
191
|
+
});
|
192
|
+
//
|
193
|
+
this._setFullHeightRatio();
|
194
|
+
});
|
195
|
+
if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {
|
196
|
+
window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {
|
197
|
+
// Detect System color mode
|
198
|
+
this.autoSystemModeDetection(event);
|
199
|
+
});
|
200
|
+
}
|
201
|
+
document.addEventListener('click', (e) => {
|
202
|
+
this.click.next({
|
203
|
+
nativeEvent: e,
|
204
|
+
source: this,
|
205
|
+
});
|
206
|
+
}, true);
|
207
|
+
document.addEventListener('scroll', (e) => {
|
208
|
+
this.scroll.next({
|
209
|
+
nativeEvent: e,
|
210
|
+
source: this,
|
211
|
+
});
|
212
|
+
}, true);
|
213
|
+
}
|
214
|
+
// init functions
|
215
|
+
this._setFullHeightRatio();
|
216
|
+
}
|
217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
218
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXPlatform, providedIn: 'root' }); }
|
219
|
+
}
|
220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXPlatform, decorators: [{
|
221
|
+
type: Injectable,
|
222
|
+
args: [{
|
223
|
+
providedIn: 'root',
|
224
|
+
}]
|
225
|
+
}], ctorParameters: () => [] });
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Generated bundle index. Do not edit.
|
229
|
+
*/
|
230
|
+
|
231
|
+
export { AXPlatform, AXPlatformEvent, isBrowser, isServer, testUserAgent };
|
232
|
+
//# sourceMappingURL=acorex-core-platform.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Subject, fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nconst isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nconst isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nconst isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nconst isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);\n};\n\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nconst isDesktop = (win: Window) => !isMobile(win);\n\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nconst isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nconst isPWA = (win: Window): boolean => !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nconst matchMedia = (win: Window, query: string): boolean => {\n if (isBrowser()) return win.matchMedia(query).matches;\n return false;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 578px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 992px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1200px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1440px)');\nconst is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nconst is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nconst PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n isRtl(): boolean {\n return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';\n }\n\n isLandscape(): boolean {\n return window.innerHeight < window.innerWidth;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isBrowser()) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find((name) => PLATFORMS_MAP[name](window) == true) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'light');\n this.themeMode$.next('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'dark');\n this.themeMode$.next('dark');\n }\n\n switchSystemMode() {\n if (isBrowser()) {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n localStorage.setItem('AX_THEME_MODE', 'system');\n this.themeMode$.next('system');\n }\n }\n\n autoDetectThemeMode() {\n if (isBrowser()) {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n case 'system':\n return this.switchSystemMode();\n }\n }\n }\n\n private _setFullHeightRatio() {\n try {\n if (isBrowser()) {\n document.querySelector<HTMLElement>(':root')?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode$.getValue() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this._setFullHeightRatio();\n });\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n\n document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n // init functions\n this._setFullHeightRatio();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAWA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAE3E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAErE,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAErG,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAEvG,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAE9E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAI;;AAE7B,IAAA,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;AAC/B,QAAA,OAAO,IAAI,CAAC;KACb;;AAGD,IAAA,IAAI,aAAa,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE;AACrD,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,GAAW,K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AA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACf,oBAAA,WAAW,EAAE,CAAC;AACd,oBAAA,MAAM,EAAE,IAAI;AACb,iBAAA,CAAC,CAAC;aACJ,EACD,IAAI,CACL,CAAC;SACH;;QAGD,IAAI,CAAC,mBAAmB,EAAE,CAAC;KAC5B;8GA9IU,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACrID;;AAEG;;;;"}
|
@@ -0,0 +1,285 @@
|
|
1
|
+
import { isPlatformBrowser, DOCUMENT } from '@angular/common';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { PLATFORM_ID, Injectable, Inject, InjectionToken } from '@angular/core';
|
4
|
+
import { isBrowser } from '@acorex/core/platform';
|
5
|
+
import * as CryptoJS from 'crypto-js';
|
6
|
+
|
7
|
+
class AXCookieStorageService {
|
8
|
+
constructor(document,
|
9
|
+
// Get the `PLATFORM_ID` so we can check if we're in a browser.
|
10
|
+
platformId) {
|
11
|
+
this.document = document;
|
12
|
+
this.platformId = platformId;
|
13
|
+
this.documentIsAccessible = isPlatformBrowser(this.platformId);
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Get cookie Regular Expression
|
17
|
+
*
|
18
|
+
* @param name Cookie name
|
19
|
+
* @returns property RegExp
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
static getCookieRegExp(name) {
|
23
|
+
const escapedName = name.replace(/([[\]{}()|=;+?,.*^$])/gi, '\\$1');
|
24
|
+
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
28
|
+
*
|
29
|
+
* @param encodedURIComponent A value representing an encoded URI component.
|
30
|
+
*
|
31
|
+
* @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
32
|
+
*
|
33
|
+
*/
|
34
|
+
static safeDecodeURIComponent(encodedURIComponent) {
|
35
|
+
try {
|
36
|
+
return decodeURIComponent(encodedURIComponent);
|
37
|
+
}
|
38
|
+
catch {
|
39
|
+
// probably it is not uri encoded. return as is
|
40
|
+
return encodedURIComponent;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Return `true` if {@link Document} is accessible, otherwise return `false`
|
45
|
+
*
|
46
|
+
* @param name Cookie name
|
47
|
+
* @returns boolean - whether cookie with specified name exists
|
48
|
+
*
|
49
|
+
*/
|
50
|
+
check(name) {
|
51
|
+
if (!this.documentIsAccessible) {
|
52
|
+
return false;
|
53
|
+
}
|
54
|
+
name = encodeURIComponent(name);
|
55
|
+
const regExp = AXCookieStorageService.getCookieRegExp(name);
|
56
|
+
return regExp.test(this.document.cookie);
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Get cookies by name
|
60
|
+
*
|
61
|
+
* @param name Cookie name
|
62
|
+
* @returns property value
|
63
|
+
*
|
64
|
+
*/
|
65
|
+
get(name) {
|
66
|
+
if (this.documentIsAccessible && this.check(name)) {
|
67
|
+
name = encodeURIComponent(name);
|
68
|
+
const regExp = AXCookieStorageService.getCookieRegExp(name);
|
69
|
+
const result = regExp.exec(this.document.cookie);
|
70
|
+
return result[1]
|
71
|
+
? AXCookieStorageService.safeDecodeURIComponent(result[1])
|
72
|
+
: '';
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
return '';
|
76
|
+
}
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Get all cookies in JSON format
|
80
|
+
*
|
81
|
+
* @returns all the cookies in json
|
82
|
+
*
|
83
|
+
*/
|
84
|
+
getAll() {
|
85
|
+
if (!this.documentIsAccessible) {
|
86
|
+
return {};
|
87
|
+
}
|
88
|
+
const cookies = {};
|
89
|
+
const document = this.document;
|
90
|
+
if (document.cookie && document.cookie !== '') {
|
91
|
+
document.cookie.split(';').forEach((currentCookie) => {
|
92
|
+
const [cookieName, cookieValue] = currentCookie.split('=');
|
93
|
+
cookies[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = AXCookieStorageService.safeDecodeURIComponent(cookieValue);
|
94
|
+
});
|
95
|
+
}
|
96
|
+
return cookies;
|
97
|
+
}
|
98
|
+
set(name, value, expiresOrOptions, path, domain, secure, sameSite) {
|
99
|
+
if (!this.documentIsAccessible) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
if (typeof expiresOrOptions === 'number' ||
|
103
|
+
expiresOrOptions instanceof Date ||
|
104
|
+
path ||
|
105
|
+
domain ||
|
106
|
+
secure ||
|
107
|
+
sameSite) {
|
108
|
+
const optionsBody = {
|
109
|
+
expires: expiresOrOptions,
|
110
|
+
path,
|
111
|
+
domain,
|
112
|
+
secure,
|
113
|
+
sameSite: sameSite ? sameSite : 'Lax',
|
114
|
+
};
|
115
|
+
this.set(name, value, optionsBody);
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
|
119
|
+
const options = expiresOrOptions ? expiresOrOptions : {};
|
120
|
+
if (options.expires) {
|
121
|
+
if (typeof options.expires === 'number') {
|
122
|
+
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);
|
123
|
+
cookieString += 'expires=' + dateExpires.toUTCString() + ';';
|
124
|
+
}
|
125
|
+
else {
|
126
|
+
cookieString += 'expires=' + options.expires.toUTCString() + ';';
|
127
|
+
}
|
128
|
+
}
|
129
|
+
if (options.path) {
|
130
|
+
cookieString += 'path=' + options.path + ';';
|
131
|
+
}
|
132
|
+
if (options.domain) {
|
133
|
+
cookieString += 'domain=' + options.domain + ';';
|
134
|
+
}
|
135
|
+
if (options.secure === false && options.sameSite === 'None') {
|
136
|
+
options.secure = true;
|
137
|
+
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +
|
138
|
+
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);
|
139
|
+
}
|
140
|
+
if (options.secure) {
|
141
|
+
cookieString += 'secure;';
|
142
|
+
}
|
143
|
+
if (!options.sameSite) {
|
144
|
+
options.sameSite = 'Lax';
|
145
|
+
}
|
146
|
+
cookieString += 'sameSite=' + options.sameSite + ';';
|
147
|
+
this.document.cookie = cookieString;
|
148
|
+
}
|
149
|
+
/**
|
150
|
+
* Delete cookie by name
|
151
|
+
*
|
152
|
+
* @param name Cookie name
|
153
|
+
* @param path Cookie path
|
154
|
+
* @param domain Cookie domain
|
155
|
+
* @param secure Cookie secure flag
|
156
|
+
* @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
157
|
+
*
|
158
|
+
*/
|
159
|
+
delete(name, path, domain, secure, sameSite = 'Lax') {
|
160
|
+
if (!this.documentIsAccessible) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');
|
164
|
+
this.set(name, '', {
|
165
|
+
expires: expiresDate,
|
166
|
+
path,
|
167
|
+
domain,
|
168
|
+
secure,
|
169
|
+
sameSite,
|
170
|
+
});
|
171
|
+
}
|
172
|
+
/**
|
173
|
+
* Delete all cookies
|
174
|
+
*
|
175
|
+
* @param path Cookie path
|
176
|
+
* @param domain Cookie domain
|
177
|
+
* @param secure Is the Cookie secure
|
178
|
+
* @param sameSite Is the cookie same site
|
179
|
+
*
|
180
|
+
*/
|
181
|
+
deleteAll(path, domain, secure, sameSite = 'Lax') {
|
182
|
+
if (!this.documentIsAccessible) {
|
183
|
+
return;
|
184
|
+
}
|
185
|
+
const cookies = this.getAll();
|
186
|
+
for (const cookieName in cookies) {
|
187
|
+
// eslint-disable-next-line no-prototype-builtins
|
188
|
+
if (cookies.hasOwnProperty(cookieName)) {
|
189
|
+
this.delete(cookieName, path, domain, secure, sameSite);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXCookieStorageService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
194
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXCookieStorageService }); }
|
195
|
+
}
|
196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXCookieStorageService, decorators: [{
|
197
|
+
type: Injectable
|
198
|
+
}], ctorParameters: () => [{ type: Document, decorators: [{
|
199
|
+
type: Inject,
|
200
|
+
args: [DOCUMENT]
|
201
|
+
}] }, { type: undefined, decorators: [{
|
202
|
+
type: Inject,
|
203
|
+
args: [PLATFORM_ID]
|
204
|
+
}] }] });
|
205
|
+
|
206
|
+
const AX_LOCALSTORAGE_SECRET_KEY = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');
|
207
|
+
class AXLocalStorageService {
|
208
|
+
constructor(secret_key) {
|
209
|
+
this.secret_key = secret_key;
|
210
|
+
}
|
211
|
+
get(key) {
|
212
|
+
if (isBrowser()) {
|
213
|
+
return JSON.parse(localStorage.getItem(key) || '');
|
214
|
+
}
|
215
|
+
else {
|
216
|
+
return null;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
set(key, value) {
|
220
|
+
if (isBrowser()) {
|
221
|
+
return localStorage.setItem(key, JSON.stringify(value));
|
222
|
+
}
|
223
|
+
}
|
224
|
+
clear() {
|
225
|
+
if (isBrowser()) {
|
226
|
+
return localStorage.clear();
|
227
|
+
}
|
228
|
+
}
|
229
|
+
removeItem(key) {
|
230
|
+
if (isBrowser()) {
|
231
|
+
return localStorage.removeItem(key);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
setWithEncryption(key, value) {
|
235
|
+
if (isBrowser()) {
|
236
|
+
const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();
|
237
|
+
return localStorage.setItem(key, encrypted);
|
238
|
+
}
|
239
|
+
}
|
240
|
+
getWithEncription(key) {
|
241
|
+
if (isBrowser()) {
|
242
|
+
const encrypted = localStorage.getItem(key) || '';
|
243
|
+
const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);
|
244
|
+
return encrypted ? JSON.parse(decrypted) : {};
|
245
|
+
}
|
246
|
+
else {
|
247
|
+
return null;
|
248
|
+
}
|
249
|
+
}
|
250
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXLocalStorageService, deps: [{ token: AX_LOCALSTORAGE_SECRET_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
251
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXLocalStorageService }); }
|
252
|
+
}
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXLocalStorageService, decorators: [{
|
254
|
+
type: Injectable
|
255
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
256
|
+
type: Inject,
|
257
|
+
args: [AX_LOCALSTORAGE_SECRET_KEY]
|
258
|
+
}] }] });
|
259
|
+
|
260
|
+
class AXSessionStorageService {
|
261
|
+
get(key) {
|
262
|
+
return JSON.parse(sessionStorage.getItem(key) || '');
|
263
|
+
}
|
264
|
+
set(key, value) {
|
265
|
+
return sessionStorage.setItem(key, JSON.stringify(value));
|
266
|
+
}
|
267
|
+
clear() {
|
268
|
+
return sessionStorage.clear();
|
269
|
+
}
|
270
|
+
removeItem(key) {
|
271
|
+
return sessionStorage.removeItem(key);
|
272
|
+
}
|
273
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXSessionStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
274
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXSessionStorageService }); }
|
275
|
+
}
|
276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXSessionStorageService, decorators: [{
|
277
|
+
type: Injectable
|
278
|
+
}] });
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Generated bundle index. Do not edit.
|
282
|
+
*/
|
283
|
+
|
284
|
+
export { AXCookieStorageService, AXLocalStorageService, AXSessionStorageService, AX_LOCALSTORAGE_SECRET_KEY };
|
285
|
+
//# sourceMappingURL=acorex-core-storage.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-core-storage.mjs","sources":["../../../../libs/core/storage/src/cookie-storage.service.ts","../../../../libs/core/storage/src/local-storage.service.ts","../../../../libs/core/storage/src/session-storage.service.ts","../../../../libs/core/storage/src/acorex-core-storage.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { AXCookieOptions, AXSameSite } from './storage.interface';\n\n@Injectable()\nexport class AXCookieStorageService {\n private readonly documentIsAccessible: boolean;\n\n constructor(\n @Inject(DOCUMENT) private document: Document,\n // Get the `PLATFORM_ID` so we can check if we're in a browser.\n @Inject(PLATFORM_ID) private platformId\n ) {\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n\n /**\n * Get cookie Regular Expression\n *\n * @param name Cookie name\n * @returns property RegExp\n *\n */\n private static getCookieRegExp(name: string): RegExp {\n const escapedName: string = name.replace(/([[\\]{}()|=;+?,.*^$])/gi, '\\\\$1');\n\n return new RegExp(\n '(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)',\n 'g'\n );\n }\n\n /**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @param encodedURIComponent A value representing an encoded URI component.\n *\n * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n */\n private static safeDecodeURIComponent(encodedURIComponent: string): string {\n try {\n return decodeURIComponent(encodedURIComponent);\n } catch {\n // probably it is not uri encoded. return as is\n return encodedURIComponent;\n }\n }\n\n /**\n * Return `true` if {@link Document} is accessible, otherwise return `false`\n *\n * @param name Cookie name\n * @returns boolean - whether cookie with specified name exists\n *\n */\n check(name: string): boolean {\n if (!this.documentIsAccessible) {\n return false;\n }\n name = encodeURIComponent(name);\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n return regExp.test(this.document.cookie);\n }\n\n /**\n * Get cookies by name\n *\n * @param name Cookie name\n * @returns property value\n *\n */\n get(name: string): string {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n const result: RegExpExecArray = regExp.exec(this.document.cookie);\n\n return result[1]\n ? AXCookieStorageService.safeDecodeURIComponent(result[1])\n : '';\n } else {\n return '';\n }\n }\n\n /**\n * Get all cookies in JSON format\n *\n * @returns all the cookies in json\n *\n */\n getAll(): { [key: string]: string } {\n if (!this.documentIsAccessible) {\n return {};\n }\n\n const cookies: { [key: string]: string } = {};\n const document: any = this.document;\n\n if (document.cookie && document.cookie !== '') {\n document.cookie.split(';').forEach((currentCookie) => {\n const [cookieName, cookieValue] = currentCookie.split('=');\n cookies[\n AXCookieStorageService.safeDecodeURIComponent(\n cookieName.replace(/^ /, '')\n )\n ] = AXCookieStorageService.safeDecodeURIComponent(cookieValue);\n });\n }\n\n return cookies;\n }\n\n /**\n * Set cookie based on provided information\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param expires Number of days until the cookies expires or an actual `Date`\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Secure flag\n * @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n *\n */\n set(\n name: string,\n value: string,\n expires?: AXCookieOptions['expires'],\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite\n ): void;\n\n /**\n * Set cookie based on provided information\n *\n * Cookie's parameters:\n * <pre>\n * expires Number of days until the cookies expires or an actual `Date`\n * path Cookie path\n * domain Cookie domain\n * secure Secure flag\n * sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n * </pre>\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param options Body with cookie's params\n *\n */\n set(name: string, value: string, options?: AXCookieOptions): void;\n\n set(\n name: string,\n value: string,\n expiresOrOptions?: AXCookieOptions['expires'] | AXCookieOptions,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n if (\n typeof expiresOrOptions === 'number' ||\n expiresOrOptions instanceof Date ||\n path ||\n domain ||\n secure ||\n sameSite\n ) {\n const optionsBody = {\n expires: expiresOrOptions as AXCookieOptions['expires'],\n path,\n domain,\n secure,\n sameSite: sameSite ? sameSite : 'Lax',\n };\n\n this.set(name, value, optionsBody);\n return;\n }\n\n let cookieString: string =\n encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';\n\n const options = expiresOrOptions ? expiresOrOptions : {};\n\n if (options.expires) {\n if (typeof options.expires === 'number') {\n const dateExpires: Date = new Date(\n new Date().getTime() + options.expires * 1000 * 60 * 60 * 24\n );\n\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n } else {\n cookieString += 'expires=' + options.expires.toUTCString() + ';';\n }\n }\n\n if (options.path) {\n cookieString += 'path=' + options.path + ';';\n }\n\n if (options.domain) {\n cookieString += 'domain=' + options.domain + ';';\n }\n\n if (options.secure === false && options.sameSite === 'None') {\n options.secure = true;\n console.warn(\n `[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +\n `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`\n );\n }\n if (options.secure) {\n cookieString += 'secure;';\n }\n\n if (!options.sameSite) {\n options.sameSite = 'Lax';\n }\n\n cookieString += 'sameSite=' + options.sameSite + ';';\n\n this.document.cookie = cookieString;\n }\n\n /**\n * Delete cookie by name\n *\n * @param name Cookie name\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Cookie secure flag\n * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite\n *\n */\n delete(\n name: string,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax'\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');\n this.set(name, '', {\n expires: expiresDate,\n path,\n domain,\n secure,\n sameSite,\n });\n }\n\n /**\n * Delete all cookies\n *\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Is the Cookie secure\n * @param sameSite Is the cookie same site\n *\n */\n deleteAll(\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax'\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n const cookies = this.getAll();\n\n for (const cookieName in cookies) {\n // eslint-disable-next-line no-prototype-builtins\n if (cookies.hasOwnProperty(cookieName)) {\n this.delete(cookieName, path, domain, secure, sameSite);\n }\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Inject, Injectable, InjectionToken } from '@angular/core';\nimport * as CryptoJS from 'crypto-js';\nimport { AXStorage } from './storage.interface';\n\nexport const AX_LOCALSTORAGE_SECRET_KEY: InjectionToken<string> = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');\n\n@Injectable()\nexport class AXLocalStorageService implements AXStorage {\n constructor(@Inject(AX_LOCALSTORAGE_SECRET_KEY) private secret_key: string) {}\n\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n return JSON.parse(localStorage.getItem(key) || '');\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return localStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return localStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return localStorage.removeItem(key);\n }\n }\n\n setWithEncryption<T = unknown>(key: string, value: T) {\n if (isBrowser()) {\n const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();\n return localStorage.setItem(key, encrypted);\n }\n }\n\n getWithEncription<T = unknown>(key: string): T {\n if (isBrowser()) {\n const encrypted = localStorage.getItem(key) || '';\n const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);\n return encrypted ? JSON.parse(decrypted) : {};\n } else {\n return null;\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { AXStorage } from './storage.interface';\n\n@Injectable()\nexport class AXSessionStorageService implements AXStorage {\n get<T = unknown>(key: string): T {\n return JSON.parse(sessionStorage.getItem(key) || '');\n }\n\n set<T = unknown>(key: string, value: T): void {\n return sessionStorage.setItem(key, JSON.stringify(value));\n }\n\n clear(): void {\n return sessionStorage.clear();\n }\n\n removeItem(key: string) {\n return sessionStorage.removeItem(key);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"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