@acorex/core 22.0.0-next.9 → 22.0.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1 -0
  2. package/constants/README.md +7 -1
  3. package/fesm2022/acorex-core-constants.mjs +27809 -1
  4. package/fesm2022/acorex-core-constants.mjs.map +1 -1
  5. package/fesm2022/acorex-core-date-time.mjs +30 -16
  6. package/fesm2022/acorex-core-date-time.mjs.map +1 -1
  7. package/fesm2022/acorex-core-file.mjs +118 -96
  8. package/fesm2022/acorex-core-file.mjs.map +1 -1
  9. package/fesm2022/acorex-core-full-screen.mjs +229 -56
  10. package/fesm2022/acorex-core-full-screen.mjs.map +1 -1
  11. package/fesm2022/acorex-core-locale.mjs +3 -0
  12. package/fesm2022/acorex-core-locale.mjs.map +1 -1
  13. package/fesm2022/acorex-core-theme-builder.mjs +1329 -0
  14. package/fesm2022/acorex-core-theme-builder.mjs.map +1 -0
  15. package/fesm2022/acorex-core-translation.mjs +20 -8
  16. package/fesm2022/acorex-core-translation.mjs.map +1 -1
  17. package/fesm2022/acorex-core-utils.mjs +250 -74
  18. package/fesm2022/acorex-core-utils.mjs.map +1 -1
  19. package/i18n/en-AU/acorex.json +1096 -0
  20. package/i18n/en-AU/common.json +290 -0
  21. package/i18n/en-US/acorex.json +1096 -0
  22. package/i18n/en-US/common.json +285 -0
  23. package/i18n/fa-IR/acorex.json +1096 -0
  24. package/i18n/fa-IR/common.json +284 -0
  25. package/package.json +7 -2
  26. package/theme-builder/README.md +53 -0
  27. package/types/acorex-core-constants.d.ts +58 -2
  28. package/types/acorex-core-date-time.d.ts +5 -0
  29. package/types/acorex-core-file.d.ts +10 -2
  30. package/types/acorex-core-full-screen.d.ts +67 -18
  31. package/types/acorex-core-locale.d.ts +2 -0
  32. package/types/acorex-core-theme-builder.d.ts +42 -0
  33. package/types/acorex-core-translation.d.ts +11 -5
  34. package/types/acorex-core-utils.d.ts +52 -14
@@ -1,53 +1,102 @@
1
- import * as i0 from '@angular/core';
1
+ import * as _angular_core from '@angular/core';
2
2
 
3
+ /**
4
+ * Fullscreen implementation mode.
5
+ * - `overlay`: CSS fixed container that covers the viewport.
6
+ * - `browser`: Native Fullscreen API via `element.requestFullscreen()`.
7
+ */
8
+ type AXFullScreenMode = 'overlay' | 'browser';
3
9
  declare class AXFullScreenService {
4
10
  private readonly zIndexService;
11
+ private readonly document;
12
+ private readonly platformId;
13
+ private readonly destroyRef;
5
14
  /**
6
- * Current fullscreen state
15
+ * Current fullscreen state.
7
16
  */
8
17
  private readonly isFullscreenState;
9
18
  /**
10
- * Original element styles to restore
19
+ * Active fullscreen element.
20
+ */
21
+ private readonly activeElementState;
22
+ /**
23
+ * Active fullscreen mode.
24
+ */
25
+ private currentMode;
26
+ /**
27
+ * Original element styles to restore (overlay mode).
11
28
  */
12
29
  private originalStyles;
13
30
  /**
14
- * Original parent element reference
31
+ * Original parent element reference (overlay mode).
15
32
  */
16
33
  private originalParent;
17
34
  /**
18
- * Fullscreen container element
35
+ * Original next sibling so overlay restore keeps DOM order (overlay mode).
36
+ */
37
+ private originalNextSibling;
38
+ /**
39
+ * Fullscreen container element (overlay mode).
19
40
  */
20
41
  private fullscreenContainer;
21
42
  /**
22
- * Z-index token for this fullscreen instance
43
+ * Z-index token for overlay fullscreen.
23
44
  */
24
45
  private zToken;
46
+ private readonly fullscreenChangeHandler;
47
+ constructor();
25
48
  /**
26
- * Toggle fullscreen state
49
+ * Toggle fullscreen state.
27
50
  */
28
- toggle(element: HTMLElement): void;
51
+ toggle(element: HTMLElement, mode?: AXFullScreenMode): void;
29
52
  /**
30
- * Enter fullscreen mode
53
+ * Enter fullscreen mode.
31
54
  */
32
- enter(element: HTMLElement): void;
55
+ enter(element: HTMLElement, mode?: AXFullScreenMode): void;
33
56
  /**
34
- * Exit fullscreen mode
57
+ * Exit fullscreen mode.
35
58
  */
36
- exit(element: HTMLElement): void;
59
+ exit(element?: HTMLElement): void;
37
60
  /**
38
- * Check fullscreen state
61
+ * Check whether any element is in fullscreen mode.
39
62
  */
40
63
  isFullscreen(): boolean;
41
64
  /**
42
- * Store original computed styles
65
+ * Read-only signal of the active fullscreen element.
43
66
  */
44
- private storeOriginalStyles;
67
+ readonly activeElement: _angular_core.Signal<HTMLElement>;
45
68
  /**
46
- * Restore original styles
69
+ * Read-only signal of the fullscreen state.
47
70
  */
71
+ readonly fullscreen: _angular_core.Signal<boolean>;
72
+ /**
73
+ * Check whether the given element is the active fullscreen element.
74
+ */
75
+ isActive(element: HTMLElement): boolean;
76
+ /**
77
+ * Returns the currently active fullscreen element, if any.
78
+ */
79
+ getActiveElement(): HTMLElement | null;
80
+ /**
81
+ * Returns the active fullscreen mode, if any.
82
+ */
83
+ getActiveMode(): AXFullScreenMode | null;
84
+ private enterOverlay;
85
+ private exitOverlay;
86
+ private enterBrowser;
87
+ private exitBrowser;
88
+ private clearBrowserState;
89
+ private clearActiveState;
90
+ private cleanupOverlayResources;
91
+ private restoreOriginalPosition;
92
+ private getFullscreenElement;
93
+ private getRequestFullscreen;
94
+ private getExitFullscreen;
95
+ private storeOriginalStyles;
48
96
  private restoreOriginalStyles;
49
- static ɵfac: i0.ɵɵFactoryDeclaration<AXFullScreenService, never>;
50
- static ɵprov: i0.ɵɵInjectableDeclaration<AXFullScreenService>;
97
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXFullScreenService, never>;
98
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<AXFullScreenService>;
51
99
  }
52
100
 
53
101
  export { AXFullScreenService };
102
+ export type { AXFullScreenMode };
@@ -34,6 +34,8 @@ interface AXLocaleProfile {
34
34
  week: {
35
35
  startsOn: number;
36
36
  weekends: number[];
37
+ /** Number of characters shown for weekday headers in calendar views (e.g. 1 for fa, 2 for en). */
38
+ weekdayLabelLength: number;
37
39
  };
38
40
  clock: {
39
41
  format24Hour: boolean;
@@ -0,0 +1,42 @@
1
+ type AXThemeBuilderColors = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'surface' | 'accent' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6';
2
+ type AXThemeBuilderColorVariants = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950' | 'on' | 'on-contrast';
3
+ type AXThemeBuilderPalette = Record<AXThemeBuilderColors, Record<AXThemeBuilderColorVariants, string>>;
4
+ type AXThemeBuilderFullPalette = {
5
+ light: AXThemeBuilderPalette;
6
+ dark: AXThemeBuilderPalette;
7
+ };
8
+ type AXThemeBuilderBaseColors = {
9
+ light: Record<AXThemeBuilderColors, string>;
10
+ dark: Record<AXThemeBuilderColors, string>;
11
+ };
12
+
13
+ type AXThemeColors = Partial<Record<AXThemeBuilderColors, string>>;
14
+ interface AXCreateThemeOptions {
15
+ /** 'file' (default) emits a complete stylesheet with :root/.ax-dark plus the Tailwind layer.
16
+ * 'preview' emits variables only, scoped to `scope`, for injecting into a live page. */
17
+ target?: 'file' | 'preview';
18
+ /** Selectors used when target is 'preview'. */
19
+ scope?: {
20
+ light: string;
21
+ dark: string;
22
+ };
23
+ /** Roles to emit when target is 'preview'. Defaults to all roles. */
24
+ roles?: AXThemeBuilderColors[];
25
+ }
26
+ interface AXTheme {
27
+ /** The generated CSS. */
28
+ css: string;
29
+ /** Generated shade scales per role, for both modes. */
30
+ palette: AXThemeBuilderFullPalette;
31
+ }
32
+ /**
33
+ * Creates an ACoreX theme from a flat map of role seed colors.
34
+ *
35
+ * Each provided color is applied to both light and dark modes; dark shades are
36
+ * derived via the dark-palette tone mapping. Omitted roles fall back to the
37
+ * packaged default seeds (which may differ per mode for `secondary`, `danger`, and `surface`).
38
+ */
39
+ declare function createTheme(colors?: AXThemeColors, options?: AXCreateThemeOptions): AXTheme;
40
+
41
+ export { createTheme };
42
+ export type { AXCreateThemeOptions, AXTheme, AXThemeBuilderBaseColors, AXThemeBuilderColorVariants, AXThemeBuilderColors, AXThemeBuilderFullPalette, AXThemeBuilderPalette, AXThemeColors };
@@ -1,10 +1,8 @@
1
- import { ResolveFn } from '@angular/router';
2
1
  import * as i0 from '@angular/core';
3
- import { InjectionToken, PipeTransform, OnInit } from '@angular/core';
2
+ import { Signal, InjectionToken, PipeTransform, OnInit } from '@angular/core';
3
+ import { ResolveFn } from '@angular/router';
4
4
  import { Observable } from 'rxjs';
5
5
 
6
- declare const loadTranslationScope: ResolveFn<unknown>;
7
-
8
6
  type AXTranslateHashMap<T = unknown> = Record<string, T>;
9
7
  type AXTranslateLang = string;
10
8
  type AXTranslateScope = string;
@@ -41,6 +39,14 @@ declare function createMultiLanguageString(enUs: string, faIr: string): AXMultiL
41
39
  */
42
40
  declare function isEffectivelyEmptyLocalizedValue(value: unknown): boolean;
43
41
 
42
+ /**
43
+ * Creates a signal that mirrors a string source signal, translating its value whenever
44
+ * the source or active language changes.
45
+ */
46
+ declare function toTranslatedSignal(source: Signal<string | null | undefined>, options?: AXTranslateOptions): Signal<string>;
47
+
48
+ declare const loadTranslationScope: ResolveFn<unknown>;
49
+
44
50
  interface AXTranslationConfig {
45
51
  defaults: {
46
52
  lang: AXTranslateLang;
@@ -138,5 +144,5 @@ declare class AXTranslationService {
138
144
  static ɵprov: i0.ɵɵInjectableDeclaration<AXTranslationService>;
139
145
  }
140
146
 
141
- export { AXTranslationDefaultConfig, AXTranslationLoaderDefault, AXTranslationModule, AXTranslationService, AXTranslatorDirective, AXTranslatorPipe, AX_TRANSLATION_CONFIG, AX_TRANSLATION_LOADER, LOCALE_KEY_REGEX, createMultiLanguageString, isEffectivelyEmptyLocalizedValue, isValidMultiLanguageObject, loadTranslationScope, resolveMultiLanguageString, resolveMultiLanguageValue, translateSync, translationConfig };
147
+ export { AXTranslationDefaultConfig, AXTranslationLoaderDefault, AXTranslationModule, AXTranslationService, AXTranslatorDirective, AXTranslatorPipe, AX_TRANSLATION_CONFIG, AX_TRANSLATION_LOADER, LOCALE_KEY_REGEX, createMultiLanguageString, isEffectivelyEmptyLocalizedValue, isValidMultiLanguageObject, loadTranslationScope, resolveMultiLanguageString, resolveMultiLanguageValue, toTranslatedSignal, translateSync, translationConfig };
142
148
  export type { AXMultiLanguageMap, AXMultiLanguageString, AXParsedToken, AXPartialTranslationConfig, AXTranslateHashMap, AXTranslateLang, AXTranslateOptions, AXTranslateParams, AXTranslateScope, AXTranslation, AXTranslationConfig, AXTranslationLoader, AXTranslationLoaderOptions };
@@ -83,33 +83,71 @@ declare function debounceAsync<T extends (...args: any[]) => Promise<any>>(fn: T
83
83
  */
84
84
  declare function fallbackChain<T>(tasks: Array<() => Promise<T>>): Promise<T>;
85
85
 
86
+ type AXHighlightTarget = string | Element | readonly Element[];
87
+ interface AXHighlightOptions {
88
+ /** When false (default), matching is case-insensitive. */
89
+ caseSensitive?: boolean;
90
+ /** When true, only match whole words. */
91
+ wholeWord?: boolean;
92
+ /** Maximum number of matches to highlight across all targets. */
93
+ maxMatches?: number;
94
+ /** CSS class applied to highlighted match spans. */
95
+ highlightClass?: string;
96
+ /** CSS class applied to the wrapper span around highlighted text nodes. */
97
+ wrapperClass?: string;
98
+ /** Parent tag names whose text content is skipped. */
99
+ ignoredTags?: readonly string[];
100
+ }
86
101
  /**
87
102
  * Service for applying and resetting text highlighting within specified HTML elements.
88
103
  */
89
104
  declare class AXHighlightService {
90
- private querySelector;
91
- private searchValue;
105
+ private readonly document;
106
+ private readonly platformId;
107
+ private readonly selectorStates;
108
+ private readonly elementStates;
109
+ private readonly trackedElements;
92
110
  /**
93
- * Highlights all occurrences of a search value within the elements matching the provided query selector.
111
+ * Highlights all occurrences of a search value within the elements matching the provided target.
94
112
  *
95
- * @param querySelector - CSS selector to identify target elements.
96
- * @param searchValue - Text to search and highlight.
113
+ * @param target - CSS selector, a single element, or an array of elements to search within.
114
+ * @param term - Text or list of texts to search and highlight.
115
+ * @param options - Optional highlight behavior configuration.
116
+ * @returns The number of matches highlighted.
97
117
  */
98
- highlight(querySelector: string, searchValue: string): void;
118
+ highlight(target: AXHighlightTarget, term: string | readonly string[], options?: AXHighlightOptions): number;
99
119
  /**
100
- * Resets highlighted text within the elements matching the query selector.
120
+ * Resets highlighted text within the elements matching the target.
121
+ * When no target is provided, clears all highlights registered by this service.
101
122
  *
102
- * @param querySelector - CSS selector to clear. Falls back to the last selector used by `highlight`.
123
+ * @param target - CSS selector, element, or elements to clear.
103
124
  */
104
- clear(querySelector?: string): void;
125
+ clear(target?: AXHighlightTarget): void;
126
+ private toElementArray;
127
+ private normalizeTerms;
128
+ private resolveOptions;
129
+ private registerState;
130
+ private resolveRoots;
105
131
  private createSearchRegex;
106
- private applyHighlight;
107
- private recursivelyHighlight;
108
- private createHighlightedHTML;
132
+ private collectTextNodes;
133
+ private highlightTextNode;
134
+ private clearSelector;
135
+ private clearElement;
136
+ private unwrapHighlight;
109
137
  static ɵfac: i0.ɵɵFactoryDeclaration<AXHighlightService, never>;
110
138
  static ɵprov: i0.ɵɵInjectableDeclaration<AXHighlightService>;
111
139
  }
112
140
 
141
+ interface AXHighlightSegment {
142
+ text: string;
143
+ match: boolean;
144
+ }
145
+ /**
146
+ * Splits text into highlighted and non-highlighted segments for template rendering.
147
+ * Uses the same matching semantics as {@link AXHighlightService}.
148
+ */
149
+ declare function splitHighlightSegments(text: string, term: string | readonly string[], options?: AXHighlightOptions): AXHighlightSegment[];
150
+
113
151
  /** ACoreX layout size classes applied on a host or container. */
114
152
  declare const AX_SIZE_CLASSES: readonly ["ax-xs", "ax-sm", "ax-md", "ax-lg", "ax-xl"];
115
153
  type AXSizeClass = (typeof AX_SIZE_CLASSES)[number];
@@ -149,5 +187,5 @@ declare function getWordBoundsAtPosition(str: string, position: number): {
149
187
  end: number;
150
188
  };
151
189
 
152
- export { AXAutoUnsubscriber, AXColorUtil, AXDrawingUtil, AXHighlightService, AXHtmlUtil, AXUnsubscriber, AX_SIZE_CLASSES, debounceAsync, delay, fallbackChain, getWordBoundsAtPosition, pollUntil, pollUntilAbortable, retryUntil, throttleAsync, waitFor };
153
- export type { AXBoundingClientRect, AXClosestAxSizeMatch, AXColorFormat, AXColorMode, AXPoint, AXSizeClass };
190
+ export { AXAutoUnsubscriber, AXColorUtil, AXDrawingUtil, AXHighlightService, AXHtmlUtil, AXUnsubscriber, AX_SIZE_CLASSES, debounceAsync, delay, fallbackChain, getWordBoundsAtPosition, pollUntil, pollUntilAbortable, retryUntil, splitHighlightSegments, throttleAsync, waitFor };
191
+ export type { AXBoundingClientRect, AXClosestAxSizeMatch, AXColorFormat, AXColorMode, AXHighlightOptions, AXHighlightSegment, AXHighlightTarget, AXPoint, AXSizeClass };