@acorex/core 22.0.0 → 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 (33) hide show
  1. package/constants/README.md +7 -1
  2. package/fesm2022/acorex-core-constants.mjs +27809 -1
  3. package/fesm2022/acorex-core-constants.mjs.map +1 -1
  4. package/fesm2022/acorex-core-date-time.mjs +30 -16
  5. package/fesm2022/acorex-core-date-time.mjs.map +1 -1
  6. package/fesm2022/acorex-core-file.mjs +10 -3
  7. package/fesm2022/acorex-core-file.mjs.map +1 -1
  8. package/fesm2022/acorex-core-full-screen.mjs +229 -56
  9. package/fesm2022/acorex-core-full-screen.mjs.map +1 -1
  10. package/fesm2022/acorex-core-locale.mjs +3 -0
  11. package/fesm2022/acorex-core-locale.mjs.map +1 -1
  12. package/fesm2022/acorex-core-theme-builder.mjs +1329 -0
  13. package/fesm2022/acorex-core-theme-builder.mjs.map +1 -0
  14. package/fesm2022/acorex-core-translation.mjs +20 -8
  15. package/fesm2022/acorex-core-translation.mjs.map +1 -1
  16. package/fesm2022/acorex-core-utils.mjs +250 -74
  17. package/fesm2022/acorex-core-utils.mjs.map +1 -1
  18. package/i18n/en-AU/acorex.json +1096 -0
  19. package/i18n/en-AU/common.json +290 -0
  20. package/i18n/en-US/acorex.json +1096 -0
  21. package/i18n/en-US/common.json +285 -0
  22. package/i18n/fa-IR/acorex.json +1096 -0
  23. package/i18n/fa-IR/common.json +284 -0
  24. package/package.json +7 -2
  25. package/theme-builder/README.md +53 -0
  26. package/types/acorex-core-constants.d.ts +58 -2
  27. package/types/acorex-core-date-time.d.ts +5 -0
  28. package/types/acorex-core-file.d.ts +1 -0
  29. package/types/acorex-core-full-screen.d.ts +67 -18
  30. package/types/acorex-core-locale.d.ts +2 -0
  31. package/types/acorex-core-theme-builder.d.ts +42 -0
  32. package/types/acorex-core-translation.d.ts +11 -5
  33. package/types/acorex-core-utils.d.ts +52 -14
@@ -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 };