@acorex/core 18.14.1-next.4 → 18.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/file/lib/file.service.mjs +8 -6
- package/esm2022/image/lib/image.service.mjs +7 -3
- package/esm2022/platform/lib/platform.service.mjs +33 -29
- package/esm2022/translation/lib/translation.service.mjs +65 -8
- package/esm2022/utils/lib/drawing-util.mjs +6 -3
- package/esm2022/utils/lib/resize.directive.mjs +7 -5
- package/fesm2022/acorex-core-file.mjs +7 -5
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs +6 -2
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +31 -27
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +64 -7
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +11 -7
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/file/lib/file.service.d.ts +1 -0
- package/image/lib/image.service.d.ts +1 -0
- package/package.json +1 -1
- package/platform/lib/platform.service.d.ts +3 -1
- package/utils/lib/resize.directive.d.ts +1 -0
@@ -1,5 +1,6 @@
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
1
2
|
import * as i0 from '@angular/core';
|
2
|
-
import { signal, Injectable } from '@angular/core';
|
3
|
+
import { signal, inject, Injectable } from '@angular/core';
|
3
4
|
import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
|
4
5
|
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
5
6
|
|
@@ -60,11 +61,11 @@ const isServer = new Function('try {return this===global;}catch(e){return false;
|
|
60
61
|
const matchMedia = (win, query) => {
|
61
62
|
return win.matchMedia(query).matches;
|
62
63
|
};
|
63
|
-
const isSMScreen = (win) => matchMedia(win, '(max-width:
|
64
|
+
const isSMScreen = (win) => matchMedia(win, '(max-width: 640px)');
|
64
65
|
const isMDScreen = (win) => matchMedia(win, '(max-width: 768px)');
|
65
|
-
const isLGScreen = (win) => matchMedia(win, '(max-width:
|
66
|
-
const isXLScreen = (win) => matchMedia(win, '(max-width:
|
67
|
-
const is2XLScreen = (win) => matchMedia(win, '(max-width:
|
66
|
+
const isLGScreen = (win) => matchMedia(win, '(max-width: 1024px)');
|
67
|
+
const isXLScreen = (win) => matchMedia(win, '(max-width: 1280px)');
|
68
|
+
const is2XLScreen = (win) => matchMedia(win, '(max-width: 1536px)');
|
68
69
|
const is3XLScreen = (win) => matchMedia(win, '(max-width: 1920px)');
|
69
70
|
const is4XLScreen = (win) => matchMedia(win, '(max-width: 2560px)');
|
70
71
|
const PLATFORMS_MAP = {
|
@@ -93,10 +94,12 @@ class AXPlatformEvent {
|
|
93
94
|
}
|
94
95
|
class AXPlatform {
|
95
96
|
isDark() {
|
96
|
-
return document.documentElement.classList.contains('ax-dark');
|
97
|
+
return this.document.documentElement.classList.contains('ax-dark');
|
97
98
|
}
|
98
99
|
isRtl() {
|
99
|
-
return
|
100
|
+
return (this.document.dir == 'rtl' ||
|
101
|
+
this.document.body.dir == 'rtl' ||
|
102
|
+
this.document.body.style.direction == 'rtl');
|
100
103
|
}
|
101
104
|
isLandscape() {
|
102
105
|
return window.innerHeight < window.innerWidth;
|
@@ -116,35 +119,35 @@ class AXPlatform {
|
|
116
119
|
return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find((name) => PLATFORMS_MAP[name](window) == true) || '5XL');
|
117
120
|
}
|
118
121
|
switchLightMode() {
|
119
|
-
const _html = document.getElementsByTagName('html')[0];
|
122
|
+
const _html = this.document.getElementsByTagName('html')[0];
|
120
123
|
_html.classList.remove('ax-dark');
|
121
|
-
|
122
|
-
this.themeMode$.next('light');
|
123
|
-
this.themeMode.set('light');
|
124
|
+
this.#setSystemTheme('light');
|
124
125
|
return 'light';
|
125
126
|
}
|
126
127
|
switchDarkMode() {
|
127
|
-
const _html = document.getElementsByTagName('html')[0];
|
128
|
+
const _html = this.document.getElementsByTagName('html')[0];
|
128
129
|
_html.classList.add('ax-dark');
|
129
|
-
|
130
|
-
this.themeMode$.next('dark');
|
131
|
-
this.themeMode.set('dark');
|
130
|
+
this.#setSystemTheme('dark');
|
132
131
|
return 'dark';
|
133
132
|
}
|
134
133
|
switchSystemMode() {
|
135
134
|
if (isBrowser()) {
|
136
135
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
137
|
-
const _html = document.getElementsByTagName('html')[0];
|
136
|
+
const _html = this.document.getElementsByTagName('html')[0];
|
138
137
|
_html.classList.add('ax-dark');
|
138
|
+
this.#setSystemTheme('system-dark');
|
139
139
|
}
|
140
140
|
else {
|
141
|
-
const _html = document.getElementsByTagName('html')[0];
|
141
|
+
const _html = this.document.getElementsByTagName('html')[0];
|
142
142
|
_html.classList.remove('ax-dark');
|
143
|
+
this.#setSystemTheme('system-light');
|
143
144
|
}
|
144
145
|
}
|
145
|
-
|
146
|
-
|
147
|
-
this.themeMode
|
146
|
+
}
|
147
|
+
#setSystemTheme(themeMode) {
|
148
|
+
this.themeMode$.next(themeMode);
|
149
|
+
localStorage.setItem('AX_THEME_MODE', themeMode);
|
150
|
+
this.themeMode.set(themeMode);
|
148
151
|
}
|
149
152
|
autoDetectThemeMode() {
|
150
153
|
const mode = localStorage.getItem('AX_THEME_MODE') || 'system';
|
@@ -160,7 +163,7 @@ class AXPlatform {
|
|
160
163
|
setFullHeightRatio() {
|
161
164
|
if (isBrowser()) {
|
162
165
|
try {
|
163
|
-
document
|
166
|
+
this.document
|
164
167
|
.querySelector(':root')
|
165
168
|
?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
166
169
|
}
|
@@ -173,11 +176,11 @@ class AXPlatform {
|
|
173
176
|
if (this.themeMode() === 'system') {
|
174
177
|
const themeMode = event.matches ? 'dark' : 'light';
|
175
178
|
if (themeMode === 'dark') {
|
176
|
-
const _html = document.getElementsByTagName('html')[0];
|
179
|
+
const _html = this.document.getElementsByTagName('html')[0];
|
177
180
|
_html.classList.add('ax-dark');
|
178
181
|
}
|
179
182
|
else {
|
180
|
-
const _html = document.getElementsByTagName('html')[0];
|
183
|
+
const _html = this.document.getElementsByTagName('html')[0];
|
181
184
|
_html.classList.remove('ax-dark');
|
182
185
|
}
|
183
186
|
}
|
@@ -189,6 +192,7 @@ class AXPlatform {
|
|
189
192
|
this.scroll = new Subject();
|
190
193
|
this.themeMode$ = new BehaviorSubject('system');
|
191
194
|
this.themeMode = signal('system');
|
195
|
+
this.document = inject(DOCUMENT);
|
192
196
|
if (isBrowser()) {
|
193
197
|
this.detectDarkMode();
|
194
198
|
this.detectOnResize();
|
@@ -221,7 +225,7 @@ class AXPlatform {
|
|
221
225
|
});
|
222
226
|
}
|
223
227
|
detectClickEvent() {
|
224
|
-
document.addEventListener('click', (e) => {
|
228
|
+
this.document.addEventListener('click', (e) => {
|
225
229
|
this.click.next({
|
226
230
|
nativeEvent: e,
|
227
231
|
source: this,
|
@@ -229,7 +233,7 @@ class AXPlatform {
|
|
229
233
|
}, true);
|
230
234
|
}
|
231
235
|
detectScrollEvent() {
|
232
|
-
document.addEventListener('scroll', (e) => {
|
236
|
+
this.document.addEventListener('scroll', (e) => {
|
233
237
|
this.scroll.next({
|
234
238
|
nativeEvent: e,
|
235
239
|
source: this,
|
@@ -241,12 +245,12 @@ class AXPlatform {
|
|
241
245
|
mutations.forEach((mutation) => {
|
242
246
|
// Detect Direction Change
|
243
247
|
if (mutation.attributeName === 'dir') {
|
244
|
-
const dir = document.documentElement.getAttribute('dir');
|
248
|
+
const dir = this.document.documentElement.getAttribute('dir');
|
245
249
|
this.directionChange.next({ source: this, nativeEvent: null, data: dir });
|
246
250
|
}
|
247
251
|
});
|
248
252
|
});
|
249
|
-
observer.observe(document.documentElement, {
|
253
|
+
observer.observe(this.document.documentElement, {
|
250
254
|
attributes: true,
|
251
255
|
childList: false,
|
252
256
|
characterData: false,
|
@@ -1 +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, signal } 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 (\n isIpad(win) ||\n isAndroidTablet(win) ||\n (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)\n );\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 =>\n !!(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 return win.matchMedia(query).matches;\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 data?: any;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n directionChange: 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\n themeMode = signal<AXThemeMode>('system');\n\n isDark(): boolean {\n return document.documentElement.classList.contains('ax-dark');\n }\n\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(\n (name) => PLATFORMS_MAP[name](window) == true,\n ) || '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 this.themeMode.set('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 this.themeMode.set('dark');\n return '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 }\n localStorage.setItem('AX_THEME_MODE', 'system');\n this.themeMode$.next('system');\n this.themeMode.set('system');\n }\n\n autoDetectThemeMode() {\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 private setFullHeightRatio() {\n if (isBrowser()) {\n try {\n document\n .querySelector<HTMLElement>(':root')\n ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === '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 this.detectDarkMode();\n this.detectOnResize();\n this.detectClickEvent();\n this.detectScrollEvent();\n this.setFullHeightRatio();\n this.detectDocumentDirectionChange();\n }\n }\n\n private detectDarkMode() {\n // fromEvent(UIEvent)(window,'')\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 }\n\n private detectOnResize() {\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 }\n\n private detectClickEvent() {\n document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectScrollEvent() {\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 private detectDocumentDirectionChange() {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n // Detect Direction Change\n if (mutation.attributeName === 'dir') {\n const dir = document.documentElement.getAttribute('dir');\n this.directionChange.next({ source: this, nativeEvent: null, data: dir });\n }\n });\n });\n observer.observe(document.documentElement, {\n attributes: true,\n childList: false,\n characterData: false,\n });\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;AAExE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC;AAE1E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;AAEpE,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC;AAExE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC;AAEpG,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC;AAEtG,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,QAAQ,CAAC,GAAG,CAAC,IAAI,CAA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AA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC1ID;;AAEG;;;;"}
|
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 { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, signal } from '@angular/core';\nimport { BehaviorSubject, fromEvent, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system' | 'system-dark' | 'system-light';\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 (\n isIpad(win) ||\n isAndroidTablet(win) ||\n (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)\n );\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 =>\n !!(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 return win.matchMedia(query).matches;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 640px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 1024px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1280px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1536px)');\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 data?: any;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n directionChange: 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 themeMode = signal<AXThemeMode>('system');\n private document = inject(DOCUMENT);\n\n isDark(): boolean {\n return this.document.documentElement.classList.contains('ax-dark');\n }\n\n isRtl(): boolean {\n return (\n this.document.dir == 'rtl' ||\n this.document.body.dir == 'rtl' ||\n this.document.body.style.direction == 'rtl'\n );\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(\n (name) => PLATFORMS_MAP[name](window) == true,\n ) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n this.#setSystemTheme('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n this.#setSystemTheme('dark');\n return 'dark';\n }\n\n switchSystemMode() {\n if (isBrowser()) {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n this.#setSystemTheme('system-dark');\n } else {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n this.#setSystemTheme('system-light');\n }\n }\n }\n\n #setSystemTheme(themeMode: AXThemeMode) {\n this.themeMode$.next(themeMode);\n localStorage.setItem('AX_THEME_MODE', themeMode);\n this.themeMode.set(themeMode);\n }\n\n autoDetectThemeMode() {\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 private setFullHeightRatio() {\n if (isBrowser()) {\n try {\n this.document\n .querySelector<HTMLElement>(':root')\n ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n this.detectDarkMode();\n this.detectOnResize();\n this.detectClickEvent();\n this.detectScrollEvent();\n this.setFullHeightRatio();\n this.detectDocumentDirectionChange();\n }\n }\n\n private detectDarkMode() {\n // fromEvent(UIEvent)(window,'')\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 }\n\n private detectOnResize() {\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 }\n\n private detectClickEvent() {\n this.document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectScrollEvent() {\n this.document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectDocumentDirectionChange() {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n // Detect Direction Change\n if (mutation.attributeName === 'dir') {\n const dir = this.document.documentElement.getAttribute('dir');\n this.directionChange.next({ source: this, nativeEvent: null, data: dir });\n }\n });\n });\n observer.observe(this.document.documentElement, {\n attributes: true,\n childList: false,\n characterData: false,\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAYA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC;AAExE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC;AAE1E,MAAM,MAAM,GAAG,C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QAAQ,CAAC,aAAa,KAAK,KAAK,EAAE;AACpC,oBAAA,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC;AAC7D,oBAAA,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;;AAE7E,aAAC,CAAC;AACJ,SAAC,CAAC;QACF,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE;AAC9C,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,SAAS,EAAE,KAAK;AAChB,YAAA,aAAa,EAAE,KAAK;AACrB,SAAA,CAAC;;8GAhMO,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;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;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC3ID;;AAEG;;;;"}
|
@@ -220,28 +220,85 @@ class AXTranslationService {
|
|
220
220
|
// Perform parameter replacement
|
221
221
|
return this.getTranslation((translation || key), lang, scope, options?.params);
|
222
222
|
}
|
223
|
+
// private findAXTranslateOptionsFromKey(
|
224
|
+
// inputString: string,
|
225
|
+
// ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {
|
226
|
+
// const regex = /<axt(?:\s+lang="([^"]*)")?(?:\s+scope="([^"]*)")?>(.*?)<\/axt>/g;
|
227
|
+
// const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];
|
228
|
+
// let match;
|
229
|
+
// // Loop through all matches in the input string
|
230
|
+
// while ((match = regex.exec(inputString)) !== null) {
|
231
|
+
// result.push({
|
232
|
+
// lang: match[1] || undefined,
|
233
|
+
// scope: match[2] || undefined,
|
234
|
+
// key: match[3] || undefined,
|
235
|
+
// });
|
236
|
+
// }
|
237
|
+
// return result;
|
238
|
+
// }
|
223
239
|
findAXTranslateOptionsFromKey(inputString) {
|
224
|
-
const regex =
|
240
|
+
const regex = /t\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{\s*([^}]*)\s*\})?\s*\)/g;
|
225
241
|
const result = [];
|
226
242
|
let match;
|
227
243
|
// Loop through all matches in the input string
|
228
244
|
while ((match = regex.exec(inputString)) !== null) {
|
245
|
+
const key = match[1]; // Extract the key
|
246
|
+
const options = match[2]; // Extract the options object, if present
|
247
|
+
// Parse options into a key-value object
|
248
|
+
const parsedOptions = {};
|
249
|
+
if (options) {
|
250
|
+
options.split(',').forEach((option) => {
|
251
|
+
const [key, value] = option.split(':').map((s) => s.trim().replace(/^['"]|['"]$/g, ''));
|
252
|
+
parsedOptions[key] = value || undefined;
|
253
|
+
});
|
254
|
+
}
|
229
255
|
result.push({
|
230
|
-
|
231
|
-
|
232
|
-
|
256
|
+
key,
|
257
|
+
lang: parsedOptions['lang'],
|
258
|
+
scope: parsedOptions['scope'],
|
233
259
|
});
|
234
260
|
}
|
235
261
|
return result;
|
236
262
|
}
|
263
|
+
// private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {
|
264
|
+
// const regex = /(<axt(?:\s+lang="[^"]*")?(?:\s+scope="[^"]*")?>.*?<\/axt>)/g;
|
265
|
+
// const splitParts = key.split(regex); // Split into <axt> parts and text parts
|
266
|
+
// const translationObservables: Observable<string>[] = [];
|
267
|
+
// for (const part of splitParts) {
|
268
|
+
// const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
|
269
|
+
// if (optionsFromKey.length > 0) {
|
270
|
+
// // This is an <axt> part, translate it
|
271
|
+
// for (const parsed of optionsFromKey) {
|
272
|
+
// const parsedLang = parsed.lang || options?.lang || this.getActiveLang();
|
273
|
+
// const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;
|
274
|
+
// const parsedKey = parsed.key;
|
275
|
+
// // Push the translation observable to the array
|
276
|
+
// translationObservables.push(
|
277
|
+
// this.load(parsedKey, {
|
278
|
+
// lang: parsedLang,
|
279
|
+
// scope: parsedScope,
|
280
|
+
// params: options?.params,
|
281
|
+
// }),
|
282
|
+
// );
|
283
|
+
// }
|
284
|
+
// } else {
|
285
|
+
// // This is plain text, so wrap it in an observable
|
286
|
+
// translationObservables.push(of(part));
|
287
|
+
// }
|
288
|
+
// }
|
289
|
+
// // Use forkJoin to wait for all observables to complete
|
290
|
+
// return forkJoin(translationObservables).pipe(
|
291
|
+
// map((translatedParts) => translatedParts.join('')), // Join all translated parts
|
292
|
+
// );
|
293
|
+
// }
|
237
294
|
translateAsyncAXTranslate(key, options) {
|
238
|
-
const regex = /(
|
239
|
-
const splitParts = key.split(regex); // Split into
|
295
|
+
const regex = /(t\(['"][^'"]+['"](?:,\s*\{[^}]*\})?\))/g; // Match t('key', { ... }) calls
|
296
|
+
const splitParts = key.split(regex); // Split into t() parts and text parts
|
240
297
|
const translationObservables = [];
|
241
298
|
for (const part of splitParts) {
|
242
299
|
const optionsFromKey = this.findAXTranslateOptionsFromKey(part);
|
243
300
|
if (optionsFromKey.length > 0) {
|
244
|
-
// This is
|
301
|
+
// This is a t() part, translate it
|
245
302
|
for (const parsed of optionsFromKey) {
|
246
303
|
const parsedLang = parsed.lang || options?.lang || this.getActiveLang();
|
247
304
|
const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport {\n AXTranslateHashMap,\n AXTranslateLang,\n AXTranslateOptions,\n AXTranslateParams,\n} from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n public getLangAvailable(): AXTranslateLang[] | undefined {\n return this.config.availableLangs;\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(\n key,\n this.lastActiveLang,\n scope,\n options.params,\n );\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n const result = this.findAXTranslateOptionsFromKey(key);\n if (result.length) {\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.translateAsyncAXTranslate(key, options);\n }),\n );\n } else {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n private findAXTranslateOptionsFromKey(\n inputString: string,\n ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n const regex = /<axt(?:\\s+lang=\"([^\"]*)\")?(?:\\s+scope=\"([^\"]*)\")?>(.*?)<\\/axt>/g;\n const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n let match;\n\n // Loop through all matches in the input string\n while ((match = regex.exec(inputString)) !== null) {\n result.push({\n lang: match[1] || undefined,\n scope: match[2] || undefined,\n key: match[3] || undefined,\n });\n }\n return result;\n }\n\n private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {\n const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n const splitParts = key.split(regex); // Split into <axt> parts and text parts\n\n const translationObservables: Observable<string>[] = [];\n\n for (const part of splitParts) {\n const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n\n if (optionsFromKey.length > 0) {\n // This is an <axt> part, translate it\n for (const parsed of optionsFromKey) {\n const parsedLang = parsed.lang || options?.lang || this.getActiveLang();\n const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;\n const parsedKey = parsed.key;\n\n // Push the translation observable to the array\n translationObservables.push(\n this.load(parsedKey, {\n lang: parsedLang,\n scope: parsedScope,\n params: options?.params,\n }),\n );\n }\n } else {\n // This is plain text, so wrap it in an observable\n translationObservables.push(of(part));\n }\n }\n\n // Use forkJoin to wait for all observables to complete\n return forkJoin(translationObservables).pipe(\n map((translatedParts) => translatedParts.join('')), // Join all translated parts\n );\n }\n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;KAClC;AACF,CAAA;AAEY,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,gBAAgB,EAAE,OAAO;;AAKX,SAAA,iBAAiB,CAAC,MAAA,GAAqC,EAAE,EAAA;AACvE,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,GAAG,0BAA0B;AAC7B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EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,iBAVf,gBAAgB,EAAE,qBAAqB,CAD5C,EAAA,OAAA,EAAA,CAAA,gBAAgB,EAAE,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAWtC,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EATnB,SAAA,EAAA;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,UAAU,EAAE,aAAa;AACzB,gBAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA;AACF,SAAA,EAAA,CAAA,CAAA;;2FAEU,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAb/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AAClD,oBAAA,YAAY,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AACvD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,UAAU,EAAE,aAAa;AACzB,4BAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport {\n AXTranslateHashMap,\n AXTranslateLang,\n AXTranslateOptions,\n AXTranslateParams,\n} from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n public getLangAvailable(): AXTranslateLang[] | undefined {\n return this.config.availableLangs;\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(\n key,\n this.lastActiveLang,\n scope,\n options.params,\n );\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n const result = this.findAXTranslateOptionsFromKey(key);\n if (result.length) {\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.translateAsyncAXTranslate(key, options);\n }),\n );\n } else {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n // private findAXTranslateOptionsFromKey(\n // inputString: string,\n // ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n // const regex = /<axt(?:\\s+lang=\"([^\"]*)\")?(?:\\s+scope=\"([^\"]*)\")?>(.*?)<\\/axt>/g;\n // const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n // let match;\n\n // // Loop through all matches in the input string\n // while ((match = regex.exec(inputString)) !== null) {\n // result.push({\n // lang: match[1] || undefined,\n // scope: match[2] || undefined,\n // key: match[3] || undefined,\n // });\n // }\n // return result;\n // }\n private findAXTranslateOptionsFromKey(\n inputString: string,\n ): (Omit<AXTranslateOptions, 'params'> & { key: string })[] {\n const regex = /t\\(\\s*['\"]([^'\"]+)['\"]\\s*(?:,\\s*\\{\\s*([^}]*)\\s*\\})?\\s*\\)/g;\n const result: (Omit<AXTranslateOptions, 'params'> & { key: string })[] = [];\n let match;\n\n // Loop through all matches in the input string\n while ((match = regex.exec(inputString)) !== null) {\n const key = match[1]; // Extract the key\n const options = match[2]; // Extract the options object, if present\n\n // Parse options into a key-value object\n const parsedOptions: Record<string, string | undefined> = {};\n if (options) {\n options.split(',').forEach((option) => {\n const [key, value] = option.split(':').map((s) => s.trim().replace(/^['\"]|['\"]$/g, ''));\n parsedOptions[key] = value || undefined;\n });\n }\n\n result.push({\n key,\n lang: parsedOptions['lang'],\n scope: parsedOptions['scope'],\n });\n }\n\n return result;\n }\n\n // private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {\n // const regex = /(<axt(?:\\s+lang=\"[^\"]*\")?(?:\\s+scope=\"[^\"]*\")?>.*?<\\/axt>)/g;\n // const splitParts = key.split(regex); // Split into <axt> parts and text parts\n\n // const translationObservables: Observable<string>[] = [];\n\n // for (const part of splitParts) {\n // const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n\n // if (optionsFromKey.length > 0) {\n // // This is an <axt> part, translate it\n // for (const parsed of optionsFromKey) {\n // const parsedLang = parsed.lang || options?.lang || this.getActiveLang();\n // const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;\n // const parsedKey = parsed.key;\n\n // // Push the translation observable to the array\n // translationObservables.push(\n // this.load(parsedKey, {\n // lang: parsedLang,\n // scope: parsedScope,\n // params: options?.params,\n // }),\n // );\n // }\n // } else {\n // // This is plain text, so wrap it in an observable\n // translationObservables.push(of(part));\n // }\n // }\n\n // // Use forkJoin to wait for all observables to complete\n // return forkJoin(translationObservables).pipe(\n // map((translatedParts) => translatedParts.join('')), // Join all translated parts\n // );\n // }\n private translateAsyncAXTranslate(key: string, options?: AXTranslateOptions): Observable<string> {\n const regex = /(t\\(['\"][^'\"]+['\"](?:,\\s*\\{[^}]*\\})?\\))/g; // Match t('key', { ... }) calls\n const splitParts = key.split(regex); // Split into t() parts and text parts\n\n const translationObservables: Observable<string>[] = [];\n\n for (const part of splitParts) {\n const optionsFromKey = this.findAXTranslateOptionsFromKey(part);\n\n if (optionsFromKey.length > 0) {\n // This is a t() part, translate it\n for (const parsed of optionsFromKey) {\n const parsedLang = parsed.lang || options?.lang || this.getActiveLang();\n const parsedScope = parsed.scope || options?.scope || this.config.defaultScope;\n const parsedKey = parsed.key;\n\n // Push the translation observable to the array\n translationObservables.push(\n this.load(parsedKey, {\n lang: parsedLang,\n scope: parsedScope,\n params: options?.params,\n }),\n );\n }\n } else {\n // This is plain text, so wrap it in an observable\n translationObservables.push(of(part));\n }\n }\n\n // Use forkJoin to wait for all observables to complete\n return forkJoin(translationObservables).pipe(\n map((translatedParts) => translatedParts.join('')), // Join all translated parts\n );\n }\n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;KAClC;AACF,CAAA;AAEY,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,gBAAgB,EAAE,OAAO;;AAKX,SAAA,iBAAiB,CAAC,MAAA,GAAqC,EAAE,EAAA;AACvE,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,GAAG,0BAA0B;AAC7B,QAAA,GAAG,MAAM;KACV;AACD,IAAA,OAAO,MAAM;AACf;;MCpBa,0BAA0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AC,gBAAgB,EAAE,qBAAqB,CAAC;AACvD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,UAAU,EAAE,aAAa;AACzB,4BAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, Directive, Input, HostListener, NgModule } from '@angular/core';
|
2
|
+
import { Injectable, inject, Directive, Input, HostListener, NgModule } from '@angular/core';
|
3
3
|
import { Subject, takeUntil } from 'rxjs';
|
4
4
|
import tinycolor from 'tinycolor2';
|
5
5
|
import tinygradient from 'tinygradient-es';
|
6
6
|
import { isBrowser } from '@acorex/core/platform';
|
7
|
-
import { CommonModule } from '@angular/common';
|
7
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
8
8
|
|
9
9
|
function AXAutoUnsubscriber() {
|
10
10
|
return function (constructor) {
|
@@ -178,7 +178,10 @@ class AXDrawingUtil {
|
|
178
178
|
static collision(a, b) {
|
179
179
|
const ac = a.getBoundingClientRect();
|
180
180
|
const bc = b.getBoundingClientRect();
|
181
|
-
if (ac.left < bc.left + bc.width &&
|
181
|
+
if (ac.left < bc.left + bc.width &&
|
182
|
+
ac.left + ac.width > bc.left &&
|
183
|
+
ac.top < bc.top + bc.height &&
|
184
|
+
ac.top + ac.height > bc.top) {
|
182
185
|
return true;
|
183
186
|
}
|
184
187
|
else {
|
@@ -195,7 +198,7 @@ class AXDrawingUtil {
|
|
195
198
|
});
|
196
199
|
}
|
197
200
|
static isInRecPoint(pos, rec) {
|
198
|
-
return pos.x >= rec.left && pos.x <= rec.left + rec.width && pos.y >= rec.top && pos.y <= rec.top + rec.height;
|
201
|
+
return (pos.x >= rec.left && pos.x <= rec.left + rec.width && pos.y >= rec.top && pos.y <= rec.top + rec.height);
|
199
202
|
}
|
200
203
|
static convertRemToPixels(rem) {
|
201
204
|
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
@@ -260,6 +263,7 @@ class AXResizableDirective {
|
|
260
263
|
this.el = el;
|
261
264
|
this.renderer = renderer;
|
262
265
|
this.zone = zone;
|
266
|
+
this.document = inject(DOCUMENT);
|
263
267
|
this.minWidth = 100; // Minimum width for the resizable element
|
264
268
|
this.isResizing = false;
|
265
269
|
this.createResizeHandle(); // Initialize the resize handle
|
@@ -291,7 +295,7 @@ class AXResizableDirective {
|
|
291
295
|
if (event.clientX >= handleRect.left && event.clientX <= handleRect.right) {
|
292
296
|
this.zone.runOutsideAngular(() => {
|
293
297
|
this.isResizing = true;
|
294
|
-
document.body.style.cursor = 'ew-resize'; // Change cursor to resize mode
|
298
|
+
this.document.body.style.cursor = 'ew-resize'; // Change cursor to resize mode
|
295
299
|
// Change resize handle color to blue when resizing starts
|
296
300
|
this.renderer.setStyle(this.resizeHandle, 'background-color', '#007bff');
|
297
301
|
event.preventDefault();
|
@@ -305,7 +309,7 @@ class AXResizableDirective {
|
|
305
309
|
const rect = this.el.nativeElement.getBoundingClientRect();
|
306
310
|
let newWidth;
|
307
311
|
// Resize logic (LTR or RTL support)
|
308
|
-
if (document.documentElement.dir === 'rtl') {
|
312
|
+
if (this.document.documentElement.dir === 'rtl') {
|
309
313
|
newWidth = rect.right - event.clientX;
|
310
314
|
}
|
311
315
|
else {
|
@@ -323,7 +327,7 @@ class AXResizableDirective {
|
|
323
327
|
this.zone.runOutsideAngular(() => {
|
324
328
|
if (this.isResizing) {
|
325
329
|
this.isResizing = false;
|
326
|
-
document.body.style.cursor = 'default'; // Reset the cursor
|
330
|
+
this.document.body.style.cursor = 'default'; // Reset the cursor
|
327
331
|
// Reset the resize handle color to default when resizing ends
|
328
332
|
this.renderer.setStyle(this.resizeHandle, 'background-color', 'rgba(0, 0, 0, 0.2)');
|
329
333
|
}
|