@acorex/core 21.0.0-next.3 → 21.0.0-next.31

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 (46) hide show
  1. package/components/index.d.ts +14 -0
  2. package/date-time/index.d.ts +71 -0
  3. package/fesm2022/acorex-core-components.mjs +17 -3
  4. package/fesm2022/acorex-core-components.mjs.map +1 -1
  5. package/fesm2022/acorex-core-config.mjs +3 -3
  6. package/fesm2022/acorex-core-config.mjs.map +1 -1
  7. package/fesm2022/acorex-core-constants.mjs.map +1 -1
  8. package/fesm2022/acorex-core-date-time.mjs +89 -67
  9. package/fesm2022/acorex-core-date-time.mjs.map +1 -1
  10. package/fesm2022/acorex-core-events.mjs +3 -3
  11. package/fesm2022/acorex-core-events.mjs.map +1 -1
  12. package/fesm2022/acorex-core-file.mjs +53 -10
  13. package/fesm2022/acorex-core-file.mjs.map +1 -1
  14. package/fesm2022/acorex-core-format.mjs +82 -32
  15. package/fesm2022/acorex-core-format.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 +11 -3
  19. package/fesm2022/acorex-core-image.mjs.map +1 -1
  20. package/fesm2022/acorex-core-locale.mjs +43 -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 +9 -3
  26. package/fesm2022/acorex-core-pipes.mjs.map +1 -1
  27. package/fesm2022/acorex-core-platform.mjs +31 -10
  28. package/fesm2022/acorex-core-platform.mjs.map +1 -1
  29. package/fesm2022/acorex-core-storage.mjs +43 -12
  30. package/fesm2022/acorex-core-storage.mjs.map +1 -1
  31. package/fesm2022/acorex-core-translation.mjs +16 -16
  32. package/fesm2022/acorex-core-translation.mjs.map +1 -1
  33. package/fesm2022/acorex-core-utils.mjs +4 -4
  34. package/fesm2022/acorex-core-utils.mjs.map +1 -1
  35. package/fesm2022/acorex-core-validation.mjs +44 -40
  36. package/fesm2022/acorex-core-validation.mjs.map +1 -1
  37. package/fesm2022/acorex-core.mjs.map +1 -1
  38. package/file/index.d.ts +43 -0
  39. package/format/index.d.ts +54 -3
  40. package/image/index.d.ts +8 -0
  41. package/locale/index.d.ts +66 -0
  42. package/package.json +5 -5
  43. package/pipes/index.d.ts +6 -0
  44. package/platform/index.d.ts +21 -0
  45. package/storage/index.d.ts +31 -0
  46. package/validation/index.d.ts +4 -0
package/format/index.d.ts CHANGED
@@ -10,7 +10,16 @@ interface AXFormatOptionsMap {
10
10
 
11
11
  declare abstract class AXFormatter {
12
12
  abstract get name(): string;
13
+ /**
14
+ * Formats a value with optional options.
15
+ * @returns The formatted value.
16
+ */
13
17
  abstract format(value: unknown, options?: AXFormatOptions | string): string;
18
+ /**
19
+ * Optional update interval in milliseconds for formatters that need periodic updates.
20
+ * If specified, the format pipe will automatically refresh the formatted value at this interval.
21
+ */
22
+ updateInterval?: number;
14
23
  }
15
24
 
16
25
  declare class AXFormatterDirective implements OnInit {
@@ -25,7 +34,16 @@ declare class AXFormatterDirective implements OnInit {
25
34
  declare class AXFormatPipe implements PipeTransform {
26
35
  private formatService;
27
36
  private eventService;
37
+ private formatterRegistry;
28
38
  private triggers;
39
+ /**
40
+ * Angular pipe for formatting values reactively. Re-evaluates when system events (such as language change) occur.
41
+ *
42
+ * @param value - The input value to format.
43
+ * @param name - The formatter name.
44
+ * @param options - Optional options specific to the formatter.
45
+ * @returns Observable<string> - Emits the formatted string and updates on system events.
46
+ */
29
47
  transform(value: unknown, name: string, options?: AXFormatOptions | string): Observable<string>;
30
48
  static ɵfac: i0.ɵɵFactoryDeclaration<AXFormatPipe, never>;
31
49
  static ɵpipe: i0.ɵɵPipeDeclaration<AXFormatPipe, "format", true>;
@@ -35,7 +53,19 @@ interface AXFormatModuleConfigs {
35
53
  formatters: (new () => AXFormatter)[];
36
54
  }
37
55
  declare class AXFormatModule {
56
+ /**
57
+ * Configures the module for the root injector, optionally registering custom formatters.
58
+ *
59
+ * @param configs - Optional configuration containing custom formatter classes.
60
+ * @returns ModuleWithProviders<AXFormatModule>
61
+ */
38
62
  static forRoot(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule>;
63
+ /**
64
+ * Configures the module for a feature injector, optionally registering custom formatters.
65
+ *
66
+ * @param configs - Optional configuration containing custom formatter classes.
67
+ * @returns ModuleWithProviders<AXFormatModule>
68
+ */
39
69
  static forChild(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule>;
40
70
  /**
41
71
  * @ignore
@@ -52,9 +82,11 @@ declare class AXFormatterRegistryService {
52
82
  register(...plugins: (new () => AXFormatter)[]): void;
53
83
  get formatters(): AXFormatter[];
54
84
  /**
55
- * Resolves a formatter by its name.
56
- * @param name The name of the formatter.
57
- * @returns The formatter if found, otherwise throws an error.
85
+ * Resolves a formatter instance by its name.
86
+ *
87
+ * @param name - The formatter name.
88
+ * @returns AXFormatter - The resolved formatter instance.
89
+ * @throws Error when no formatter with the given name exists.
58
90
  */
59
91
  get(name: string): AXFormatter;
60
92
  static ɵfac: i0.ɵɵFactoryDeclaration<AXFormatterRegistryService, never>;
@@ -64,8 +96,27 @@ declare class AXFormatService {
64
96
  private pluginRegistry;
65
97
  private renderSubject;
66
98
  onRender: rxjs.Observable<void>;
99
+ /**
100
+ * Triggers a render event for listeners that care about formatting updates.
101
+ *
102
+ * @returns void - Emits on the onRender observable.
103
+ */
67
104
  render(): void;
105
+ /**
106
+ * Formats a value using the specified formatter name.
107
+ *
108
+ * @param value - The input value to format.
109
+ * @param formatter - The formatter name to use (e.g., 'number', 'string').
110
+ * @param options - Optional options specific to the formatter.
111
+ * @returns string - The formatted string.
112
+ */
68
113
  format(value: unknown, formatter: string, options?: any): string;
114
+ /**
115
+ * Starts a fluent formatting chain.
116
+ *
117
+ * @param value - The input value to format.
118
+ * @returns AXFormatFluent - A fluent API object for chaining.
119
+ */
69
120
  format(value: unknown): AXFormatFluent;
70
121
  static ɵfac: i0.ɵɵFactoryDeclaration<AXFormatService, never>;
71
122
  static ɵprov: i0.ɵɵInjectableDeclaration<AXFormatService>;
package/image/index.d.ts CHANGED
@@ -3,6 +3,14 @@ import * as i0 from '@angular/core';
3
3
  declare class AXImageService {
4
4
  private document;
5
5
  private platformID;
6
+ /**
7
+ * Resizes an image (File or HTMLImageElement) to fit within maxSize while preserving aspect ratio.
8
+ * @param options.maxSize Maximum width/height in pixels.
9
+ * @param options.source File or HTMLImageElement as source.
10
+ * @param options.type Output MIME type (default 'image/png').
11
+ * @param options.quality Output quality (0..1) for supported formats.
12
+ * @returns Promise<Blob> of the resized image.
13
+ */
6
14
  resize(options: {
7
15
  maxSize: number;
8
16
  source: HTMLImageElement | File;
package/locale/index.d.ts CHANGED
@@ -15,12 +15,20 @@ declare module '@acorex/core/format' {
15
15
  }
16
16
 
17
17
  interface AXLocaleProfile {
18
+ /**
19
+ * Returns the locale info.
20
+ * @returns The locale info.
21
+ */
18
22
  localeInfo: {
19
23
  code: string;
20
24
  language: string;
21
25
  region: string;
22
26
  timezone: string;
23
27
  };
28
+ /**
29
+ * Returns the calendar.
30
+ * @returns The calendar.
31
+ */
24
32
  calendar: {
25
33
  system: 'gregorian' | 'solar-hijri' | string;
26
34
  week: {
@@ -31,6 +39,10 @@ interface AXLocaleProfile {
31
39
  format24Hour: boolean;
32
40
  };
33
41
  };
42
+ /**
43
+ * Returns the formats.
44
+ * @returns The formats.
45
+ */
34
46
  formats: {
35
47
  date: FormatPattern;
36
48
  time: FormatPattern;
@@ -46,6 +58,10 @@ interface AXLocaleProfile {
46
58
  postalCode: string;
47
59
  };
48
60
  };
61
+ /**
62
+ * Returns the units.
63
+ * @returns The units.
64
+ */
49
65
  units: {
50
66
  temperature: 'celsius' | 'fahrenheit';
51
67
  distance: 'kilometers' | 'miles';
@@ -55,6 +71,10 @@ interface AXLocaleProfile {
55
71
  area: 'square-meters' | 'square-feet';
56
72
  custom?: Record<string, string>;
57
73
  };
74
+ /**
75
+ * Returns the i18n meta.
76
+ * @returns The i18n meta.
77
+ */
58
78
  i18nMeta: {
59
79
  fallbackLocales?: string[];
60
80
  supportedLanguages?: string[];
@@ -82,9 +102,31 @@ declare class AXLocaleProfileProviderService {
82
102
  private resolvedCache;
83
103
  private isInitialized;
84
104
  private init;
105
+ /**
106
+ * Returns all available locale profiles by loading each registered provider.
107
+ *
108
+ * @returns Promise<AXLocaleProfile[]>
109
+ */
85
110
  getList(): Promise<AXLocaleProfile[]>;
111
+ /**
112
+ * Loads or returns from cache the locale profile associated with the given code.
113
+ *
114
+ * @param localeCode - The locale code to resolve.
115
+ * @returns Promise<AXLocaleProfile | undefined>
116
+ */
86
117
  getByLocale(localeCode: string): Promise<AXLocaleProfile | undefined>;
118
+ /**
119
+ * Clears caches and reloads all providers.
120
+ *
121
+ * @returns Promise<void>
122
+ */
87
123
  reload(): Promise<void>;
124
+ /**
125
+ * Indicates whether a loader has been registered for the given locale code.
126
+ *
127
+ * @param localeCode - The locale code to check.
128
+ * @returns boolean - True if a loader exists.
129
+ */
88
130
  has(localeCode: string): boolean;
89
131
  static ɵfac: i0.ɵɵFactoryDeclaration<AXLocaleProfileProviderService, never>;
90
132
  static ɵprov: i0.ɵɵInjectableDeclaration<AXLocaleProfileProviderService>;
@@ -108,13 +150,37 @@ declare class AXLocaleService {
108
150
  activeProfile: i0.Signal<AXLocaleProfile>;
109
151
  profileChanged$: rxjs.Observable<AXLocaleProfile>;
110
152
  private originalProfile;
153
+ /**
154
+ * Loads and activates a locale profile by its code (e.g., 'en-US', 'fa-IR').
155
+ *
156
+ * @param localeCode - Locale identifier to load.
157
+ * @returns Promise<void> - Resolves when the profile is loaded and activated.
158
+ */
111
159
  setProfile(localeCode: string): Promise<void>;
112
160
  /**
113
161
  *
114
162
  */
115
163
  constructor();
164
+ /**
165
+ * Applies overrides to the active profile using a deep-merge object.
166
+ *
167
+ * @param profile - Partial profile object whose properties override the active profile.
168
+ * @returns void
169
+ */
116
170
  apply(profile: Partial<AXLocaleProfile>): void;
171
+ /**
172
+ * Applies a single value override at the given path (dot notation).
173
+ *
174
+ * @param path - Dot-notated path (e.g., 'formats.date.short').
175
+ * @param value - The value to set at the path.
176
+ * @returns void
177
+ */
117
178
  apply(path: string, value: any): void;
179
+ /**
180
+ * Resets the active profile to its original loaded state (clears overrides).
181
+ *
182
+ * @returns void
183
+ */
118
184
  reset(): void;
119
185
  static ɵfac: i0.ɵɵFactoryDeclaration<AXLocaleService, never>;
120
186
  static ɵprov: i0.ɵɵInjectableDeclaration<AXLocaleService>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex/core",
3
- "version": "21.0.0-next.3",
3
+ "version": "21.0.0-next.31",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.0.0",
6
6
  "@angular/core": "^20.0.0",
@@ -72,14 +72,14 @@
72
72
  "types": "./network/index.d.ts",
73
73
  "default": "./fesm2022/acorex-core-network.mjs"
74
74
  },
75
- "./pipes": {
76
- "types": "./pipes/index.d.ts",
77
- "default": "./fesm2022/acorex-core-pipes.mjs"
78
- },
79
75
  "./platform": {
80
76
  "types": "./platform/index.d.ts",
81
77
  "default": "./fesm2022/acorex-core-platform.mjs"
82
78
  },
79
+ "./pipes": {
80
+ "types": "./pipes/index.d.ts",
81
+ "default": "./fesm2022/acorex-core-pipes.mjs"
82
+ },
83
83
  "./storage": {
84
84
  "types": "./storage/index.d.ts",
85
85
  "default": "./fesm2022/acorex-core-storage.mjs"
package/pipes/index.d.ts CHANGED
@@ -4,6 +4,12 @@ import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl
4
4
 
5
5
  declare class AXSafePipe implements PipeTransform {
6
6
  protected sanitizer: DomSanitizer;
7
+ /**
8
+ * Marks values as safe for Angular binding via DomSanitizer.
9
+ * @param value The value to sanitize.
10
+ * @param type One of 'html' | 'style' | 'script' | 'url' | 'resourceUrl'.
11
+ * @throws Error when type is invalid.
12
+ */
7
13
  transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl;
8
14
  static ɵfac: i0.ɵɵFactoryDeclaration<AXSafePipe, never>;
9
15
  static ɵpipe: i0.ɵɵPipeDeclaration<AXSafePipe, "safe", true>;
@@ -59,12 +59,33 @@ declare class AXPlatform {
59
59
  isRtl(): boolean;
60
60
  isLandscape(): boolean;
61
61
  isPortrate(): boolean;
62
+ /**
63
+ * Checks whether the current environment matches the given platform/browser/technology/screen size keyword.
64
+ *
65
+ * @param name - One of AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes.
66
+ */
62
67
  is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean;
63
68
  get screenSize(): AXScreenSizes;
69
+ /**
70
+ * Switches to light mode and persists it.
71
+ * @returns 'light'
72
+ */
64
73
  switchLightMode(): string;
74
+ /**
75
+ * Switches to dark mode and persists it.
76
+ * @returns 'dark'
77
+ */
65
78
  switchDarkMode(): string;
66
79
  switchSystemMode(): void;
80
+ /**
81
+ * Reads persisted theme preference and applies it (returns the effective mode).
82
+ * @returns AXThemeMode
83
+ */
67
84
  autoDetectThemeMode(): "light" | "dark" | "system";
85
+ /**
86
+ * Sets theme mode explicitly and persists it.
87
+ * @param mode - Desired theme mode.
88
+ */
68
89
  setThemeMode(mode: AXThemeMode): void;
69
90
  private setFullHeightRatio;
70
91
  private autoSystemModeDetection;
@@ -122,11 +122,42 @@ declare class AXCookieStorageService {
122
122
  declare const AX_LOCALSTORAGE_SECRET_KEY: InjectionToken<string>;
123
123
  declare class AXLocalStorageService implements AXStorage {
124
124
  private secret_key;
125
+ /**
126
+ * Reads a value from localStorage and parses JSON.
127
+ *
128
+ * @param key - Storage key
129
+ * @returns T | null
130
+ */
125
131
  get<T = unknown>(key: string): T;
132
+ /**
133
+ * Writes a JSON-serialized value to localStorage.
134
+ *
135
+ * @param key - Storage key
136
+ * @param value - Value to persist
137
+ */
126
138
  set<T = unknown>(key: string, value: T): void;
127
139
  clear(): void;
140
+ /**
141
+ * Removes a single entry by key from localStorage.
142
+ *
143
+ * @param key - Storage key
144
+ */
128
145
  removeItem(key: string): void;
146
+ /**
147
+ * Encrypts the JSON-serialized value using AES and stores it.
148
+ * Requires providing AX_LOCALSTORAGE_SECRET_KEY.
149
+ *
150
+ * @param key - Storage key
151
+ * @param value - Value to encrypt and store
152
+ */
129
153
  setWithEncryption<T = unknown>(key: string, value: T): void;
154
+ /**
155
+ * Reads the encrypted value, decrypts it using AES and parses JSON.
156
+ * Requires providing AX_LOCALSTORAGE_SECRET_KEY.
157
+ *
158
+ * @param key - Storage key
159
+ * @returns T | null
160
+ */
130
161
  getWithEncription<T = unknown>(key: string): T;
131
162
  static ɵfac: i0.ɵɵFactoryDeclaration<AXLocalStorageService, never>;
132
163
  static ɵprov: i0.ɵɵInjectableDeclaration<AXLocalStorageService>;
@@ -230,6 +230,10 @@ declare class AXValidationRegistryService {
230
230
  declare class AXValidationService {
231
231
  private translationService;
232
232
  private pluginRegistry;
233
+ /**
234
+ * Validates a value with optional options.
235
+ * @returns Promise<AXValidationRuleResult>
236
+ */
233
237
  validate(ruleName: string, value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult>;
234
238
  ruleFor(value: unknown): AXValidationRuleChain;
235
239
  static ɵfac: i0.ɵɵFactoryDeclaration<AXValidationService, never>;