@linagora/linid-im-front-corelib 0.0.82 → 0.0.84

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.
@@ -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';
@@ -35,7 +35,7 @@ export { LinidFilterSet } from './filters/linidFilterSet';
35
35
  export { LinidFilterValue } from './filters/linidFilterValue';
36
36
  export { LINID_FILTER_NEGATION_PREFIX, LINID_FILTER_OR_SEPARATOR, } from './types/linidFilter';
37
37
  export type { LinidFilterSetUserPreference } from './types/linidFilter';
38
- export type { LinidZoneEntry } from './types/linidZone';
38
+ export type { BaseLinidZoneEntry, ComponentLinidZoneEntry, FederatedLinidZoneEntry, LinidZoneEntry, LinidZoneResolvedEntry, } from './types/linidZone';
39
39
  export type { LinidRoute, LinidRoutes } from './types/linidRoute';
40
40
  export type { Page, Pagination, QTableRequestEvent, QuasarPagination, QueryFilter, } from './types/page';
41
41
  export type { AttributeInputType, LinidApiEndpointConfiguration, LinidAttributeConfiguration, LinidEntityConfiguration, } from './types/linidConfiguration';
@@ -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 {};
@@ -1,3 +1,4 @@
1
+ import type { Component } from 'vue';
1
2
  import type { LinidZoneEntry } from '../types/linidZone';
2
3
  /**
3
4
  * State interface for the Linid Zone Store.
@@ -12,17 +13,37 @@ interface LinidZoneState {
12
13
  */
13
14
  export declare const useLinidZoneStore: () => import("pinia").Store<"linidZoneStore", LinidZoneState, {}, {
14
15
  /**
15
- * Register a new entry in a specified zone.
16
+ * Append an entry to a specified zone, creating the zone if needed.
17
+ *
18
+ * Internal helper backing the public `register*` actions.
16
19
  * @param zone - The name of the zone.
17
- * @param entry - The entry to register.
20
+ * @param entry - The entry to append.
18
21
  */
19
- register(zone: string, entry: LinidZoneEntry): void;
22
+ appendEntry(zone: string, entry: LinidZoneEntry): void;
20
23
  /**
21
- * Register a new entry only if the plugin
24
+ * Register a federated plugin component in a specified zone.
25
+ * @param zone - The name of the zone.
26
+ * @param plugin - The plugin identifier of the remote component to load.
27
+ * @param props - Optional props passed to the rendered component.
28
+ */
29
+ registerPlugin(zone: string, plugin: string, props?: Record<string, unknown>): void;
30
+ /**
31
+ * Register a federated plugin component only if the plugin
22
32
  * is not already registered in the zone.
23
33
  * @param zone - The name of the zone.
24
- * @param entry - The entry to register.
34
+ * @param plugin - The plugin identifier of the remote component to load.
35
+ * @param props - Optional props passed to the rendered component.
36
+ */
37
+ registerPluginOnce(zone: string, plugin: string, props?: Record<string, unknown>): void;
38
+ /**
39
+ * Register a Vue component directly in a specified zone.
40
+ *
41
+ * The component is stored with `markRaw` to keep it out of the
42
+ * reactivity system, as Vue components must not be reactive.
43
+ * @param zone - The name of the zone.
44
+ * @param component - The Vue component to render as-is.
45
+ * @param props - Optional props passed to the rendered component.
25
46
  */
26
- registerOnce(zone: string, entry: LinidZoneEntry): void;
47
+ registerComponent(zone: string, component: Component, props?: Record<string, unknown>): void;
27
48
  }>;
28
49
  export {};
@@ -1,21 +1,68 @@
1
+ import type { Component } from 'vue';
1
2
  /**
2
- * Represents a single entry registered within a Linid Zone.
3
- *
4
- * Each entry corresponds to a component provided by a plugin,
5
- * and can optionally define props to configure that component.
3
+ * Base model shared by all zone entry variants.
4
+ */
5
+ export interface BaseLinidZoneEntry {
6
+ /**
7
+ * Optional props to be passed to the rendered component.
8
+ *
9
+ * The keys are prop names, and the values are Vue components or objects
10
+ * compatible with Vue’s component system.
11
+ */
12
+ props?: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * Zone entry referencing a component loaded through module federation.
6
16
  */
7
- export interface LinidZoneEntry {
17
+ export interface FederatedLinidZoneEntry extends BaseLinidZoneEntry {
18
+ /** Discriminant of the federated variant. */
19
+ type: 'federated';
8
20
  /**
9
21
  * The unique plugin identifier that registered this entry.
10
22
  *
11
23
  * Typically corresponds to the plugin name or package name.
12
24
  */
13
25
  plugin: string;
26
+ }
27
+ /**
28
+ * Zone entry providing a Vue component directly.
29
+ *
30
+ * Unlike federated entries, no module federation loading is involved:
31
+ * the component is rendered as-is.
32
+ */
33
+ export interface ComponentLinidZoneEntry extends BaseLinidZoneEntry {
34
+ /** Discriminant of the component variant. */
35
+ type: 'component';
14
36
  /**
15
- * Optional props to be passed to the rendered component.
37
+ * The Vue component to render directly.
38
+ */
39
+ component: Component;
40
+ }
41
+ /**
42
+ * Represents a single entry registered within a Linid Zone.
43
+ *
44
+ * An entry provides its component either through a federated plugin
45
+ * identifier ({@link FederatedLinidZoneEntry}) or as a Vue component
46
+ * given directly ({@link ComponentLinidZoneEntry}), and can optionally
47
+ * define props to configure that component.
48
+ */
49
+ export type LinidZoneEntry = FederatedLinidZoneEntry | ComponentLinidZoneEntry;
50
+ /**
51
+ * A zone entry resolved for rendering by `LinidZoneRenderer`.
52
+ *
53
+ * Whatever the entry variant, the resolved form always carries the
54
+ * component to render.
55
+ */
56
+ export interface LinidZoneResolvedEntry {
57
+ /**
58
+ * The component to render.
16
59
  *
17
- * The keys are prop names, and the values are Vue components or objects
18
- * compatible with Vue’s component system.
60
+ * Either the async component loaded from the federated plugin,
61
+ * or the Vue component provided directly by the entry.
62
+ */
63
+ component: Component;
64
+ /**
65
+ * Optional props to be passed to the rendered component.
19
66
  */
20
67
  props?: Record<string, unknown>;
21
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linagora/linid-im-front-corelib",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
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": [