@linagora/linid-im-front-corelib 0.0.81 → 0.0.83
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/dist/core-lib.es.js +28250 -29127
- package/dist/core-lib.umd.js +85 -83
- package/dist/package.json +23 -23
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types/src/composables/useScopedI18n.d.ts +28 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/services/i18nService.d.ts +15 -2
- package/dist/types/src/stores/linidUiStore.d.ts +17 -0
- package/package.json +22 -22
|
@@ -20,7 +20,7 @@ export declare function useScopedI18n(scope: string): {
|
|
|
20
20
|
* @param key - Translation key (string or number) relative to the scoped namespace.
|
|
21
21
|
* @returns `true` if the key exists, `false` otherwise.
|
|
22
22
|
*/
|
|
23
|
-
te: (key: string |
|
|
23
|
+
te: (key: string, locale?: string | undefined) => boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Retrieves the raw translation message for a scoped key without formatting.
|
|
26
26
|
* @param key - Translation key (string or number) relative to the scoped namespace.
|
|
@@ -35,3 +35,30 @@ export declare function useScopedI18n(scope: string): {
|
|
|
35
35
|
*/
|
|
36
36
|
translateOrDefault: (defaultValue: string, ...args: unknown[]) => ReturnType<ComposerTranslation>;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the effective locale to apply, without any side effect.
|
|
40
|
+
*
|
|
41
|
+
* The locale is resolved by priority: the stored user preference first, then the locally persisted language.
|
|
42
|
+
* If neither the stored preference nor the localStorage value is a supported language, the UI store locale is used as the fallback.
|
|
43
|
+
* @returns The locale code the caller should apply to its i18n target.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveLocale(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Synchronises the persisted state with the given locale.
|
|
48
|
+
*
|
|
49
|
+
* The locale is always written to localStorage. The server-side user preference is updated only when it differs from
|
|
50
|
+
* the currently stored one.
|
|
51
|
+
* @param locale - The locale to persist.
|
|
52
|
+
* @returns A promise that resolves once the persisted state has been synchronised.
|
|
53
|
+
*/
|
|
54
|
+
export declare function syncLocale(locale: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Applies the given locale to the application and persists the choice.
|
|
57
|
+
*
|
|
58
|
+
* Updates the active i18n locale, reflects it in the UI store, and synchronises the persisted state. This assumes the
|
|
59
|
+
* shared i18n instance runs in Composition mode (legacy: false), as guaranteed by the corelib LinidI18n convention;
|
|
60
|
+
* on a legacy instance the locale assignment would be a silent no-op at runtime.
|
|
61
|
+
* @param locale - The locale code to apply (e.g. "fr-FR").
|
|
62
|
+
* @returns A promise that resolves once the locale has been applied and persisted.
|
|
63
|
+
*/
|
|
64
|
+
export declare function changeLocale(locale: string): Promise<void>;
|
|
@@ -8,7 +8,7 @@ export { usePagination } from './composables/usePagination';
|
|
|
8
8
|
export { QDATE_DEFAULT_MASK, useQuasarDate } from './composables/useQuasarDate';
|
|
9
9
|
export { useQuasarFieldValidation } from './composables/useQuasarFieldValidation';
|
|
10
10
|
export { useQuasarRules } from './composables/useQuasarRules';
|
|
11
|
-
export { useScopedI18n } from './composables/useScopedI18n';
|
|
11
|
+
export { changeLocale, resolveLocale, syncLocale, useScopedI18n, } from './composables/useScopedI18n';
|
|
12
12
|
export { useTree } from './composables/useTree';
|
|
13
13
|
export { useUiDesign } from './composables/useUiDesign';
|
|
14
14
|
export { useLinidFilterUrl } from './composables/useLinidFilterUrl';
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { type I18n } from 'vue-i18n';
|
|
2
|
+
/**
|
|
3
|
+
* Type alias for the shared LinID i18n instance.
|
|
4
|
+
*
|
|
5
|
+
* This type represents the Vue I18n instance used across all LinID modules.
|
|
6
|
+
* The instance is configured in Composition API mode (`legacy: false`) and
|
|
7
|
+
* exposes the global composer API for translations.
|
|
8
|
+
*
|
|
9
|
+
* Using a dedicated alias prevents consumers from falling back to the default
|
|
10
|
+
* `I18n` generic parameters, which may expose both legacy and composition
|
|
11
|
+
* translation signatures and cause TypeScript overload conflicts.
|
|
12
|
+
*/
|
|
13
|
+
type LinidI18n = I18n<Record<string, never>, Record<string, never>>;
|
|
2
14
|
/**
|
|
3
15
|
* Initializes the shared i18n instance.
|
|
4
16
|
* Should be called once by the host application during boot.
|
|
5
17
|
* @param instance - The i18n instance to use as the shared store.
|
|
6
18
|
*/
|
|
7
|
-
export declare function setI18nInstance(instance:
|
|
19
|
+
export declare function setI18nInstance(instance: LinidI18n): void;
|
|
8
20
|
/**
|
|
9
21
|
* Returns the shared i18n instance.
|
|
10
22
|
* Must be called after initialization via `setI18nInstance()`.
|
|
11
23
|
* @returns The shared i18n instance.
|
|
12
24
|
*/
|
|
13
|
-
export declare function getI18nInstance():
|
|
25
|
+
export declare function getI18nInstance(): LinidI18n;
|
|
26
|
+
export {};
|
|
@@ -5,6 +5,13 @@ import type { NavigationMenuItem } from '../types/linidUi';
|
|
|
5
5
|
interface LinidUiState {
|
|
6
6
|
/** List of main navigation menu items. */
|
|
7
7
|
mainNavigationItems: NavigationMenuItem[];
|
|
8
|
+
/** Internationalization state: active locale and available languages. */
|
|
9
|
+
i18n: {
|
|
10
|
+
/** Currently active locale code (e.g. "fr-FR"). */
|
|
11
|
+
locale: string;
|
|
12
|
+
/** List of available locale codes declared in the configuration. */
|
|
13
|
+
languages: string[];
|
|
14
|
+
};
|
|
8
15
|
}
|
|
9
16
|
/**
|
|
10
17
|
* Returns the Linid UI Store instance.
|
|
@@ -16,5 +23,15 @@ export declare const useLinidUiStore: () => import("pinia").Store<"LinidUiStore"
|
|
|
16
23
|
* @param items - The navigation menu items to add.
|
|
17
24
|
*/
|
|
18
25
|
addMainNavigationMenuItems(...items: NavigationMenuItem[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the list of available locale codes.
|
|
28
|
+
* @param languages - The available locale codes (e.g. ["fr-FR", "en-US"]).
|
|
29
|
+
*/
|
|
30
|
+
setAvailableLanguages(languages: string[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the active locale code.
|
|
33
|
+
* @param locale - The locale code to activate (e.g. "fr-FR").
|
|
34
|
+
*/
|
|
35
|
+
setLocale(locale: string): void;
|
|
19
36
|
}>;
|
|
20
37
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linagora/linid-im-front-corelib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"description": "Core library of the LinID Identity Manager project. Provides shared types, services, components, and utilities for front-end and plugin, enabling consistent integration across the LinID ecosystem.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -47,39 +47,39 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/linagora/linid-im-front-corelib#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@module-federation/enhanced": "2.
|
|
51
|
-
"axios": "1.
|
|
52
|
-
"dayjs": "1.11.
|
|
50
|
+
"@module-federation/enhanced": "2.7.0",
|
|
51
|
+
"axios": "1.18.1",
|
|
52
|
+
"dayjs": "1.11.21",
|
|
53
53
|
"pinia": "3.0.4",
|
|
54
|
-
"quasar": "2.
|
|
54
|
+
"quasar": "2.21.1",
|
|
55
55
|
"rxjs": "7.8.2",
|
|
56
|
-
"vue": "3.5.
|
|
57
|
-
"vue-i18n": "11.
|
|
58
|
-
"vue-router": "5.0
|
|
56
|
+
"vue": "3.5.39",
|
|
57
|
+
"vue-i18n": "11.4.6",
|
|
58
|
+
"vue-router": "5.1.0",
|
|
59
59
|
"interactjs": "1.10.27"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@eslint/js": "10.0.1",
|
|
63
|
-
"@types/node": "
|
|
63
|
+
"@types/node": "26.1.1",
|
|
64
64
|
"@types/nunjucks": "3.2.6",
|
|
65
|
-
"@vitejs/plugin-vue": "6.0.
|
|
66
|
-
"@vitest/coverage-v8": "4.
|
|
65
|
+
"@vitejs/plugin-vue": "6.0.7",
|
|
66
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
67
67
|
"@vue/eslint-config-prettier": "10.2.0",
|
|
68
|
-
"@vue/eslint-config-typescript": "14.
|
|
69
|
-
"@vue/test-utils": "2.4.
|
|
70
|
-
"eslint": "10.0
|
|
68
|
+
"@vue/eslint-config-typescript": "14.9.0",
|
|
69
|
+
"@vue/test-utils": "2.4.11",
|
|
70
|
+
"eslint": "10.6.0",
|
|
71
71
|
"eslint-plugin-headers": "1.3.4",
|
|
72
72
|
"eslint-plugin-import": "2.32.0",
|
|
73
|
-
"eslint-plugin-jsdoc": "
|
|
74
|
-
"eslint-plugin-vue": "10.
|
|
75
|
-
"happy-dom": "20.
|
|
73
|
+
"eslint-plugin-jsdoc": "63.0.12",
|
|
74
|
+
"eslint-plugin-vue": "10.9.2",
|
|
75
|
+
"happy-dom": "20.10.6",
|
|
76
76
|
"oidc-client-ts": "3.5.0",
|
|
77
|
-
"prettier": "3.
|
|
78
|
-
"typescript": "
|
|
79
|
-
"vite": "
|
|
77
|
+
"prettier": "3.9.4",
|
|
78
|
+
"typescript": "6.0.3",
|
|
79
|
+
"vite": "8.1.3",
|
|
80
80
|
"vite-tsconfig-paths": "6.1.1",
|
|
81
|
-
"vitest": "4.
|
|
82
|
-
"vue-tsc": "3.
|
|
81
|
+
"vitest": "4.1.10",
|
|
82
|
+
"vue-tsc": "3.3.7"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly -p tsconfig.lib.json",
|