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

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.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Top-level `globalSearch` section of the Luigi configuration.
3
+ *
4
+ * See https://docs.luigi-project.io/docs/navigation-parameters-reference?section=global-search.
5
+ */
6
+ export interface GlobalSearch {
7
+ /**
8
+ * Disables Luigi's internal keyup/etc. handlers on the search input field.
9
+ * When `true`, a `searchProvider` must be defined to attach custom logic.
10
+ */
11
+ disableInputHandlers?: boolean;
12
+ /**
13
+ * Label for the cancel button shown next to the search field on small viewports
14
+ * in centered mode. Only used when `searchFieldCentered` is active. Defaults to
15
+ * `'Cancel'`.
16
+ */
17
+ globalSearchCenteredCancelButton?: string;
18
+ /**
19
+ * Render the search input in the center of the shellbar instead of inline.
20
+ */
21
+ searchFieldCentered?: boolean;
22
+ /**
23
+ * Provider object carrying the renderers and event callbacks Luigi invokes
24
+ * during search interaction.
25
+ */
26
+ searchProvider?: GlobalSearchProvider;
27
+ }
28
+ export interface GlobalSearchProvider {
29
+ customSearchResultItemRenderer?: (searchResultItem: any, slot: HTMLLIElement, searchApiObj: any) => object;
30
+ customSearchResultRenderer?: (searchResults: any[], slot: HTMLDivElement, searchApiObj: any) => object;
31
+ /**
32
+ * Placeholder text for the search input. May be a plain string, a function
33
+ * returning a string, or a locale-keyed map (`{ en: '...', de: '...' }`).
34
+ */
35
+ inputPlaceholder?: string | (() => string) | Record<string, string>;
36
+ onEnter?: () => void;
37
+ onEscape?: () => void;
38
+ onInput?: () => void;
39
+ onSearchBtnClick?: () => void;
40
+ onSearchResultItemSelected?: (searchResultItem: any) => void;
41
+ toggleSearch?: (element: HTMLInputElement, visible: boolean) => void;
42
+ }
43
+ export interface SearchResultItem {
44
+ description: string;
45
+ label: string;
46
+ pathObject: Record<string, any>;
47
+ }
48
+ /**
49
+ * Imperative global-search surface exposed by a Luigi connector.
50
+ *
51
+ * The connector returns this handler from `getGlobalSearchHandler()`; if the
52
+ * connector does not implement global search, it may omit `getGlobalSearchHandler`
53
+ * entirely.
54
+ */
55
+ export interface GlobalSearchHandler {
56
+ openSearchField(): void;
57
+ closeSearchField(): void;
58
+ clearSearchField(): void;
59
+ showSearchResult(searchResultItems: SearchResultItem[], searchQuery: string, isCentered: boolean, onShowCallback: (rendererSlot?: any) => void): void;
60
+ closeSearchResult(): void;
61
+ setSearchString(searchString: string, onSetCallback: (inputElem?: HTMLInputElement) => void): void;
62
+ setSearchInputPlaceholder(placeholder: string): void;
63
+ toggleSearch(isSearchFieldVisible: boolean, onToggleCallback: (inputElem?: HTMLInputElement) => void): void;
64
+ }
@@ -1,12 +1,16 @@
1
+ import { GlobalSearch } from './global-search';
2
+ import { CompoundConfig } from './compound-config';
1
3
  export interface TopNavData {
2
4
  appSwitcher?: AppSwitcher;
3
5
  appTitle: string;
4
6
  contextSwitcher?: ContextSwitcher;
7
+ globalSearch?: GlobalSearch;
5
8
  logo: string;
6
9
  navClick?: (item: NavItem) => Promise<void>;
7
10
  productSwitcher?: ProductSwitcher;
8
11
  profile?: ProfileSettings;
9
12
  topNodes: NavItem[];
13
+ totalBadgeNode?: BadgeCounter;
10
14
  }
11
15
  export interface AppSwitcher {
12
16
  showMainAppEntry?: boolean;
@@ -97,6 +101,7 @@ export interface LeftNavData {
97
101
  items: NavItem[];
98
102
  basePath: string;
99
103
  sideNavFooterText?: string;
104
+ totalBadgeNode?: BadgeCounter;
100
105
  navClick?: (item: NavItem) => Promise<void>;
101
106
  }
102
107
  export interface PathData {
@@ -111,13 +116,14 @@ export interface PathData {
111
116
  export interface RootNode {
112
117
  node: Node;
113
118
  }
119
+ export interface BadgeCounter {
120
+ count?: () => number | Promise<number>;
121
+ label?: string;
122
+ }
114
123
  export interface Node {
115
124
  altText?: string;
116
125
  anonymousAccess?: any;
117
- badgeCounter?: {
118
- count?: () => number | Promise<number>;
119
- label?: string;
120
- };
126
+ badgeCounter?: BadgeCounter;
121
127
  category?: any;
122
128
  children?: Node[];
123
129
  clientPermissions?: {
@@ -142,7 +148,7 @@ export interface Node {
142
148
  };
143
149
  navigationContext?: string;
144
150
  onNodeActivation?: (node: Node) => boolean | void;
145
- openNodeInModal?: boolean;
151
+ openNodeInModal?: boolean | ModalSettings;
146
152
  pageErrorHandler?: PageErrorHandler;
147
153
  parent?: Node;
148
154
  pathSegment?: string;
@@ -195,6 +201,7 @@ export interface BreadcrumbItem {
195
201
  }
196
202
  export interface NavItem {
197
203
  altText?: string;
204
+ badgeCounter?: BadgeCounter;
198
205
  category?: Category;
199
206
  externalLink?: ExternalLink;
200
207
  href?: string;
@@ -205,10 +212,11 @@ export interface NavItem {
205
212
  tooltip?: string;
206
213
  }
207
214
  export interface TabNavData {
208
- selectedNode?: any;
209
- items?: NavItem[];
210
215
  basePath?: string;
216
+ items?: NavItem[];
211
217
  navClick?: (item: NavItem) => Promise<void>;
218
+ selectedNode?: any;
219
+ totalBadgeNode?: BadgeCounter;
212
220
  }
213
221
  export interface BreadcrumbData {
214
222
  basePath?: string;
@@ -217,9 +225,12 @@ export interface BreadcrumbData {
217
225
  renderer?: any;
218
226
  selectedNode?: Node;
219
227
  }
228
+ export interface DrawerHeader {
229
+ title: string;
230
+ }
220
231
  export interface DrawerSettings {
221
232
  backdrop?: boolean;
222
- header?: any;
233
+ header?: DrawerHeader;
223
234
  overlap?: boolean;
224
235
  size?: 'l' | 'm' | 's' | 'xs';
225
236
  }
@@ -255,11 +266,11 @@ export interface ExternalLink {
255
266
  sameWindow?: boolean;
256
267
  }
257
268
  export interface NavigationOptions {
258
- fromContext?: any;
269
+ fromContext?: string | null;
259
270
  fromClosestContext?: boolean;
260
271
  fromVirtualTreeRoot?: boolean;
261
272
  fromParent?: boolean;
262
- relative?: any;
273
+ relative?: boolean;
263
274
  nodeParams?: Record<string, any>;
264
275
  }
265
276
  export interface NavigationRequestBase {
@@ -290,216 +301,13 @@ export interface NavigationRequestDetail {
290
301
  preventContextUpdate: boolean;
291
302
  preventHistoryEntry: boolean;
292
303
  fromVirtualTreeRoot: boolean;
293
- fromContext: boolean;
304
+ fromContext: string | null;
294
305
  fromClosestContext: boolean;
295
306
  fromParent: boolean;
296
307
  relative: boolean;
297
308
  nodeParams: Record<string, string>;
298
309
  }
299
- /**
300
- * Configuration for compound web components in Luigi.
301
- * Compound allows you to layout multiple web components in one micro frontend.
302
- */
303
- export interface CompoundConfig {
304
- /**
305
- * Renderer configuration for the compound layout
306
- */
307
- renderer?: {
308
- /**
309
- * The renderer to use - can be 'grid', a custom renderer object, or undefined for default
310
- */
311
- use?: 'grid' | string | {
312
- /**
313
- * Base renderer to extend (e.g., 'grid')
314
- */
315
- extends?: string;
316
- /**
317
- * Custom function to create the compound container
318
- * @param config - The renderer configuration
319
- * @param renderer - The parent/super renderer (if extending)
320
- */
321
- createCompoundContainer?: (config: RendererConfig, renderer?: any) => HTMLDivElement;
322
- /**
323
- * Custom function to create individual compound item containers
324
- * @param layoutConfig - Layout configuration for the item
325
- * @param config - The overall renderer configuration
326
- * @param renderer - The parent/super renderer (if extending)
327
- */
328
- createCompoundItemContainer?: (layoutConfig?: LayoutConfig, config?: RendererConfig, renderer?: any) => HTMLDivElement;
329
- /**
330
- * Custom function to attach an item to the compound container
331
- * @param compoundCnt - The compound container element
332
- * @param compoundItemCnt - The item container to attach
333
- * @param renderer - The parent/super renderer (if extending)
334
- */
335
- attachCompoundItem?: (compoundCnt: HTMLElement, compoundItemCnt: HTMLElement, renderer?: any) => void;
336
- };
337
- /**
338
- * Configuration for the grid layout
339
- */
340
- config?: {
341
- /**
342
- * CSS grid-template-columns value (e.g., '1fr 2fr')
343
- */
344
- columns?: string;
345
- /**
346
- * CSS grid-template-rows value (e.g., '150px 150px')
347
- */
348
- rows?: string;
349
- /**
350
- * CSS grid-gap value (e.g., 'auto', '10px')
351
- */
352
- gap?: string;
353
- /**
354
- * Minimum height for the grid container
355
- */
356
- minHeight?: string;
357
- /**
358
- * Responsive layout configurations for different viewport sizes
359
- */
360
- layouts?: Array<{
361
- /**
362
- * CSS grid-template-columns for this breakpoint
363
- */
364
- columns?: string | number;
365
- /**
366
- * CSS grid-template-rows for this breakpoint
367
- */
368
- rows?: string | number;
369
- /**
370
- * CSS grid-gap for this breakpoint
371
- */
372
- gap?: string | number;
373
- /**
374
- * Minimum viewport width for this layout (in pixels)
375
- */
376
- minWidth?: number;
377
- /**
378
- * Maximum viewport width for this layout (in pixels)
379
- */
380
- maxWidth?: number;
381
- }>;
382
- };
383
- };
384
- /**
385
- * Lazy loading configuration for compound children
386
- */
387
- lazyLoadingOptions?: {
388
- /**
389
- * Enable lazy loading using IntersectionObserver
390
- * @default false
391
- */
392
- enabled?: boolean;
393
- /**
394
- * IntersectionObserver rootMargin option
395
- * Controls when children are loaded relative to viewport visibility
396
- * @default "0px"
397
- */
398
- intersectionRootMargin?: string;
399
- /**
400
- * Default temporary height for child containers before they load
401
- * @default "500px"
402
- */
403
- temporaryContainerHeight?: string;
404
- /**
405
- * Disable automatic temporary container heights
406
- * Useful for custom renderers that manage heights themselves
407
- * @default false
408
- */
409
- noTemporaryContainerHeight?: boolean;
410
- };
411
- /**
412
- * Array of child web component configurations
413
- */
414
- children?: Array<{
415
- /**
416
- * Unique identifier for this child web component
417
- */
418
- id: string;
419
- /**
420
- * URL pointing to the web component JavaScript file
421
- * Supports {i18n.currentLocale} placeholder for localization
422
- */
423
- viewUrl: string;
424
- /**
425
- * Context object passed to the web component
426
- */
427
- context?: Record<string, any>;
428
- /**
429
- * Layout configuration for positioning this child
430
- */
431
- layoutConfig?: {
432
- /**
433
- * CSS grid-row value (e.g., '1 / 3', 'auto')
434
- * @default "auto"
435
- */
436
- row?: string;
437
- /**
438
- * CSS grid-column value (e.g., '1 / -1', 'auto')
439
- * @default "auto"
440
- */
441
- column?: string;
442
- /**
443
- * Slot name for nested web components
444
- * Use this instead of row/column to plug into a parent's slot
445
- */
446
- slot?: string;
447
- /**
448
- * Override the default temporary container height for this specific child
449
- * Only used when lazy loading is enabled
450
- * * @default undefined
451
- */
452
- temporaryContainerHeight?: string;
453
- };
454
- /**
455
- * Event listeners for cross-component communication via event bus
456
- */
457
- eventListeners?: Array<{
458
- /**
459
- * ID of the source web component (use '*' for any source)
460
- */
461
- source: string;
462
- /**
463
- * Name of the event to listen for
464
- */
465
- name: string;
466
- /**
467
- * Type of action to perform (e.g., 'update')
468
- */
469
- action: string;
470
- /**
471
- * Optional function to convert event data before passing to listener
472
- * @param data - The event data
473
- */
474
- dataConverter?: (data: any) => any;
475
- }>;
476
- }>;
477
- }
478
- /**
479
- * Supporting type for layout configuration
480
- */
481
- export interface LayoutConfig {
482
- column?: string;
483
- row?: string;
484
- slot?: string;
485
- temporaryContainerHeight?: string;
486
- }
487
- /**
488
- * Supporting type for renderer configuration
489
- */
490
- export interface RendererConfig {
491
- columns?: string;
492
- rows?: string;
493
- gap?: string;
494
- minHeight?: string;
495
- layouts?: Array<{
496
- columns?: string;
497
- rows?: string;
498
- gap?: string | number;
499
- minWidth?: number;
500
- maxWidth?: number;
501
- }>;
502
- }
310
+ export type { CompoundConfig, LayoutConfig, RendererConfig } from './compound-config';
503
311
  export interface TitleResolverCache {
504
312
  key: string;
505
313
  value: {
package/types/ux.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Public UX-related types: alert and confirmation modal settings, plus the handlers
3
+ * a connector receives when rendering them.
4
+ */
5
+ export interface AlertSettings {
6
+ closeAfter?: number;
7
+ id?: string;
8
+ links?: Record<string, Link>;
9
+ text?: string;
10
+ ttl?: number;
11
+ type?: string;
12
+ }
13
+ export interface Link {
14
+ elemId: string;
15
+ url?: string;
16
+ dismissKey?: string;
17
+ }
18
+ /**
19
+ * Imperative alert surface a connector receives when rendering an alert. The connector
20
+ * invokes `close()` when the user dismisses the alert and `link(linkKey)` when a link
21
+ * inside the alert is activated.
22
+ */
23
+ export interface AlertHandler {
24
+ openFromClient: boolean;
25
+ close(): void;
26
+ link(linkKey: string): boolean;
27
+ }
28
+ export interface ConfirmationModalSettings {
29
+ icon?: string;
30
+ type?: string;
31
+ header?: string;
32
+ body?: string;
33
+ buttonConfirm?: string;
34
+ buttonDismiss?: string;
35
+ }
36
+ /**
37
+ * Imperative confirmation-modal surface a connector receives when rendering the modal.
38
+ * The connector invokes `confirm()` or `dismiss()` based on the user's choice.
39
+ */
40
+ export interface ConfirmationModalHandler {
41
+ confirm(): void;
42
+ dismiss(): void;
43
+ }
@@ -0,0 +1,7 @@
1
+ import { GlobalSearchProvider, SearchResultItem } from '../../types/global-search';
2
+ import { Luigi } from '../../core-api/luigi';
3
+ export declare const GlobalSearchHelpers: {
4
+ handleSearchResultRenderer(searchProvider: GlobalSearchProvider, searchResultItems: SearchResultItem[], rendererSlot: any): void;
5
+ getSearchPlaceholder(luigi: Luigi): string | undefined;
6
+ toggleSearch(isSearchFieldVisible: boolean, searchProvider: GlobalSearchProvider, inputElem?: HTMLInputElement): void;
7
+ };