@reforgium/presentia 1.5.0 → 2.0.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.
- package/CHANGELOG.md +144 -0
- package/LICENSE +21 -0
- package/README.md +346 -35
- package/bin/presentia-gen-namespaces.mjs +1248 -0
- package/fesm2022/reforgium-presentia.mjs +690 -186
- package/package.json +23 -5
- package/types/reforgium-presentia.d.ts +284 -89
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "2.0.0",
|
|
3
3
|
"name": "@reforgium/presentia",
|
|
4
|
-
"description": "Angular
|
|
4
|
+
"description": "Angular infrastructure library for i18n, route-aware namespace preload, theming, adaptive breakpoints, route state, and SEO",
|
|
5
5
|
"author": "rtommievich",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
|
-
"type": "git"
|
|
9
|
+
"type": "git",
|
|
10
|
+
"directory": "libs/presentia"
|
|
10
11
|
},
|
|
11
12
|
"bugs": {
|
|
12
13
|
"email": "rtommievich@gmail.com"
|
|
@@ -20,15 +21,28 @@
|
|
|
20
21
|
"npm": ">=9.0.0"
|
|
21
22
|
},
|
|
22
23
|
"bin": {
|
|
23
|
-
"presentia-gen-lang-keys": "./bin/presentia-gen-lang-keys.mjs"
|
|
24
|
+
"presentia-gen-lang-keys": "./bin/presentia-gen-lang-keys.mjs",
|
|
25
|
+
"presentia-gen-namespaces": "./bin/presentia-gen-namespaces.mjs"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [
|
|
26
28
|
"reforgium",
|
|
29
|
+
"angular-library",
|
|
27
30
|
"infrastructure",
|
|
28
31
|
"i18n",
|
|
32
|
+
"localization",
|
|
33
|
+
"internationalization",
|
|
34
|
+
"i18n",
|
|
35
|
+
"translation",
|
|
36
|
+
"namespace-preload",
|
|
37
|
+
"route-preload",
|
|
29
38
|
"theme",
|
|
39
|
+
"theming",
|
|
40
|
+
"adaptive",
|
|
41
|
+
"responsive",
|
|
42
|
+
"breakpoints",
|
|
43
|
+
"route-state",
|
|
44
|
+
"signals",
|
|
30
45
|
"seo",
|
|
31
|
-
"signal",
|
|
32
46
|
"angular"
|
|
33
47
|
],
|
|
34
48
|
"types": "../../dist/@reforgium/presentia/index.d.ts",
|
|
@@ -38,6 +52,8 @@
|
|
|
38
52
|
"bin/*.mjs",
|
|
39
53
|
"package.json",
|
|
40
54
|
"README.md",
|
|
55
|
+
"V2-MIGRATION.md",
|
|
56
|
+
"V2-CONFIG.md",
|
|
41
57
|
"CHANGELOG.md",
|
|
42
58
|
"LICENSE*"
|
|
43
59
|
],
|
|
@@ -47,6 +63,8 @@
|
|
|
47
63
|
"peerDependencies": {
|
|
48
64
|
"@angular/common": ">=18.0.0",
|
|
49
65
|
"@angular/core": ">=18.0.0",
|
|
66
|
+
"@angular/platform-browser": ">=18.0.0",
|
|
67
|
+
"@angular/router": ">=18.0.0",
|
|
50
68
|
"@reforgium/internal": ">=1.2.0",
|
|
51
69
|
"rxjs": ">=7.0.0"
|
|
52
70
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { InjectionToken, Signal, PipeTransform, EnvironmentProviders } from '@angular/core';
|
|
3
3
|
import * as _reforgium_internal from '@reforgium/internal';
|
|
4
|
-
import { Devices, Langs, Themes } from '@reforgium/internal';
|
|
4
|
+
import { Devices, Langs, Themes as Themes$1 } from '@reforgium/internal';
|
|
5
5
|
import { HttpHeaders, HttpParams, HttpContext } from '@angular/common/http';
|
|
6
6
|
|
|
7
7
|
/** Breakpoints for different device types */
|
|
@@ -75,27 +75,30 @@ declare class AdaptiveService {
|
|
|
75
75
|
* Updates automatically when screen width changes
|
|
76
76
|
* or when specified breakpoints are crossed (`DEVICE_BREAKPOINTS`).
|
|
77
77
|
*/
|
|
78
|
-
device:
|
|
78
|
+
device: _angular_core.Signal<Devices>;
|
|
79
79
|
/**
|
|
80
80
|
* Current browser window width in pixels.
|
|
81
81
|
* Updates reactively on `resize` event.
|
|
82
82
|
*/
|
|
83
|
-
width:
|
|
83
|
+
width: _angular_core.Signal<number>;
|
|
84
84
|
/**
|
|
85
85
|
* Current browser window height in pixels.
|
|
86
86
|
* Updates reactively on `resize` event.
|
|
87
87
|
*/
|
|
88
|
-
height:
|
|
88
|
+
height: _angular_core.Signal<number>;
|
|
89
89
|
/**
|
|
90
90
|
* Computed signal indicating whether the current device is a desktop.
|
|
91
91
|
* Used for conditional rendering or layout configuration.
|
|
92
92
|
*/
|
|
93
|
-
isDesktop:
|
|
93
|
+
isDesktop: _angular_core.Signal<boolean>;
|
|
94
|
+
isMobile: _angular_core.Signal<boolean>;
|
|
95
|
+
isTablet: _angular_core.Signal<boolean>;
|
|
96
|
+
isDesktopSmall: _angular_core.Signal<boolean>;
|
|
94
97
|
/**
|
|
95
98
|
* Computed signal determining whether the screen is in portrait orientation.
|
|
96
99
|
* Returns `true` if window height is greater than width.
|
|
97
100
|
*/
|
|
98
|
-
isPortrait:
|
|
101
|
+
isPortrait: _angular_core.Signal<boolean>;
|
|
99
102
|
private deviceBreakpoints;
|
|
100
103
|
private devicePriority;
|
|
101
104
|
private destroyRef;
|
|
@@ -103,8 +106,13 @@ declare class AdaptiveService {
|
|
|
103
106
|
private isBrowser;
|
|
104
107
|
private resizeDebounceId;
|
|
105
108
|
constructor();
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
breakpoint(): Devices;
|
|
110
|
+
is(device: Devices | readonly Devices[]): boolean;
|
|
111
|
+
isAtLeast(device: Devices): boolean;
|
|
112
|
+
isBetween(min: Devices, max: Devices): boolean;
|
|
113
|
+
private deviceRank;
|
|
114
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AdaptiveService, never>;
|
|
115
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AdaptiveService>;
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
/**
|
|
@@ -129,6 +137,8 @@ declare class AdaptiveService {
|
|
|
129
137
|
*/
|
|
130
138
|
declare class IfDeviceDirective {
|
|
131
139
|
private readonly deviceInput;
|
|
140
|
+
private readonly atLeastInput;
|
|
141
|
+
private readonly betweenInput;
|
|
132
142
|
private readonly inverseInput;
|
|
133
143
|
private readonly tpl;
|
|
134
144
|
private readonly vcr;
|
|
@@ -138,10 +148,12 @@ declare class IfDeviceDirective {
|
|
|
138
148
|
private readonly currentDevice;
|
|
139
149
|
constructor();
|
|
140
150
|
set reIfDevice(value: Devices | Devices[] | undefined);
|
|
151
|
+
set reIfDeviceAtLeast(value: Devices | undefined);
|
|
152
|
+
set reIfDeviceBetween(value: readonly [Devices, Devices] | undefined);
|
|
141
153
|
set inverse(value: boolean | undefined);
|
|
142
154
|
private updateView;
|
|
143
|
-
static ɵfac:
|
|
144
|
-
static ɵdir:
|
|
155
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<IfDeviceDirective, never>;
|
|
156
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<IfDeviceDirective, "[reIfDevice],[reIfDeviceAtLeast],[reIfDeviceBetween]", never, { "reIfDevice": { "alias": "reIfDevice"; "required": false; }; "reIfDeviceAtLeast": { "alias": "reIfDeviceAtLeast"; "required": false; }; "reIfDeviceBetween": { "alias": "reIfDeviceBetween"; "required": false; }; "inverse": { "alias": "inverse"; "required": false; }; }, {}, never, never, true, never>;
|
|
145
157
|
}
|
|
146
158
|
|
|
147
159
|
/**
|
|
@@ -222,6 +234,38 @@ type LangNamespaceCacheConfig = {
|
|
|
222
234
|
maxNamespaces?: number;
|
|
223
235
|
ttlMs?: number;
|
|
224
236
|
};
|
|
237
|
+
type LangRouteNamespaceManifest = Record<string, readonly string[]>;
|
|
238
|
+
type LangRouteNamespacePreloadMode = 'blocking' | 'lazy';
|
|
239
|
+
type LangRouteNamespacePreloadMergeStrategy = 'append' | 'replace';
|
|
240
|
+
type LangRouteNamespacePreloadErrorMode = 'continue' | 'throw';
|
|
241
|
+
type LangRouteNamespacePreloadConfig = {
|
|
242
|
+
mode?: LangRouteNamespacePreloadMode;
|
|
243
|
+
dataKey?: string;
|
|
244
|
+
manifest?: LangRouteNamespaceManifest;
|
|
245
|
+
mergeStrategy?: LangRouteNamespacePreloadMergeStrategy;
|
|
246
|
+
onError?: LangRouteNamespacePreloadErrorMode;
|
|
247
|
+
diagnostics?: boolean;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Adapter for custom persistence of language/theme selection.
|
|
251
|
+
* Implement this interface to replace the default `localStorage` storage.
|
|
252
|
+
*/
|
|
253
|
+
type PersistenceAdapter = {
|
|
254
|
+
getItem(key: string): string | null;
|
|
255
|
+
setItem(key: string, value: string): void;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Describes a failed namespace load attempt.
|
|
259
|
+
* Exposed via `LangService.errors()` signal.
|
|
260
|
+
*/
|
|
261
|
+
type LoadNamespaceError = {
|
|
262
|
+
namespace: string;
|
|
263
|
+
lang: Langs;
|
|
264
|
+
/** HTTP status code, or `null` for non-HTTP failures. */
|
|
265
|
+
status: number | null;
|
|
266
|
+
/** Request URL that produced the error. */
|
|
267
|
+
url: string;
|
|
268
|
+
};
|
|
225
269
|
/**
|
|
226
270
|
* Represents configuration settings for localization.
|
|
227
271
|
*
|
|
@@ -244,6 +288,7 @@ type LangNamespaceCacheConfig = {
|
|
|
244
288
|
* - `batchRequestBuilder` optional URL builder hook for batched namespace loading.
|
|
245
289
|
* - `batchResponseAdapter` optional transformer hook for batched API payloads.
|
|
246
290
|
* - `namespaceCache` optional ttl/lru-like cache controls for loaded namespaces.
|
|
291
|
+
* - `routeNamespacePreload` optional route-aware namespace preload settings.
|
|
247
292
|
*/
|
|
248
293
|
interface LocaleConfig {
|
|
249
294
|
url: string;
|
|
@@ -260,11 +305,31 @@ interface LocaleConfig {
|
|
|
260
305
|
batchRequestBuilder?: LangBatchRequestBuilder;
|
|
261
306
|
batchResponseAdapter?: LangBatchResponseAdapter;
|
|
262
307
|
namespaceCache?: LangNamespaceCacheConfig;
|
|
308
|
+
routeNamespacePreload?: LangRouteNamespacePreloadConfig;
|
|
309
|
+
/**
|
|
310
|
+
* Maximum number of namespaces per batch request.
|
|
311
|
+
* When the namespace list exceeds this limit the load is split into multiple batch requests.
|
|
312
|
+
* No limit by default.
|
|
313
|
+
*/
|
|
314
|
+
maxBatchSize?: number;
|
|
263
315
|
}
|
|
264
316
|
declare const innerLangVal: unique symbol;
|
|
265
317
|
|
|
266
318
|
declare const LANG_MISSING_KEY_HANDLER: InjectionToken<LangMissingKeyHandler>;
|
|
267
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Optional DI token for a custom persistence adapter used by `LangService`
|
|
322
|
+
* to store and retrieve the selected language (default key: `'lang'`).
|
|
323
|
+
*
|
|
324
|
+
* When not provided the service falls back to `localStorage` directly.
|
|
325
|
+
*
|
|
326
|
+
* Example:
|
|
327
|
+
* ```ts
|
|
328
|
+
* { provide: LANG_PERSISTENCE_ADAPTER, useValue: sessionStorageAdapter }
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
declare const LANG_PERSISTENCE_ADAPTER: InjectionToken<PersistenceAdapter>;
|
|
332
|
+
|
|
268
333
|
/**
|
|
269
334
|
* Injection token for providing locale configuration to the language module.
|
|
270
335
|
*
|
|
@@ -314,6 +379,7 @@ declare class LangService {
|
|
|
314
379
|
private readonly http;
|
|
315
380
|
private readonly isBrowser;
|
|
316
381
|
private readonly missingKeyHandler;
|
|
382
|
+
private readonly routeNamespaceDiagnostics;
|
|
317
383
|
private readonly supportedLangSet;
|
|
318
384
|
/**
|
|
319
385
|
* Computed property determining the current language setting.
|
|
@@ -323,7 +389,7 @@ declare class LangService {
|
|
|
323
389
|
* - If `config.kgValue` is not defined, the property will return the default value 'kg'.
|
|
324
390
|
* - For other languages (e.g. `ru`, `en`) returns source language as-is.
|
|
325
391
|
*/
|
|
326
|
-
readonly currentLang: Signal<"ru" | "kg" | "en" |
|
|
392
|
+
readonly currentLang: Signal<(string & {}) | "ru" | "kg" | "en" | "ky">;
|
|
327
393
|
/**
|
|
328
394
|
* Extracts readonly value from private property `#lang` and assigns it to `innerLangVal`.
|
|
329
395
|
* Expected that property `#lang` has `asReadonly` method that returns immutable representation.
|
|
@@ -371,6 +437,9 @@ declare class LangService {
|
|
|
371
437
|
loadNamespace(ns: string): Promise<void>;
|
|
372
438
|
isNamespaceLoaded(ns: string): boolean;
|
|
373
439
|
loadNamespaces(namespaces: readonly string[]): Promise<void>;
|
|
440
|
+
private loadNamespaceBatch;
|
|
441
|
+
private normalizeMaxBatchSize;
|
|
442
|
+
private chunkNamespaces;
|
|
374
443
|
evictNamespace(ns: string): void;
|
|
375
444
|
clearNamespaceCache(): void;
|
|
376
445
|
private parseModelToRecord;
|
|
@@ -396,8 +465,8 @@ declare class LangService {
|
|
|
396
465
|
private resolveMissingValue;
|
|
397
466
|
private normalizeLang;
|
|
398
467
|
private normalizeSupportedLangs;
|
|
399
|
-
static ɵfac:
|
|
400
|
-
static ɵprov:
|
|
468
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<LangService, never>;
|
|
469
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<LangService>;
|
|
401
470
|
}
|
|
402
471
|
|
|
403
472
|
/**
|
|
@@ -448,7 +517,7 @@ declare class LangDirective {
|
|
|
448
517
|
* Localization mode: defines which parts of the element will be translated.
|
|
449
518
|
* @default 'all'
|
|
450
519
|
*/
|
|
451
|
-
lang:
|
|
520
|
+
lang: _angular_core.InputSignal<string | LangDirectiveConfig>;
|
|
452
521
|
/**
|
|
453
522
|
* Explicit key for text content translation.
|
|
454
523
|
*/
|
|
@@ -460,7 +529,7 @@ declare class LangDirective {
|
|
|
460
529
|
/**
|
|
461
530
|
* Name of an additional attribute to localize (besides standard `title`, `label`, `placeholder`).
|
|
462
531
|
*/
|
|
463
|
-
langForAttr:
|
|
532
|
+
langForAttr: _angular_core.InputSignal<string | undefined>;
|
|
464
533
|
private el;
|
|
465
534
|
private renderer;
|
|
466
535
|
private service;
|
|
@@ -512,8 +581,8 @@ declare class LangDirective {
|
|
|
512
581
|
* @returns localized string
|
|
513
582
|
*/
|
|
514
583
|
private getLangValue;
|
|
515
|
-
static ɵfac:
|
|
516
|
-
static ɵdir:
|
|
584
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<LangDirective, never>;
|
|
585
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<LangDirective, "[reLang]", never, { "lang": { "alias": "reLang"; "required": false; "isSignal": true; }; "langForAttr": { "alias": "langForAttr"; "required": false; "isSignal": true; }; "reLangKey": { "alias": "reLangKey"; "required": false; }; "reLangAttrs": { "alias": "reLangAttrs"; "required": false; }; }, {}, never, never, true, never>;
|
|
517
586
|
}
|
|
518
587
|
|
|
519
588
|
/**
|
|
@@ -543,8 +612,8 @@ declare class LangPipe implements PipeTransform {
|
|
|
543
612
|
private makeKey;
|
|
544
613
|
private evictIfNeeded;
|
|
545
614
|
private warnUnresolvedKey;
|
|
546
|
-
static ɵfac:
|
|
547
|
-
static ɵpipe:
|
|
615
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<LangPipe, never>;
|
|
616
|
+
static ɵpipe: _angular_core.ɵɵPipeDeclaration<LangPipe, "lang", true>;
|
|
548
617
|
}
|
|
549
618
|
|
|
550
619
|
type LangPipeConfig = {
|
|
@@ -554,21 +623,49 @@ type LangPipeConfig = {
|
|
|
554
623
|
};
|
|
555
624
|
declare const LANG_PIPE_CONFIG: InjectionToken<LangPipeConfig>;
|
|
556
625
|
|
|
626
|
+
type BaseTheme = _reforgium_internal.Themes;
|
|
627
|
+
type Theme = BaseTheme | (string & {});
|
|
628
|
+
/**
|
|
629
|
+
* @deprecated Prefer `Theme`.
|
|
630
|
+
*/
|
|
631
|
+
type Themes = Theme;
|
|
632
|
+
|
|
633
|
+
type ThemeDomStrategy = 'root-class' | 'data-attribute';
|
|
634
|
+
type ThemeClassNameBuilder = (theme: Theme) => string;
|
|
635
|
+
interface ThemeDomConfig {
|
|
636
|
+
strategy?: ThemeDomStrategy;
|
|
637
|
+
rootSelector?: string;
|
|
638
|
+
darkThemePrefix?: string;
|
|
639
|
+
attributeName?: string;
|
|
640
|
+
themeClassPrefix?: string;
|
|
641
|
+
classNameBuilder?: ThemeClassNameBuilder;
|
|
642
|
+
}
|
|
557
643
|
/**
|
|
558
644
|
* Configuration options for theme management.
|
|
559
645
|
* Defines the default theme and prefix for dark theme variants.
|
|
560
646
|
*/
|
|
561
647
|
interface ThemeConfig {
|
|
648
|
+
/**
|
|
649
|
+
* Explicit list of supported themes.
|
|
650
|
+
* Values outside this registry are ignored and fallback to the default theme.
|
|
651
|
+
* @optional
|
|
652
|
+
*/
|
|
653
|
+
registry?: readonly Theme[];
|
|
562
654
|
/**
|
|
563
655
|
* The default theme to be applied when no other theme is specified.
|
|
564
656
|
* @optional
|
|
565
657
|
*/
|
|
566
|
-
defaultTheme?:
|
|
658
|
+
defaultTheme?: Theme;
|
|
567
659
|
/**
|
|
568
660
|
* Prefix string used to identify and apply dark theme variants.
|
|
569
661
|
* @optional
|
|
570
662
|
*/
|
|
571
663
|
darkThemePrefix?: string;
|
|
664
|
+
/**
|
|
665
|
+
* DOM application strategy for the active theme.
|
|
666
|
+
* @optional
|
|
667
|
+
*/
|
|
668
|
+
dom?: ThemeDomConfig;
|
|
572
669
|
}
|
|
573
670
|
|
|
574
671
|
/**
|
|
@@ -587,29 +684,14 @@ interface ThemeConfig {
|
|
|
587
684
|
* const isDarkTheme = theme === themes.dark;
|
|
588
685
|
* ```
|
|
589
686
|
*/
|
|
590
|
-
declare const themes: Record<Themes, Themes>;
|
|
687
|
+
declare const themes: Record<Themes$1, Themes$1>;
|
|
591
688
|
/**
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* This constant defines the prefix applied to HTML elements when the dark theme is active.
|
|
595
|
-
* It is typically added to the root element or specific components to enable dark theme styles.
|
|
596
|
-
*
|
|
597
|
-
* @example
|
|
598
|
-
* ```typescript
|
|
599
|
-
* document.body.classList.add(darkThemePrefix); // Applies 're-dark' class
|
|
600
|
-
* ```
|
|
689
|
+
* @deprecated Prefer `theme.dom.darkClassName` via `providePresentia(...)`.
|
|
601
690
|
*/
|
|
602
691
|
declare const darkThemePrefix = "re-dark";
|
|
603
692
|
|
|
604
693
|
/**
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
* Defines the initial theme settings for the application.
|
|
608
|
-
* By default, sets the light theme as the active theme.
|
|
609
|
-
*
|
|
610
|
-
* This configuration can be overridden when providing `THEME_CONFIG` token
|
|
611
|
-
* at the module or application level.
|
|
612
|
-
* ```
|
|
694
|
+
* @deprecated Prefer configuring themes through `providePresentia({ theme: ... })`.
|
|
613
695
|
*/
|
|
614
696
|
declare const defaultThemeConfig: {
|
|
615
697
|
defaultTheme: _reforgium_internal.Themes;
|
|
@@ -633,6 +715,23 @@ declare const defaultThemeConfig: {
|
|
|
633
715
|
*/
|
|
634
716
|
declare const THEME_CONFIG: InjectionToken<ThemeConfig>;
|
|
635
717
|
|
|
718
|
+
/**
|
|
719
|
+
* @deprecated Prefer configuring theme persistence through `providePresentia({ theme: { persistence... } })`.
|
|
720
|
+
*/
|
|
721
|
+
declare const defaultThemePersistenceAdapter: PersistenceAdapter;
|
|
722
|
+
/**
|
|
723
|
+
* DI token for the persistence adapter used by `ThemeService`
|
|
724
|
+
* to store and retrieve the selected theme (default key: `'theme'`).
|
|
725
|
+
*
|
|
726
|
+
* By default `presentia` provides a `localStorage`-backed adapter.
|
|
727
|
+
*
|
|
728
|
+
* Example:
|
|
729
|
+
* ```ts
|
|
730
|
+
* { provide: THEME_PERSISTENCE_ADAPTER, useValue: sessionStorageAdapter }
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
declare const THEME_PERSISTENCE_ADAPTER: InjectionToken<PersistenceAdapter>;
|
|
734
|
+
|
|
636
735
|
/**
|
|
637
736
|
* Service for managing application theme.
|
|
638
737
|
*
|
|
@@ -649,8 +748,15 @@ declare const THEME_CONFIG: InjectionToken<ThemeConfig>;
|
|
|
649
748
|
declare class ThemeService {
|
|
650
749
|
#private;
|
|
651
750
|
private readonly config;
|
|
751
|
+
private readonly registry;
|
|
652
752
|
private readonly themeDefault;
|
|
753
|
+
private readonly domStrategy;
|
|
653
754
|
private readonly darkPrefix;
|
|
755
|
+
private readonly attributeName;
|
|
756
|
+
private readonly themeClassPrefix;
|
|
757
|
+
private readonly classNameBuilder;
|
|
758
|
+
private readonly rootSelector;
|
|
759
|
+
private readonly persistence;
|
|
654
760
|
private readonly isBrowser;
|
|
655
761
|
private readonly document;
|
|
656
762
|
/**
|
|
@@ -662,12 +768,13 @@ declare class ThemeService {
|
|
|
662
768
|
* <div [class]="themeService.theme()"></div>
|
|
663
769
|
* ```
|
|
664
770
|
*/
|
|
665
|
-
theme:
|
|
771
|
+
theme: _angular_core.Signal<Theme>;
|
|
666
772
|
/**
|
|
667
773
|
* Convenient flag returning `true` if the light theme is active.
|
|
668
774
|
* Suitable for conditional style application or resource selection.
|
|
669
775
|
*/
|
|
670
|
-
isLight:
|
|
776
|
+
isLight: _angular_core.Signal<boolean>;
|
|
777
|
+
isDark: _angular_core.Signal<boolean>;
|
|
671
778
|
constructor();
|
|
672
779
|
/**
|
|
673
780
|
* Switches theme.
|
|
@@ -677,12 +784,25 @@ declare class ThemeService {
|
|
|
677
784
|
*
|
|
678
785
|
* @param theme — explicit theme value (`'light'` or `'dark'`).
|
|
679
786
|
*/
|
|
680
|
-
switch(theme?:
|
|
787
|
+
switch(theme?: Theme): void;
|
|
788
|
+
is(theme: Theme | readonly Theme[]): boolean;
|
|
681
789
|
private resolveTheme;
|
|
682
|
-
|
|
683
|
-
|
|
790
|
+
private resolveRegistry;
|
|
791
|
+
private resolveInitialTheme;
|
|
792
|
+
private getStoredTheme;
|
|
793
|
+
private persistTheme;
|
|
794
|
+
private applyThemeToDom;
|
|
795
|
+
private nextTheme;
|
|
796
|
+
private resolveRootElement;
|
|
797
|
+
private resolveThemeClassName;
|
|
798
|
+
private clearThemeClasses;
|
|
799
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThemeService, never>;
|
|
800
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ThemeService>;
|
|
684
801
|
}
|
|
685
802
|
|
|
803
|
+
/**
|
|
804
|
+
* @deprecated Prefer `PresentiaConfig` with `providePresentia(...)` for the grouped v2 API.
|
|
805
|
+
*/
|
|
686
806
|
interface AppConfig {
|
|
687
807
|
locale: LocaleConfig;
|
|
688
808
|
theme?: ThemeConfig;
|
|
@@ -690,8 +810,67 @@ interface AppConfig {
|
|
|
690
810
|
langPipe?: LangPipeConfig;
|
|
691
811
|
langMissingKeyHandler?: LangMissingKeyHandler;
|
|
692
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* @deprecated Prefer `providePresentia(...)` for new integrations.
|
|
815
|
+
*/
|
|
693
816
|
declare function provideReInit(config: AppConfig): EnvironmentProviders;
|
|
694
817
|
|
|
818
|
+
type PresentiaLangConfig = {
|
|
819
|
+
source: {
|
|
820
|
+
url: string;
|
|
821
|
+
fromAssets: boolean;
|
|
822
|
+
defaultLang?: Langs;
|
|
823
|
+
fallbackLang?: Langs;
|
|
824
|
+
supportedLangs?: readonly string[];
|
|
825
|
+
kgValue?: 'kg' | 'ky';
|
|
826
|
+
};
|
|
827
|
+
rendering?: {
|
|
828
|
+
placeholder?: string | ((query: string) => string);
|
|
829
|
+
missingValue?: string;
|
|
830
|
+
};
|
|
831
|
+
preload?: {
|
|
832
|
+
global?: readonly string[];
|
|
833
|
+
routes?: LangRouteNamespacePreloadConfig;
|
|
834
|
+
};
|
|
835
|
+
transport?: {
|
|
836
|
+
requestBuilder?: LangRequestBuilder;
|
|
837
|
+
requestOptionsFactory?: LangRequestOptionsFactory;
|
|
838
|
+
responseAdapter?: LangResponseAdapter;
|
|
839
|
+
batchRequestBuilder?: LangBatchRequestBuilder;
|
|
840
|
+
batchResponseAdapter?: LangBatchResponseAdapter;
|
|
841
|
+
maxBatchSize?: number;
|
|
842
|
+
};
|
|
843
|
+
cache?: LangNamespaceCacheConfig;
|
|
844
|
+
diagnostics?: {
|
|
845
|
+
lateNamespaceLoads?: boolean;
|
|
846
|
+
};
|
|
847
|
+
missingKeyHandler?: LangMissingKeyHandler;
|
|
848
|
+
};
|
|
849
|
+
type PresentiaThemeConfig = {
|
|
850
|
+
registry?: readonly Theme[];
|
|
851
|
+
defaultTheme?: ThemeConfig['defaultTheme'];
|
|
852
|
+
persistence?: 'localStorage' | 'none';
|
|
853
|
+
persistenceAdapter?: PersistenceAdapter;
|
|
854
|
+
dom?: {
|
|
855
|
+
strategy?: 'root-class' | 'data-attribute';
|
|
856
|
+
rootSelector?: string;
|
|
857
|
+
darkClassName?: string;
|
|
858
|
+
attributeName?: string;
|
|
859
|
+
classPrefix?: string;
|
|
860
|
+
classNameBuilder?: (theme: Theme) => string;
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
type PresentiaAdaptiveConfig = {
|
|
864
|
+
breakpoints?: DeviceBreakpoints;
|
|
865
|
+
strategy?: 'width';
|
|
866
|
+
};
|
|
867
|
+
interface PresentiaConfig {
|
|
868
|
+
lang: PresentiaLangConfig;
|
|
869
|
+
theme?: PresentiaThemeConfig;
|
|
870
|
+
adaptive?: PresentiaAdaptiveConfig;
|
|
871
|
+
}
|
|
872
|
+
declare function providePresentia(config: PresentiaConfig): EnvironmentProviders;
|
|
873
|
+
|
|
695
874
|
/**
|
|
696
875
|
* Open Graph meta tags type definition.
|
|
697
876
|
* Used for social media sharing preview configuration.
|
|
@@ -781,8 +960,8 @@ declare class SeoService {
|
|
|
781
960
|
setJsonLd(schema: object): void;
|
|
782
961
|
private upsert;
|
|
783
962
|
private upsertLink;
|
|
784
|
-
static ɵfac:
|
|
785
|
-
static ɵprov:
|
|
963
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SeoService, never>;
|
|
964
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SeoService>;
|
|
786
965
|
}
|
|
787
966
|
|
|
788
967
|
/**
|
|
@@ -806,7 +985,6 @@ declare class SeoService {
|
|
|
806
985
|
declare class SeoRouteListener {
|
|
807
986
|
private router;
|
|
808
987
|
private seo;
|
|
809
|
-
private ar;
|
|
810
988
|
private destroyRef;
|
|
811
989
|
private initialized;
|
|
812
990
|
private baseUrl;
|
|
@@ -818,60 +996,77 @@ declare class SeoRouteListener {
|
|
|
818
996
|
* Trailing slashes will be removed automatically.
|
|
819
997
|
*/
|
|
820
998
|
init(baseUrl: string): void;
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
* This is used to extract route data from the currently active leaf route.
|
|
824
|
-
*
|
|
825
|
-
* @param r - The root activated route to start traversing from.
|
|
826
|
-
* @returns The deepest child route in the hierarchy.
|
|
827
|
-
*/
|
|
828
|
-
private deepest;
|
|
829
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SeoRouteListener, never>;
|
|
830
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<SeoRouteListener>;
|
|
999
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SeoRouteListener, never>;
|
|
1000
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SeoRouteListener>;
|
|
831
1001
|
}
|
|
832
1002
|
|
|
1003
|
+
type RouteWatcherReadStrategy = 'deepest' | 'merged';
|
|
1004
|
+
|
|
1005
|
+
type RouteWatcherState = {
|
|
1006
|
+
params: Record<string, string>;
|
|
1007
|
+
deepestParams: Record<string, string>;
|
|
1008
|
+
query: Record<string, string>;
|
|
1009
|
+
data: Record<string, unknown>;
|
|
1010
|
+
mergedData: Record<string, unknown>;
|
|
1011
|
+
url: string;
|
|
1012
|
+
routePattern: string;
|
|
1013
|
+
fragment: string | null;
|
|
1014
|
+
};
|
|
833
1015
|
/**
|
|
834
1016
|
* Reactive snapshot of the current route (the deepest active route).
|
|
835
1017
|
* Updates on every `NavigationEnd` event.
|
|
836
|
-
*
|
|
837
|
-
* Provides:
|
|
838
|
-
* - `params` / `query` — strings (as in Angular Router)
|
|
839
|
-
* - `data` — arbitrary data (from route configuration/resolvers)
|
|
840
|
-
* - `url` — string assembled from `UrlSegment[]`
|
|
841
|
-
* - `fragment` — hash (#section)
|
|
842
|
-
* - `selectData(key)` — type-safe selector for `data`
|
|
843
|
-
* - `state` — combined computed object (convenient for single subscriber)
|
|
844
1018
|
*/
|
|
845
1019
|
declare class RouteWatcher {
|
|
846
1020
|
#private;
|
|
847
1021
|
private readonly router;
|
|
848
1022
|
private readonly destroyRef;
|
|
849
|
-
/**
|
|
850
|
-
readonly params:
|
|
851
|
-
/**
|
|
852
|
-
readonly
|
|
853
|
-
/**
|
|
854
|
-
readonly
|
|
855
|
-
/**
|
|
856
|
-
readonly
|
|
857
|
-
/**
|
|
858
|
-
readonly
|
|
859
|
-
/**
|
|
860
|
-
readonly
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
1023
|
+
/** Params merged from root to deepest route. */
|
|
1024
|
+
readonly params: _angular_core.Signal<Record<string, string>>;
|
|
1025
|
+
/** Params declared on the deepest route only. */
|
|
1026
|
+
readonly deepestParams: _angular_core.Signal<Record<string, string>>;
|
|
1027
|
+
/** Query params from the current navigation. */
|
|
1028
|
+
readonly query: _angular_core.Signal<Record<string, string>>;
|
|
1029
|
+
/** Deepest route data only. */
|
|
1030
|
+
readonly data: _angular_core.Signal<Record<string, unknown>>;
|
|
1031
|
+
/** Route data merged from root to deepest route. */
|
|
1032
|
+
readonly mergedData: _angular_core.Signal<Record<string, unknown>>;
|
|
1033
|
+
/** Full current url path assembled from root to deepest route. */
|
|
1034
|
+
readonly url: _angular_core.Signal<string>;
|
|
1035
|
+
/** Current route config pattern, e.g. `orgs/:orgId/users/:id`. */
|
|
1036
|
+
readonly routePattern: _angular_core.Signal<string>;
|
|
1037
|
+
/** Current url fragment without `#`. */
|
|
1038
|
+
readonly fragment: _angular_core.Signal<string | null>;
|
|
1039
|
+
/** Combined computed snapshot. */
|
|
1040
|
+
readonly state: _angular_core.Signal<RouteWatcherState>;
|
|
867
1041
|
constructor();
|
|
868
|
-
|
|
869
|
-
|
|
1042
|
+
selectData<T = unknown>(key: string, strategy?: RouteWatcherReadStrategy): _angular_core.Signal<T | undefined>;
|
|
1043
|
+
selectParam(key: string, strategy?: RouteWatcherReadStrategy): _angular_core.Signal<string | undefined>;
|
|
1044
|
+
matchesPath(path: string | RegExp): boolean;
|
|
870
1045
|
private deepestSnapshot;
|
|
871
|
-
static ɵfac:
|
|
872
|
-
static ɵprov:
|
|
1046
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RouteWatcher, never>;
|
|
1047
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<RouteWatcher>;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
declare const PRESENTIA_ROUTE_NAMESPACES_DATA_KEY = "presentiaNamespaces";
|
|
1051
|
+
declare function providePresentiaRouteNamespacePreload(): _angular_core.EnvironmentProviders;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* @deprecated Diagnostics are usually enabled through route preload config, not by consuming this service directly.
|
|
1055
|
+
*/
|
|
1056
|
+
declare class RouteNamespaceDiagnosticsService {
|
|
1057
|
+
private readonly router;
|
|
1058
|
+
private readonly enabled;
|
|
1059
|
+
private readonly warned;
|
|
1060
|
+
private currentUrl;
|
|
1061
|
+
private currentNamespaces;
|
|
1062
|
+
private navigationSettled;
|
|
1063
|
+
constructor();
|
|
1064
|
+
registerRouteNamespaces(url: string, namespaces: readonly string[]): void;
|
|
1065
|
+
warnLateNamespaceLoad(namespace: string): void;
|
|
1066
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RouteNamespaceDiagnosticsService, never>;
|
|
1067
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<RouteNamespaceDiagnosticsService>;
|
|
873
1068
|
}
|
|
874
1069
|
|
|
875
|
-
export { AdaptiveService, DEVICE_BREAKPOINTS, IfDeviceDirective, LANG_CONFIG, LANG_MISSING_KEY_HANDLER, LANG_PIPE_CONFIG, LangDirective, LangPipe, LangService, RouteWatcher, SeoRouteListener, SeoService, THEME_CONFIG, ThemeService, darkThemePrefix, defaultBreakpoints, defaultThemeConfig, innerLangVal, provideReInit, themes };
|
|
876
|
-
export type { AppConfig, DeviceBreakpoints, LangBatchRequestBuilder, LangBatchRequestContext, LangBatchResponseAdapter, LangBatchResponseContext, LangDirectiveConfig, LangDirectiveMode, LangDto, LangHttpRequestOptions, LangKey, LangKeyRegistry, LangMissingKeyHandler, LangModel, LangNamespaceCacheConfig, LangParamValue, LangParams, LangPipeConfig, LangRequestBuilder, LangRequestContext, LangRequestOptionsFactory, LangResponseAdapter, LangResponseContext, LocaleConfig, OgType, ThemeConfig, TwitterCardType };
|
|
1070
|
+
export { AdaptiveService, DEVICE_BREAKPOINTS, IfDeviceDirective, LANG_CONFIG, LANG_MISSING_KEY_HANDLER, LANG_PERSISTENCE_ADAPTER, LANG_PIPE_CONFIG, LangDirective, LangPipe, LangService, PRESENTIA_ROUTE_NAMESPACES_DATA_KEY, RouteNamespaceDiagnosticsService, RouteWatcher, SeoRouteListener, SeoService, THEME_CONFIG, THEME_PERSISTENCE_ADAPTER, ThemeService, darkThemePrefix, defaultBreakpoints, defaultThemeConfig, defaultThemePersistenceAdapter, innerLangVal, providePresentia, providePresentiaRouteNamespacePreload, provideReInit, themes };
|
|
1071
|
+
export type { AppConfig, BaseTheme, DeviceBreakpoints, LangBatchRequestBuilder, LangBatchRequestContext, LangBatchResponseAdapter, LangBatchResponseContext, LangDirectiveConfig, LangDirectiveMode, LangDto, LangHttpRequestOptions, LangKey, LangKeyRegistry, LangMissingKeyHandler, LangModel, LangNamespaceCacheConfig, LangParamValue, LangParams, LangPipeConfig, LangRequestBuilder, LangRequestContext, LangRequestOptionsFactory, LangResponseAdapter, LangResponseContext, LangRouteNamespaceManifest, LangRouteNamespacePreloadConfig, LangRouteNamespacePreloadMergeStrategy, LangRouteNamespacePreloadMode, LoadNamespaceError, LocaleConfig, OgType, PersistenceAdapter, PresentiaAdaptiveConfig, PresentiaConfig, PresentiaLangConfig, PresentiaThemeConfig, RouteWatcherReadStrategy, RouteWatcherState, Theme, ThemeConfig, Themes, TwitterCardType };
|
|
877
1072
|
//# sourceMappingURL=reforgium-presentia.d.ts.map
|