@luigi-project/core-modular 0.0.7-dev.20260510109 → 0.0.7-dev.202605110108

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/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "micro-frontends",
19
19
  "microfrontends"
20
20
  ],
21
- "version": "0.0.7-dev.20260510109"
21
+ "version": "0.0.7-dev.202605110108"
22
22
  }
@@ -1,4 +1,6 @@
1
+ import { Luigi } from '../core-api/luigi';
1
2
  export declare class DirtyStatusService {
3
+ private luigi;
2
4
  unsavedChanges: {
3
5
  isDirty?: boolean;
4
6
  persistUrl?: string | null;
@@ -8,7 +10,7 @@ export declare class DirtyStatusService {
8
10
  * Initializes the `unsavedChanges` property with default values.
9
11
  * Sets `isDirty` to `false` and `persistUrl` to `null`, indicating that there are no unsaved changes initially.
10
12
  */
11
- constructor();
13
+ constructor(luigi: Luigi);
12
14
  /**
13
15
  * Updates the dirty status of a given source and manages the set of unsaved changes.
14
16
  *
@@ -38,4 +40,6 @@ export declare class DirtyStatusService {
38
40
  * @returns {boolean} `true` if there are unsaved changes, otherwise `false`.
39
41
  */
40
42
  readDirtyStatus(): boolean;
43
+ getUnsavedChangesModalPromise(source?: any): Promise<void>;
44
+ shouldShowUnsavedChangesModal(source?: any): boolean;
41
45
  }
@@ -49,4 +49,5 @@ export declare class ModalService {
49
49
  * Removes the last modal from the stack.
50
50
  */
51
51
  removeLastModalFromStack(): void;
52
+ closeModalsWithDirtyCheck(): Promise<boolean>;
52
53
  }
@@ -26,7 +26,7 @@ export declare class NavigationService {
26
26
  getTruncatedChildren(children: Node[]): Node[];
27
27
  applyNavGroups(items: NavItem[]): NavItem[];
28
28
  getLeftNavData(path: string, pData?: PathData): Promise<LeftNavData>;
29
- navItemClick(node: Node, pathData?: PathData): void;
29
+ navItemClick(node: Node, pathData?: PathData): Promise<void>;
30
30
  getTopNavData(path: string, pData?: PathData): Promise<TopNavData>;
31
31
  getParentNode(node: Node | undefined, pathData: PathData): Node | undefined;
32
32
  getAppSwitcherData(appSwitcherData: AppSwitcher, headerSettings: any): AppSwitcher | undefined;
@@ -0,0 +1,58 @@
1
+ import { Luigi } from '../core-api/luigi';
2
+ import { ViewGroupSettings } from '../types/navigation';
3
+ /**
4
+ * Service responsible for preloading view group containers in the background.
5
+ *
6
+ * Preloading creates hidden luigi-container elements for configured view groups
7
+ * so that navigating to those groups later is near-instant (the MFE is already initialized).
8
+ * The service adapts its batch size dynamically based on observed MFE load times.
9
+ */
10
+ export declare class PreloadingService {
11
+ private luigi;
12
+ private preloadBatchSize;
13
+ shouldPreload: boolean;
14
+ constructor(luigi: Luigi);
15
+ /**
16
+ * Preloads view group containers based on the `navigation.viewGroupSettings` configuration.
17
+ * Skips view groups that already have a container in the DOM or are currently being preloaded.
18
+ *
19
+ * @param batchSize - Maximum number of view groups to preload in this cycle (default: 3).
20
+ * @param backgroundMfeOnly - If true, only preloads view groups with `loadOnStartup: true`.
21
+ * Used during application init to load critical MFEs without competing with the main navigation.
22
+ */
23
+ preloadViewGroups(batchSize?: number, backgroundMfeOnly?: boolean): void;
24
+ /**
25
+ * Creates a hidden luigi-container for the given view group and appends it to the DOM.
26
+ * The container loads the `preloadUrl` MFE in the background with `display: none`.
27
+ *
28
+ * @param settings - The view group settings containing the preloadUrl.
29
+ * @param name - The view group name (used as identifier on the container).
30
+ * @param containerWrapper - The DOM element to append the hidden container to.
31
+ */
32
+ preloadContainerOnBackground(settings: ViewGroupSettings, name: string, containerWrapper: HTMLElement): void;
33
+ /**
34
+ * Schedules a preload cycle. Uses a flag-based mechanism to skip the very first invocation
35
+ * and only trigger preloading from the second call onwards.
36
+ *
37
+ * @param backgroundMfeOnly - If true, only `loadOnStartup` view groups are preloaded.
38
+ * Passed through to `preloadViewGroups`.
39
+ */
40
+ preload(backgroundMfeOnly?: boolean): void;
41
+ /**
42
+ * Called when a preloaded container has finished initializing (INITIALIZED event).
43
+ * Measures load time and adapts the batch size for subsequent preload cycles:
44
+ * - < 500ms → batchSize 3 (fast connection)
45
+ * - 500–1000ms → batchSize 2
46
+ * - > 1000ms → batchSize 1 (slow, be conservative)
47
+ *
48
+ * Also schedules clearing the `_luigiPreloading` flag after a short delay,
49
+ * freeing the container for the next preload cycle.
50
+ *
51
+ * @param container - The container element that finished loading.
52
+ */
53
+ viewGroupLoaded(container: any): void;
54
+ /**
55
+ * Returns all containers in the wrapper that are currently in a preloading state.
56
+ */
57
+ private getPreloadingContainers;
58
+ }
@@ -2,9 +2,11 @@ import { Luigi } from '../core-api/luigi';
2
2
  import { Route } from '../types/routing';
3
3
  import { ModalSettings, Node, PathData } from '../types/navigation';
4
4
  import { NavigationService } from './navigation.service';
5
+ import { DirtyStatusService } from './dirty-status.service';
5
6
  export declare class RoutingService {
6
7
  private luigi;
7
8
  navigationService?: NavigationService;
9
+ dirtyStatusService?: DirtyStatusService;
8
10
  previousNode: Node | undefined;
9
11
  currentRoute?: Route;
10
12
  modalSettings?: ModalSettings;
@@ -6,7 +6,7 @@ export interface LuigiConnector {
6
6
  renderLeftNav(data: LeftNavData): void;
7
7
  getContainerWrapper(): HTMLElement;
8
8
  renderModal(content: HTMLElement, modalSettings: ModalSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): any;
9
- renderDrawer(content: HTMLElement, modalSettings: DrawerSettings, onCloseCallback?: () => void): any;
9
+ renderDrawer(content: HTMLElement, drawerSettings: DrawerSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): any;
10
10
  renderTabNav(data: TabNavData): void;
11
11
  renderBreadcrumbs(data: BreadcrumbData): void;
12
12
  renderAlert(alertSettings: AlertSettings, alertHandler: AlertHandler): void;
@@ -5,7 +5,7 @@ export interface TopNavData {
5
5
  productSwitcher?: ProductSwitcher;
6
6
  profile?: ProfileSettings;
7
7
  appSwitcher?: AppSwitcher;
8
- navClick?: (item: NavItem) => void;
8
+ navClick?: (item: NavItem) => Promise<void>;
9
9
  }
10
10
  export interface AppSwitcher {
11
11
  showMainAppEntry?: boolean;
@@ -63,7 +63,7 @@ export interface LeftNavData {
63
63
  items: NavItem[];
64
64
  basePath: string;
65
65
  sideNavFooterText?: string;
66
- navClick?: (item: NavItem) => void;
66
+ navClick?: (item: NavItem) => Promise<void>;
67
67
  }
68
68
  export interface PathData {
69
69
  context?: Record<string, any>;
@@ -168,7 +168,7 @@ export interface TabNavData {
168
168
  selectedNode?: any;
169
169
  items?: NavItem[];
170
170
  basePath?: string;
171
- navClick?: (item: NavItem) => void;
171
+ navClick?: (item: NavItem) => Promise<void>;
172
172
  }
173
173
  export interface BreadcrumbData {
174
174
  basePath?: string;
@@ -465,4 +465,8 @@ export interface TitleResolver {
465
465
  /** @internal runtime cache – not user-configured */
466
466
  _cache?: TitleResolverCache;
467
467
  }
468
+ export interface ViewGroupSettings {
469
+ preloadUrl?: string;
470
+ loadOnStartup?: boolean;
471
+ }
468
472
  export type HistoryMethod = 'pushState' | 'replaceState';