@acorex/core 21.0.1-next.57 → 21.0.1-next.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/fesm2022/acorex-core-components.mjs +3 -3
  2. package/fesm2022/acorex-core-components.mjs.map +1 -1
  3. package/fesm2022/acorex-core-config.mjs +3 -3
  4. package/fesm2022/acorex-core-config.mjs.map +1 -1
  5. package/fesm2022/acorex-core-constants.mjs.map +1 -1
  6. package/fesm2022/acorex-core-date-time.mjs +25 -25
  7. package/fesm2022/acorex-core-date-time.mjs.map +1 -1
  8. package/fesm2022/acorex-core-events.mjs +3 -3
  9. package/fesm2022/acorex-core-events.mjs.map +1 -1
  10. package/fesm2022/acorex-core-file.mjs +10 -10
  11. package/fesm2022/acorex-core-file.mjs.map +1 -1
  12. package/fesm2022/acorex-core-format.mjs +19 -19
  13. package/fesm2022/acorex-core-format.mjs.map +1 -1
  14. package/fesm2022/acorex-core-full-screen.mjs +3 -3
  15. package/fesm2022/acorex-core-full-screen.mjs.map +1 -1
  16. package/fesm2022/acorex-core-icon.mjs +3 -3
  17. package/fesm2022/acorex-core-icon.mjs.map +1 -1
  18. package/fesm2022/acorex-core-image.mjs +3 -3
  19. package/fesm2022/acorex-core-image.mjs.map +1 -1
  20. package/fesm2022/acorex-core-locale.mjs +10 -10
  21. package/fesm2022/acorex-core-locale.mjs.map +1 -1
  22. package/fesm2022/acorex-core-memoize.mjs.map +1 -1
  23. package/fesm2022/acorex-core-network.mjs +3 -3
  24. package/fesm2022/acorex-core-network.mjs.map +1 -1
  25. package/fesm2022/acorex-core-pipes.mjs +3 -3
  26. package/fesm2022/acorex-core-pipes.mjs.map +1 -1
  27. package/fesm2022/acorex-core-platform.mjs +118 -12
  28. package/fesm2022/acorex-core-platform.mjs.map +1 -1
  29. package/fesm2022/acorex-core-storage.mjs +9 -9
  30. package/fesm2022/acorex-core-storage.mjs.map +1 -1
  31. package/fesm2022/acorex-core-translation.mjs +142 -77
  32. package/fesm2022/acorex-core-translation.mjs.map +1 -1
  33. package/fesm2022/acorex-core-utils.mjs +3 -3
  34. package/fesm2022/acorex-core-utils.mjs.map +1 -1
  35. package/fesm2022/acorex-core-validation.mjs +40 -40
  36. package/fesm2022/acorex-core-validation.mjs.map +1 -1
  37. package/fesm2022/acorex-core-z-index.mjs +3 -3
  38. package/fesm2022/acorex-core-z-index.mjs.map +1 -1
  39. package/fesm2022/acorex-core.mjs.map +1 -1
  40. package/package.json +23 -23
  41. package/{format/index.d.ts → types/acorex-core-format.d.ts} +2 -2
  42. package/{platform/index.d.ts → types/acorex-core-platform.d.ts} +28 -5
  43. package/{translation/index.d.ts → types/acorex-core-translation.d.ts} +29 -7
  44. package/{validation/index.d.ts → types/acorex-core-validation.d.ts} +10 -10
  45. /package/{components/index.d.ts → types/acorex-core-components.d.ts} +0 -0
  46. /package/{config/index.d.ts → types/acorex-core-config.d.ts} +0 -0
  47. /package/{constants/index.d.ts → types/acorex-core-constants.d.ts} +0 -0
  48. /package/{date-time/index.d.ts → types/acorex-core-date-time.d.ts} +0 -0
  49. /package/{events/index.d.ts → types/acorex-core-events.d.ts} +0 -0
  50. /package/{file/index.d.ts → types/acorex-core-file.d.ts} +0 -0
  51. /package/{full-screen/index.d.ts → types/acorex-core-full-screen.d.ts} +0 -0
  52. /package/{icon/index.d.ts → types/acorex-core-icon.d.ts} +0 -0
  53. /package/{image/index.d.ts → types/acorex-core-image.d.ts} +0 -0
  54. /package/{locale/index.d.ts → types/acorex-core-locale.d.ts} +0 -0
  55. /package/{memoize/index.d.ts → types/acorex-core-memoize.d.ts} +0 -0
  56. /package/{network/index.d.ts → types/acorex-core-network.d.ts} +0 -0
  57. /package/{pipes/index.d.ts → types/acorex-core-pipes.d.ts} +0 -0
  58. /package/{storage/index.d.ts → types/acorex-core-storage.d.ts} +0 -0
  59. /package/{utils/index.d.ts → types/acorex-core-utils.d.ts} +0 -0
  60. /package/{z-index/index.d.ts → types/acorex-core-z-index.d.ts} +0 -0
  61. /package/{index.d.ts → types/acorex-core.d.ts} +0 -0
@@ -21,6 +21,25 @@ interface AXParsedToken {
21
21
  lang?: AXTranslateLang;
22
22
  fullMatch: string;
23
23
  }
24
+ declare const LOCALE_KEY_REGEX: RegExp;
25
+ type AXMultiLanguageMap = Record<string, string>;
26
+ type AXMultiLanguageString = string | AXMultiLanguageMap;
27
+ declare function resolveMultiLanguageValue(value: AXMultiLanguageMap, locale: string): string;
28
+ declare function isValidMultiLanguageObject(value: unknown): value is AXMultiLanguageMap;
29
+ /**
30
+ * Resolves {@link AXMultiLanguageString} to a single string for the given locale.
31
+ * Fallback order: `currentLocale` → `en-US` → first map value.
32
+ */
33
+ declare function resolveMultiLanguageString(content: AXMultiLanguageString | null | undefined, currentLocale: string): string;
34
+ /**
35
+ * Creates an {@link AXMultiLanguageMap} with `en-US` and `fa-IR` entries.
36
+ * Use for seed data, tests, and demos that supply English and Persian copy explicitly.
37
+ */
38
+ declare function createMultiLanguageString(enUs: string, faIr: string): AXMultiLanguageMap;
39
+ /**
40
+ * True when there is no displayable text in any locale (plain string or ML map).
41
+ */
42
+ declare function isEffectivelyEmptyLocalizedValue(value: unknown): boolean;
24
43
 
25
44
  interface AXTranslationConfig {
26
45
  defaults: {
@@ -60,12 +79,9 @@ declare class AXTranslationLoaderDefault implements AXTranslationLoader {
60
79
  }
61
80
  declare const AX_TRANSLATION_LOADER: InjectionToken<AXTranslationLoader>;
62
81
 
63
- type AXMultiLanguageMap = Record<string, string>;
64
82
  declare class AXTranslatorPipe implements PipeTransform {
65
83
  private service;
66
- transform(value: string | AXMultiLanguageMap | null | undefined, options?: AXTranslateOptions): Observable<string>;
67
- private isMultiLanguageMap;
68
- private resolveMultiLanguageValue;
84
+ transform(value: string | Record<string, string> | null | undefined, options?: AXTranslateOptions): Observable<string>;
69
85
  static ɵfac: i0.ɵɵFactoryDeclaration<AXTranslatorPipe, never>;
70
86
  static ɵpipe: i0.ɵɵPipeDeclaration<AXTranslatorPipe, "translate", true>;
71
87
  }
@@ -95,19 +111,25 @@ declare class AXTranslationService {
95
111
  private resolver;
96
112
  private activeLang;
97
113
  readonly langChanges$: Observable<string>;
114
+ readonly currentLocale$: Observable<string>;
98
115
  constructor();
99
116
  setActiveLang(lang: AXTranslateLang): void;
100
117
  getActiveLang(): AXTranslateLang;
101
118
  getDefaultLang(): AXTranslateLang;
102
- translate$(text: string, options?: AXTranslateOptions): Observable<string>;
119
+ resolve(value: string | AXMultiLanguageMap | null | undefined, locale?: string): string;
120
+ toLocaleMap(value: string | AXMultiLanguageMap | null | undefined, activeLocale?: string): AXMultiLanguageMap;
121
+ translate$(value: string | AXMultiLanguageMap | null | undefined, options?: AXTranslateOptions): Observable<string>;
103
122
  translateAsync(text: string, options?: AXTranslateOptions): Promise<string>;
104
123
  translateSync(text: string, options?: AXTranslateOptions & {
105
124
  waitForLoad?: boolean;
106
125
  timeoutMs?: number;
107
126
  }): string;
127
+ private translateValue$;
128
+ private resolveContext;
129
+ isValidMultiLanguageObject(value: unknown): value is AXMultiLanguageMap;
108
130
  static ɵfac: i0.ɵɵFactoryDeclaration<AXTranslationService, never>;
109
131
  static ɵprov: i0.ɵɵInjectableDeclaration<AXTranslationService>;
110
132
  }
111
133
 
112
- export { AXTranslationDefaultConfig, AXTranslationLoaderDefault, AXTranslationModule, AXTranslationService, AXTranslatorDirective, AXTranslatorPipe, AX_TRANSLATION_CONFIG, AX_TRANSLATION_LOADER, loadTranslationScope, translateSync, translationConfig };
113
- export type { AXParsedToken, AXPartialTranslationConfig, AXTranslateHashMap, AXTranslateLang, AXTranslateOptions, AXTranslateParams, AXTranslateScope, AXTranslation, AXTranslationConfig, AXTranslationLoader, AXTranslationLoaderOptions };
134
+ export { AXTranslationDefaultConfig, AXTranslationLoaderDefault, AXTranslationModule, AXTranslationService, AXTranslatorDirective, AXTranslatorPipe, AX_TRANSLATION_CONFIG, AX_TRANSLATION_LOADER, LOCALE_KEY_REGEX, createMultiLanguageString, isEffectivelyEmptyLocalizedValue, isValidMultiLanguageObject, loadTranslationScope, resolveMultiLanguageString, resolveMultiLanguageValue, translateSync, translationConfig };
135
+ export type { AXMultiLanguageMap, AXMultiLanguageString, AXParsedToken, AXPartialTranslationConfig, AXTranslateHashMap, AXTranslateLang, AXTranslateOptions, AXTranslateParams, AXTranslateScope, AXTranslation, AXTranslationConfig, AXTranslationLoader, AXTranslationLoaderOptions };
@@ -34,7 +34,7 @@ type AXCallbackValidation<T> = (value: T, options?: AXCallbackValidationRuleOpti
34
34
  interface AXCallbackValidationRuleOptions<T> extends AXValidationRuleOptions {
35
35
  validate: AXCallbackValidation<T>;
36
36
  }
37
- declare module "./index" {
37
+ declare module "./acorex-core-validation" {
38
38
  interface AXValidationRuleOptionsMap {
39
39
  callback: AXCallbackValidationRuleOptions<unknown>;
40
40
  }
@@ -49,7 +49,7 @@ declare class AXCallbackValidationRule<T> implements AXValidationRule {
49
49
  interface AXRegexValidationRuleOptions extends AXValidationRuleOptions {
50
50
  pattern: string | RegExp;
51
51
  }
52
- declare module "./index" {
52
+ declare module "./acorex-core-validation" {
53
53
  interface AXValidationRuleOptionsMap {
54
54
  regex: AXRegexValidationRuleOptions;
55
55
  }
@@ -64,7 +64,7 @@ declare class AXRegexValidationRule implements AXValidationRule {
64
64
 
65
65
  interface AXRequiredValidationRuleOptions extends AXValidationRuleOptions {
66
66
  }
67
- declare module "./index" {
67
+ declare module "./acorex-core-validation" {
68
68
  interface AXValidationRuleOptionsMap {
69
69
  required: AXRequiredValidationRuleOptions;
70
70
  }
@@ -81,7 +81,7 @@ interface AXLengthValidationRuleOptions extends AXValidationRuleOptions {
81
81
  min: number;
82
82
  max: number;
83
83
  }
84
- declare module "./index" {
84
+ declare module "./acorex-core-validation" {
85
85
  interface AXValidationRuleOptionsMap {
86
86
  length: AXLengthValidationRuleOptions;
87
87
  }
@@ -96,7 +96,7 @@ declare class AXLengthValidationRule implements AXValidationRule {
96
96
  interface AXMaxLengthValidationRuleOptions extends AXValidationRuleOptions {
97
97
  value: number;
98
98
  }
99
- declare module "./index" {
99
+ declare module "./acorex-core-validation" {
100
100
  interface AXValidationRuleOptionsMap {
101
101
  maxLength: AXMaxLengthValidationRuleOptions;
102
102
  }
@@ -111,7 +111,7 @@ declare class AXMaxLengthValidationRule implements AXValidationRule {
111
111
  interface AXMinLengthValidationRuleOptions extends AXValidationRuleOptions {
112
112
  value: number;
113
113
  }
114
- declare module "./index" {
114
+ declare module "./acorex-core-validation" {
115
115
  interface AXValidationRuleOptionsMap {
116
116
  minLength: AXMinLengthValidationRuleOptions;
117
117
  }
@@ -128,7 +128,7 @@ interface AXBetweenValidationRuleOptions<T = number | Date> extends AXValidation
128
128
  upperValue: T;
129
129
  inclusive?: boolean;
130
130
  }
131
- declare module "./index" {
131
+ declare module "./acorex-core-validation" {
132
132
  interface AXValidationRuleOptionsMap {
133
133
  between: AXBetweenValidationRuleOptions;
134
134
  }
@@ -144,7 +144,7 @@ interface AXEqualValidationRuleOptions extends AXValidationRuleOptions {
144
144
  value: any;
145
145
  not?: boolean;
146
146
  }
147
- declare module "./index" {
147
+ declare module "./acorex-core-validation" {
148
148
  interface AXValidationRuleOptionsMap {
149
149
  equal: AXEqualValidationRuleOptions;
150
150
  }
@@ -160,7 +160,7 @@ interface AXGreaterThanValidationRuleOptions extends AXValidationRuleOptions {
160
160
  value: number;
161
161
  inclusive?: boolean;
162
162
  }
163
- declare module "./index" {
163
+ declare module "./acorex-core-validation" {
164
164
  interface AXValidationRuleOptionsMap {
165
165
  greaterThan: AXGreaterThanValidationRuleOptions;
166
166
  }
@@ -176,7 +176,7 @@ interface AXLessThanValidationRuleOptions extends AXValidationRuleOptions {
176
176
  value: number;
177
177
  inclusive?: boolean;
178
178
  }
179
- declare module "./index" {
179
+ declare module "./acorex-core-validation" {
180
180
  interface AXValidationRuleOptionsMap {
181
181
  lessThan: AXLessThanValidationRuleOptions;
182
182
  }
File without changes