@luigi-project/core-modular 0.0.10-dev.202606300110 → 0.0.11-dev.20260710115

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.10-dev.202606300110"
21
+ "version": "0.0.11-dev.20260710115"
22
22
  }
@@ -134,5 +134,5 @@ export declare class RoutingService {
134
134
  * @param pathUrlRaw - path url without hash
135
135
  * @returns true if misconfiguration was detected and handled
136
136
  */
137
- handleViewUrlMisconfigured(node: Node, viewUrl: string, previousPathData: PathData, pathUrlRaw: string): Promise<boolean>;
137
+ handleViewUrlMisconfigured(node: Node, viewUrl: string, previousPathData: PathData | undefined, pathUrlRaw: string): Promise<boolean>;
138
138
  }
@@ -2,31 +2,293 @@ import { CoreAPISupportedElements } from './dom-elements';
2
2
  import { GlobalSearchHandler } from './global-search';
3
3
  import { AlertHandler, AlertSettings, ConfirmationModalHandler, ConfirmationModalSettings } from './ux';
4
4
  import { ModalSettings, LeftNavData, Node, TopNavData, TabNavData, BreadcrumbData, DrawerSettings, UserSettingsDialogSettings } from './navigation';
5
+ /**
6
+ * Integration contract between Luigi's core and a head (shell) implementation.
7
+ *
8
+ * A connector adapts Luigi's framework-agnostic core to a concrete UI technology
9
+ * (UI5 Web Components, Fiori, a custom design system, …). The head implements
10
+ * this interface and hands an instance to `LuigiEngine.bootstrap(connector)`.
11
+ *
12
+ * Core never queries the DOM directly: it asks the connector to render shell
13
+ * regions, mount micro-frontend containers, and surface alerts/modals/drawers.
14
+ * In return, core hands the connector either callbacks to invoke (for modal /
15
+ * drawer lifecycle) or handler objects (for alerts / confirmation modals) so
16
+ * the connector can report user-driven outcomes back.
17
+ */
5
18
  export interface LuigiConnector {
19
+ /**
20
+ * Build the shell chrome (header / side nav / content area / overlays).
21
+ *
22
+ * Called once during `UIModule.init`, before any other `render*` method.
23
+ * The connector should create the DOM slots that subsequent calls will
24
+ * populate (top nav, left nav, tab nav, breadcrumbs, container wrapper,
25
+ * alert and confirmation overlays) and should be idempotent — re-invoking
26
+ * it must not duplicate the layout.
27
+ */
6
28
  renderMainLayout(): void;
29
+ /**
30
+ * Render the top navigation (shellbar) from the supplied data.
31
+ *
32
+ * Called on initial route resolution and again whenever core's UI update
33
+ * touches scopes affecting the header (`settings`, `settings.header`,
34
+ * `navigation`, `navigation.profile`, `navigation.contextSwitcher`,
35
+ * `navigation.productSwitcher`). Treat the call as a full replace, not an
36
+ * append — the data describes the complete desired state.
37
+ *
38
+ * @param data complete top-nav state to render — title, logo, top-level
39
+ * nodes, profile, context/app/product switchers, optional global-search
40
+ * config. Any region present should be (re)rendered; absent fields mean
41
+ * "hide / remove that region".
42
+ */
7
43
  renderTopNav(data: TopNavData): void;
44
+ /**
45
+ * Render the left (side) navigation from the supplied data.
46
+ *
47
+ * Called on initial route resolution and on updates touching `navigation`,
48
+ * `navigation.nodes`, `navigation.viewgroupdata`, `settings`, or
49
+ * `settings.footer`. Full replace semantics — render `data.items` and
50
+ * highlight `data.selectedNode`; do not merge with previously rendered
51
+ * state.
52
+ *
53
+ * @param data items to render, the currently selected node to highlight,
54
+ * the base path for relative links, an optional footer text, and an
55
+ * optional `navClick` handler the connector may invoke on item click in
56
+ * place of native navigation.
57
+ */
8
58
  renderLeftNav(data: LeftNavData): void;
59
+ /**
60
+ * Return the element into which core appends micro-frontend containers
61
+ * (`luigi-container` / `luigi-compound-container`).
62
+ *
63
+ * Called frequently — on every navigation, by the auth layer, by the
64
+ * preloading service, and by container helpers. The element should already
65
+ * exist after `renderMainLayout()`; returning `null`/`undefined` will
66
+ * suppress mounting and is treated as "no container area available".
67
+ *
68
+ * @returns the content-area host element, or `null`/`undefined` if the
69
+ * shell has no mount point available yet.
70
+ */
9
71
  getContainerWrapper(): HTMLElement;
72
+ /**
73
+ * Render `content` (a `luigi-container` / `luigi-compound-container`) inside
74
+ * a modal dialog.
75
+ *
76
+ * `updateModalSettings` may be called between this method and close to
77
+ * mutate title / size in place.
78
+ *
79
+ * @param content the micro-frontend container element to mount inside the
80
+ * dialog. Already constructed by core; the connector only needs to
81
+ * append it to its modal DOM.
82
+ * @param modalSettings dialog presentation — size preset, explicit width /
83
+ * height, title, optional `keepPrevious` flag, test-id for the close
84
+ * button.
85
+ * @param onCloseCallback invoked by the connector **once the modal is fully
86
+ * closed** (after any dirty-state confirmation has resolved). Drives
87
+ * core's modal-stack cleanup and URL bookkeeping.
88
+ * @param onCloseRequest invoked by the connector **when the user requests
89
+ * close** (e.g. clicks the close button). Returns a `Promise<void>` that
90
+ * resolves once core has approved the close (dirty-state check passed,
91
+ * no unsaved-changes prompt outstanding). The connector should `await`
92
+ * this before tearing the modal down.
93
+ */
10
94
  renderModal(content: HTMLElement, modalSettings: ModalSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): void;
95
+ /**
96
+ * Render `content` inside a drawer (slide-in panel).
97
+ *
98
+ * @param content the micro-frontend container element to mount inside the
99
+ * drawer.
100
+ * @param drawerSettings drawer presentation — size, overlap mode, optional
101
+ * header, whether a backdrop is shown.
102
+ * @param onCloseCallback invoked by the connector once the drawer has
103
+ * closed. See {@link LuigiConnector.renderModal} for the lifecycle
104
+ * contract — drawer mirrors modal exactly.
105
+ * @param onCloseRequest invoked by the connector on user-driven close;
106
+ * awaiting the returned promise yields core's approval (dirty-status
107
+ * check).
108
+ */
11
109
  renderDrawer(content: HTMLElement, drawerSettings: DrawerSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): void;
110
+ /**
111
+ * Render the tab navigation row for the current node.
112
+ *
113
+ * Called alongside `renderLeftNav` whenever the relevant navigation scopes
114
+ * change. Full replace semantics.
115
+ *
116
+ * @param data tab items, the currently selected one, base path for
117
+ * relative links, and optional `navClick` handler.
118
+ */
12
119
  renderTabNav(data: TabNavData): void;
120
+ /**
121
+ * Render the breadcrumb trail for the current path.
122
+ *
123
+ * Called on navigation updates. The `BreadcrumbData` passed in may contain
124
+ * pending entries whose labels resolve asynchronously — in that case core
125
+ * calls `renderBreadcrumbs` a second time with the resolved data, so the
126
+ * connector should accept repeated invocations as a full replace.
127
+ *
128
+ * @param data breadcrumb items (each with optional `pending: true` until
129
+ * resolved), base path, selected node, and an optional custom renderer.
130
+ * `clearBeforeRender` indicates whether the connector should wipe
131
+ * existing breadcrumbs before rendering.
132
+ */
13
133
  renderBreadcrumbs(data: BreadcrumbData): void;
134
+ /**
135
+ * Surface an alert (toast / message strip) to the user.
136
+ *
137
+ * @param alertSettings what to display — text (may contain link tokens
138
+ * resolved via `links`), severity `type`, optional auto-close timeout,
139
+ * id, and link map.
140
+ * @param alertHandler connector → core channel for reporting the
141
+ * alert's outcome. Invoke `alertHandler.close()` when the alert is
142
+ * dismissed (auto-timeout or user action) and
143
+ * `alertHandler.link(linkKey)` when the user activates a link embedded
144
+ * in the text. `alertHandler.openFromClient` indicates whether the alert
145
+ * originated from a micro-frontend (used by core for routing of the
146
+ * outcome).
147
+ */
14
148
  renderAlert(alertSettings: AlertSettings, alertHandler: AlertHandler): void;
149
+ /**
150
+ * Surface a confirmation modal (yes/no dialog).
151
+ *
152
+ * Used both for app-level confirmations (`Luigi.ux().showConfirmationModal`)
153
+ * and for the dirty-state unsaved-changes flow — the connector does not
154
+ * need to distinguish.
155
+ *
156
+ * @param confirmationModalSettings header, body text, button labels,
157
+ * optional icon and semantic `type`.
158
+ * @param containerHandler connector → core channel. Invoke
159
+ * `containerHandler.confirm()` or `containerHandler.dismiss()` based on
160
+ * the user's choice; core handles the rest.
161
+ */
15
162
  renderConfirmationModal(confirmationModalSettings: ConfirmationModalSettings, containerHandler: ConfirmationModalHandler): void;
163
+ /**
164
+ * Set the browser document title.
165
+ *
166
+ * Called from `Luigi.ux().setDocumentTitle()` and on `SET_DOCUMENT_TITLE_REQUEST`
167
+ * from a micro-frontend. The connector typically forwards to
168
+ * `document.title`; it may additionally reflect the title in UI (e.g. an
169
+ * acknowledgement toast).
170
+ *
171
+ * @param documentTitle new title string.
172
+ */
16
173
  setDocumentTitle(documentTitle: string): void;
17
- getDocumentTitle(): string;
174
+ /**
175
+ * Show a loading indicator. Called during navigation, on
176
+ * `SHOW_LOADING_INDICATOR_REQUEST` from a client, and around modal/drawer
177
+ * open.
178
+ *
179
+ * @param container when provided, scope the indicator to this subtree
180
+ * (typically the parent of a micro-frontend container that is still
181
+ * handshaking). When omitted, fall back to a shell-wide busy indicator.
182
+ */
18
183
  showLoadingIndicator(container?: HTMLElement): void;
184
+ /**
185
+ * Hide a previously shown loading indicator. Called once a micro-frontend
186
+ * reports `INITIALIZED`, when navigation completes, and on
187
+ * `HIDE_LOADING_INDICATOR_REQUEST` from a client.
188
+ *
189
+ * @param container scoping rules match {@link LuigiConnector.showLoadingIndicator}.
190
+ */
19
191
  hideLoadingIndicator(container?: HTMLElement): void;
192
+ /**
193
+ * Show a page-level backdrop, typically dimming the main content while a
194
+ * micro-frontend displays its own overlay.
195
+ *
196
+ * Core does not refcount calls — it mirrors client `ADD_BACKDROP_REQUEST`
197
+ * events one-to-one. If a connector needs nesting semantics it must
198
+ * implement them itself.
199
+ */
20
200
  addBackdrop(): void;
201
+ /**
202
+ * Hide the page-level backdrop. Counterpart to `addBackdrop`; same
203
+ * no-refcount caveat applies.
204
+ */
21
205
  removeBackdrop(): void;
206
+ /**
207
+ * Open the user-settings dialog.
208
+ *
209
+ * Core invokes `dialogSettings.renderMicroFrontendContainer(viewUrl, groupKey)`
210
+ * (which it installs before calling this method) to mount per-group MFEs
211
+ * inside the dialog, and `dialogSettings.onCloseCallback(stored, previous)`
212
+ * when the dialog closes — the connector is responsible for calling both
213
+ * at the appropriate moments.
214
+ *
215
+ * @param dialogSettings dialog header, save/dismiss button labels, plus
216
+ * the two core-installed hooks (`renderMicroFrontendContainer`,
217
+ * `onCloseCallback`) the connector must invoke.
218
+ * @param userSettingData static schema describing the available
219
+ * user-settings groups (one entry per group).
220
+ * @param previousUserSettings persisted user-settings state to prefill
221
+ * the dialog with, or `null` on first open.
222
+ */
22
223
  openUserSettings(dialogSettings: UserSettingsDialogSettings, userSettingData: Record<string, any>[], previousUserSettings: Record<string, any> | null): void;
224
+ /**
225
+ * Close a user-settings dialog opened via `openUserSettings`.
226
+ * Called from `Luigi.ux().closeUserSettings()` and on
227
+ * `CLOSE_USER_SETTINGS_REQUEST` from a client.
228
+ */
23
229
  closeUserSettings(): void;
230
+ /**
231
+ * Notify the connector that Luigi's current locale changed.
232
+ *
233
+ * Push-only — heads typically use this to re-translate shell chrome or to
234
+ * reflect the change in their own UI.
235
+ *
236
+ * @param locale BCP-47 locale tag (e.g. `'en'`, `'de-DE'`).
237
+ */
24
238
  setCurrentLocale(locale: string): void;
25
- getCurrentLocale(): string;
239
+ /**
240
+ * Apply updated settings to the currently open modal (title, size, …).
241
+ *
242
+ * Called from `Luigi.ux().updateModalSettings()`, from client
243
+ * `UPDATE_MODAL_SETTINGS_REQUEST`, and from the routing service when
244
+ * modal-in-URL state changes. No-op if no modal is open (core guards
245
+ * before forwarding).
246
+ *
247
+ * @param modalSettings the **merged** result (existing settings ⊕
248
+ * updates) — apply as-is, do not attempt to diff against previous
249
+ * state.
250
+ */
26
251
  updateModalSettings(modalSettings: ModalSettings): void;
252
+ /**
253
+ * Display an unrecoverable error and halt further interaction.
254
+ *
255
+ * Currently invoked only for fatal config-loading failures
256
+ * (`config-helpers.ts → setErrorMessage`). Not a general runtime-error
257
+ * channel — those flow through `runTimeErrorHandler` on nodes.
258
+ *
259
+ * @param error human-readable error message to display.
260
+ */
27
261
  showFatalError(error: string): void;
262
+ /**
263
+ * Return a bag of getters for shell-owned DOM regions that micro-frontends
264
+ * can reach via `Luigi.elements()` (shellbar, shellbar actions, the Luigi
265
+ * container, the side-nav footer area).
266
+ *
267
+ * Each getter is invoked lazily on access, so the connector may resolve
268
+ * elements at call time rather than caching them at construction.
269
+ *
270
+ * @returns an object exposing one getter per supported shell region; each
271
+ * returns the element if present, or `null` if the region is not part
272
+ * of this head's layout.
273
+ */
28
274
  getCoreAPISupportedElements(): CoreAPISupportedElements;
275
+ /**
276
+ * Tear down all shell DOM and listeners created by the connector.
277
+ *
278
+ * Called from `Luigi.unload()`. After this, core may later call
279
+ * `renderMainLayout()` again on a fresh `Luigi.setConfig()` cycle, so the
280
+ * connector must leave itself in a state where re-bootstrapping works.
281
+ */
29
282
  unload(): void;
283
+ /**
284
+ * Return an imperative handle for driving the global-search UI, or omit
285
+ * this method entirely if the head does not surface global search. Core
286
+ * calls the returned handler in response to `Luigi.globalSearch().*` API
287
+ * calls and search-related navigation.
288
+ *
289
+ * @returns the global-search handler, or `undefined` if the head exposes
290
+ * no search UI at this moment.
291
+ */
30
292
  getGlobalSearchHandler?(): GlobalSearchHandler;
31
293
  }
32
294
  export type { Node };
@@ -148,7 +148,7 @@ export interface Node {
148
148
  };
149
149
  navigationContext?: string;
150
150
  onNodeActivation?: (node: Node) => boolean | void;
151
- openNodeInModal?: boolean;
151
+ openNodeInModal?: boolean | ModalSettings;
152
152
  pageErrorHandler?: PageErrorHandler;
153
153
  parent?: Node;
154
154
  pathSegment?: string;