@mui-toolpad-extended-tuni/core 3.0.0

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.
Files changed (104) hide show
  1. package/README.md +99 -0
  2. package/dist/Dialogs/DialogOpener.d.ts +12 -0
  3. package/dist/Dialogs/Dialogs.d.ts +6 -0
  4. package/dist/Dialogs/ExtendedDialog.d.ts +8 -0
  5. package/dist/Dialogs/FormDialog.d.ts +15 -0
  6. package/dist/Dialogs/dialogRegistry.d.ts +5 -0
  7. package/dist/Events/EventBus.d.ts +34 -0
  8. package/dist/Events/UserBus.d.ts +110 -0
  9. package/dist/Events/hooks/useCurrentUser.d.ts +11 -0
  10. package/dist/Events/hooks/useUserActions.d.ts +15 -0
  11. package/dist/Events/hooks/useUserPreferences.d.ts +22 -0
  12. package/dist/Events/index.d.ts +10 -0
  13. package/dist/Events/types.d.ts +16 -0
  14. package/dist/Events/userTypes.d.ts +79 -0
  15. package/dist/Navigation/NavigationBuilder.d.ts +7 -0
  16. package/dist/Navigation/NavigationFilter.d.ts +1 -0
  17. package/dist/Navigation/NavigationRegistry.d.ts +116 -0
  18. package/dist/Navigation/hooks/useMicroserviceNavigation.d.ts +4 -0
  19. package/dist/Navigation/hooks/useMicroserviceRoutes.d.ts +6 -0
  20. package/dist/Navigation/hooks/useNavigationSectionManager.d.ts +23 -0
  21. package/dist/Navigation/hooks/useSyncNavigationFilters.d.ts +1 -0
  22. package/dist/Navigation/store/microserviceUtils.d.ts +9 -0
  23. package/dist/Navigation/store/navigationCalculator.d.ts +11 -0
  24. package/dist/Navigation/store/sectionManager.d.ts +9 -0
  25. package/dist/Navigation/store/types.d.ts +90 -0
  26. package/dist/Navigation/store/useNavigationFilterStore.d.ts +6 -0
  27. package/dist/Navigation/store/useNavigationStore.d.ts +50 -0
  28. package/dist/Notifications/Notifications.d.ts +3 -0
  29. package/dist/Notifications/store/useNotificationsStore.d.ts +22 -0
  30. package/dist/common/components/index.d.ts +2 -0
  31. package/dist/common/components/layout/GridLayout/GridItem.d.ts +17 -0
  32. package/dist/common/components/layout/GridLayout/GridItemContext.d.ts +26 -0
  33. package/dist/common/components/layout/GridLayout/ResponsiveGridLayout.d.ts +16 -0
  34. package/dist/common/components/layout/GridLayout/Tools/BreakpointIndicator.d.ts +8 -0
  35. package/dist/common/components/layout/GridLayout/Tools/EditModeToggler.d.ts +7 -0
  36. package/dist/common/components/layout/GridLayout/hooks/useGridLayoutManagement.d.ts +27 -0
  37. package/dist/common/components/layout/GridLayout/index.d.ts +12 -0
  38. package/dist/common/components/layout/GridLayout/layoutStorageUtils.d.ts +52 -0
  39. package/dist/common/components/layout/GridLayout/layoutUtils.d.ts +78 -0
  40. package/dist/common/components/layout/GridLayout/store/usePanelStore.d.ts +27 -0
  41. package/dist/common/components/layout/GridLayout/useGridLayout.d.ts +11 -0
  42. package/dist/common/components/layout/index.d.ts +1 -0
  43. package/dist/common/components/ui/CenteredHeading/CenteredHeading.d.ts +7 -0
  44. package/dist/common/components/ui/CollapsingButtons/CollapsingButtons.d.ts +11 -0
  45. package/dist/common/components/ui/CompoundPanel/CompoundPanel.d.ts +86 -0
  46. package/dist/common/components/ui/LoadingScreen/LoadingScreen.d.ts +2 -0
  47. package/dist/common/components/ui/Panel/Expandable/Expandable.d.ts +4 -0
  48. package/dist/common/components/ui/Panel/Expandable/context/ExpandableContextProvider.d.ts +10 -0
  49. package/dist/common/components/ui/Panel/Expandable/hooks/useCollapseHandler.d.ts +2 -0
  50. package/dist/common/components/ui/Panel/Expandable/hooks/useExpandable.d.ts +17 -0
  51. package/dist/common/components/ui/Panel/Expandable/hooks/useExpansionAnimation.d.ts +5 -0
  52. package/dist/common/components/ui/Panel/Expandable/hooks/useInitialSetup.d.ts +6 -0
  53. package/dist/common/components/ui/Panel/Expandable/hooks/useResizeHandler.d.ts +1 -0
  54. package/dist/common/components/ui/Panel/Expandable/store/useExpandablePanelStore.d.ts +7 -0
  55. package/dist/common/components/ui/Panel/Main/Context/PanelContextProvider.d.ts +50 -0
  56. package/dist/common/components/ui/Panel/Main/Panel.d.ts +3 -0
  57. package/dist/common/components/ui/Panel/Main/hooks/useDimensionManagement.d.ts +13 -0
  58. package/dist/common/components/ui/Panel/Main/hooks/usePersistentDimensions.d.ts +19 -0
  59. package/dist/common/components/ui/Panel/Main/tools/BlurOverlay.d.ts +6 -0
  60. package/dist/common/components/ui/Panel/Main/tools/ToolsContainer.d.ts +11 -0
  61. package/dist/common/components/ui/Panel/Movable/DraggableItem.d.ts +6 -0
  62. package/dist/common/components/ui/Panel/Movable/MovablePanel.d.ts +9 -0
  63. package/dist/common/components/ui/Panel/Movable/MoveToggler.d.ts +3 -0
  64. package/dist/common/components/ui/Panel/Movable/context/MovableContextProvider.d.ts +10 -0
  65. package/dist/common/components/ui/Panel/Movable/hooks/usePersistentOrder.d.ts +3 -0
  66. package/dist/common/components/ui/Panel/Resizable/Context/ResizableContextProvider.d.ts +27 -0
  67. package/dist/common/components/ui/Panel/Resizable/Hooks/useResizeHandlers.d.ts +26 -0
  68. package/dist/common/components/ui/Panel/Resizable/Hooks/useResponsiveResize.d.ts +14 -0
  69. package/dist/common/components/ui/Panel/Resizable/Resizable.d.ts +3 -0
  70. package/dist/common/components/ui/Panel/Resizable/ResizeHandlers.d.ts +7 -0
  71. package/dist/common/components/ui/Panel/Resizable/ResizeIndicator.d.ts +9 -0
  72. package/dist/common/components/ui/Panel/Scrollable/InternalScrolling.d.ts +11 -0
  73. package/dist/common/components/ui/Panel/Scrollable/PaginationDots.d.ts +13 -0
  74. package/dist/common/components/ui/Panel/Scrollable/Scrollable.d.ts +5 -0
  75. package/dist/common/components/ui/Panel/Scrollable/context/ScrollerContextProvider.d.ts +15 -0
  76. package/dist/common/components/ui/Panel/Scrollable/hooks/useScrollControls.d.ts +28 -0
  77. package/dist/common/components/ui/Panel/TBR/PanelContent.d.ts +24 -0
  78. package/dist/common/components/ui/Panel/TBR/ResizablePanel.d.ts +3 -0
  79. package/dist/common/components/ui/Panel/TBR/ResizeHandlers.d.ts +10 -0
  80. package/dist/common/components/ui/Panel/TBR/ResizeIndicator.d.ts +10 -0
  81. package/dist/common/components/ui/Panel/TBR/useResizablePanel.d.ts +32 -0
  82. package/dist/common/components/ui/Panel/types.d.ts +9 -0
  83. package/dist/common/components/ui/Scroller/PaginationDots.d.ts +13 -0
  84. package/dist/common/components/ui/Scroller/Scroller.d.ts +14 -0
  85. package/dist/common/components/ui/Scroller/context/ScrollerContextProvider.d.ts +15 -0
  86. package/dist/common/components/ui/Scroller/hooks/useScrollControls.d.ts +28 -0
  87. package/dist/common/components/ui/Scroller/types.d.ts +1 -0
  88. package/dist/common/components/ui/SpeedDialButton/SpeedDialButton.d.ts +20 -0
  89. package/dist/common/components/ui/index.d.ts +14 -0
  90. package/dist/common/hooks/index.d.ts +1 -0
  91. package/dist/common/hooks/useRetry.d.ts +12 -0
  92. package/dist/common/index.d.ts +2 -0
  93. package/dist/constants.d.ts +24 -0
  94. package/dist/core.css +1 -0
  95. package/dist/index.cjs +219 -0
  96. package/dist/index.d.ts +45 -0
  97. package/dist/index.es.js +25836 -0
  98. package/dist/interfaces.d.ts +1 -0
  99. package/dist/utils/apiPrefix.d.ts +3 -0
  100. package/dist/utils/caseConverter.d.ts +17 -0
  101. package/dist/utils/cookieUtils.d.ts +27 -0
  102. package/dist/utils/parseDate.d.ts +2 -0
  103. package/dist/utils/slugify.d.ts +1 -0
  104. package/package.json +61 -0
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # @mui-toolpad-extended-tuni/core
2
+
3
+ Core shared package for MUI Toolpad Extended TUNI microservices.
4
+
5
+ This package contains shared dependencies used by all microservices in the MUI Toolpad Extended TUNI ecosystem.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @mui-toolpad-extended-tuni/core
11
+ ```
12
+
13
+ ## Peer Dependencies
14
+
15
+ This package requires the following peer dependencies:
16
+
17
+ - `@emotion/react`: ^11.0.0
18
+ - `@emotion/styled`: ^11.0.0
19
+ - `@mui/icons-material`: ^7.0.0
20
+ - `@mui/material`: ^7.0.0
21
+ - `@mui/x-date-pickers`: ^7.0.0
22
+ - `@toolpad/core`: ^0.16.0
23
+ - `react`: ^19.0.0
24
+ - `react-dom`: ^19.0.0
25
+ - `react-router-dom`: ^7.0.0
26
+ - `zustand`: ^4.5.0
27
+
28
+ ## Features
29
+
30
+ ### Events
31
+ - **EventBus**: Global event bus for application-wide communication
32
+ - **UserBus**: User-specific event bus with hooks for user management
33
+ - Hooks: `useCurrentUser`, `useUserActions`, `useUserPreferences`
34
+
35
+ ### Navigation
36
+ - **NavigationRegistry**: Microservice registration and routing
37
+ - Navigation stores and hooks for managing application navigation
38
+ - Hooks: `useMicroserviceRoutes`, `useMicroserviceNavigation`, `useNavigationSectionManager`, `useSyncNavigationFilters`
39
+
40
+ ### Common UI Components
41
+ - GridLayout components and utilities
42
+ - Panel system (Expandable, Movable, Resizable, Scrollable)
43
+ - Scroller component
44
+ - LoadingScreen, CenteredHeading, CollapsingButtons, CompoundPanel
45
+ - SpeedDialButton
46
+
47
+ ### Dialogs
48
+ - DialogOpener, FormDialog, ExtendedDialog
49
+ - Dialog registry system
50
+
51
+ ### Notifications
52
+ - Notification component and store
53
+ - Integration with notistack
54
+
55
+ ### Utilities
56
+ - Case conversion utilities
57
+ - Date parsing utilities
58
+ - Cookie utilities
59
+ - API prefix utilities
60
+ - String utilities (slugify)
61
+
62
+ ## Usage
63
+
64
+ ```typescript
65
+ import {
66
+ // Events
67
+ EventBus,
68
+ eventBus,
69
+ userBus,
70
+ useCurrentUser,
71
+
72
+ // Navigation
73
+ registerMicroservice,
74
+ useMicroserviceNavigation,
75
+ useNavigationStore,
76
+
77
+ // Components
78
+ GridItemProvider,
79
+ ResponsiveGridLayout,
80
+ Panel,
81
+
82
+ // Dialogs
83
+ DialogOpener,
84
+ FormDialog,
85
+
86
+ // Notifications
87
+ Notifications,
88
+ useNotificationStore,
89
+
90
+ // Utils
91
+ parseDate,
92
+ slugify,
93
+ getCookie,
94
+ } from '@mui-toolpad-extended-tuni/core';
95
+ ```
96
+
97
+ ## License
98
+
99
+ MIT
@@ -0,0 +1,12 @@
1
+ /** @format */
2
+ type dialogType = string;
3
+ type DialogOpenerProps = {
4
+ title: string;
5
+ dialogId: dialogType;
6
+ callOnOpen?: (event: React.MouseEvent<HTMLButtonElement | HTMLElement>) => void;
7
+ showTitle?: boolean;
8
+ onOpenDialog?: (dialogId: string) => void;
9
+ icon?: React.ReactNode;
10
+ };
11
+ declare const DialogOpener: ({ title, dialogId, callOnOpen, showTitle, onOpenDialog, icon, }: DialogOpenerProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default DialogOpener;
@@ -0,0 +1,6 @@
1
+ /** @format */
2
+ type DialogsProps = {
3
+ openDialog?: string | null;
4
+ };
5
+ declare const Dialogs: ({ openDialog }: DialogsProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export default Dialogs;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ type CustomDialogProps = {
3
+ children: ReactNode;
4
+ open: boolean;
5
+ onClose: () => void;
6
+ };
7
+ declare const ExtendedDialog: ({ children, open, onClose, ...dialogProps }: CustomDialogProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default ExtendedDialog;
@@ -0,0 +1,15 @@
1
+ import { DialogProps } from '@mui/material';
2
+ interface FormDialogProps {
3
+ onSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
4
+ title: string;
5
+ children: React.ReactNode;
6
+ submitText?: string;
7
+ disableSubmit?: boolean;
8
+ maxWidth?: DialogProps["maxWidth"];
9
+ fullWidth?: boolean;
10
+ showUnsavedChangesWarning?: boolean;
11
+ isDirty?: boolean;
12
+ onClose?: () => void;
13
+ }
14
+ declare const FormDialog: React.FC<FormDialogProps>;
15
+ export default FormDialog;
@@ -0,0 +1,5 @@
1
+ /** @format */
2
+ export declare function registerDialog(dialogId: string, Component: React.ComponentType): void;
3
+ export declare function getDialog(dialogId: string): import('react').ComponentType<{}> | undefined;
4
+ export declare function openDialog(_dialogId: string): void;
5
+ export declare function closeDialog(): void;
@@ -0,0 +1,34 @@
1
+ import { Event } from './types';
2
+ /**
3
+ * Event Bus for decoupling event producers from consumers.
4
+ * Modules can publish events and other modules can subscribe to them.
5
+ * This is a generic event system that any module can use.
6
+ */
7
+ export declare class EventBus {
8
+ private static instance;
9
+ private subscribers;
10
+ private events;
11
+ private constructor();
12
+ static getInstance(): EventBus;
13
+ /**
14
+ * Subscribe to event updates
15
+ */
16
+ subscribe(callback: (events: Event[]) => void): () => void;
17
+ /**
18
+ * Publish events to the bus
19
+ */
20
+ publish(sourceId: string, events: Event[]): void;
21
+ /**
22
+ * Remove all events from a specific source
23
+ */
24
+ removeSource(sourceId: string): void;
25
+ /**
26
+ * Get all current events
27
+ */
28
+ getAllEvents(): Event[];
29
+ /**
30
+ * Clear all events
31
+ */
32
+ clear(): void;
33
+ }
34
+ export declare const eventBus: EventBus;
@@ -0,0 +1,110 @@
1
+ import { UserEvent, UserData } from './userTypes';
2
+ /**
3
+ * Configuration interface for UserBus store methods.
4
+ * This allows UserBus to work with any user store implementation.
5
+ */
6
+ export interface UserBusStoreConfig {
7
+ getUser: () => Promise<void>;
8
+ updateUser: (userData: UserData) => Promise<UserData>;
9
+ setUserToUpdate: (user: UserData | null) => void;
10
+ fetchCourseUsers: (courseId: string) => Promise<void>;
11
+ logout: () => Promise<void>;
12
+ getState: () => {
13
+ user: UserData | null;
14
+ courseUsers?: UserData[];
15
+ };
16
+ }
17
+ /**
18
+ * User Bus for decoupling user state changes from consumers.
19
+ * Modules can subscribe to user events and react to user state changes.
20
+ * This follows the same pattern as EventBus but is specifically for user-related events.
21
+ *
22
+ * UserBus requires store methods to be configured via configureStore() before use.
23
+ */
24
+ export declare class UserBus {
25
+ private static instance;
26
+ private subscribers;
27
+ private currentUser;
28
+ private lastEvent;
29
+ private storeConfig;
30
+ private constructor();
31
+ /**
32
+ * Configure UserBus with store methods.
33
+ * This must be called before using store-dependent methods.
34
+ */
35
+ configureStore(config: UserBusStoreConfig): void;
36
+ private getStoreConfig;
37
+ static getInstance(): UserBus;
38
+ /**
39
+ * Subscribe to user event updates
40
+ * @param callback Function to call when user events occur
41
+ * @returns Unsubscribe function
42
+ */
43
+ subscribe(callback: (event: UserEvent) => void): () => void;
44
+ /**
45
+ * Publish a user event to the bus
46
+ * @param event User event to publish
47
+ */
48
+ publish(event: UserEvent): void;
49
+ /**
50
+ * Get the current user synchronously
51
+ * @returns Current user data or null
52
+ */
53
+ getCurrentUser(): UserData | null;
54
+ /**
55
+ * Get the current user synchronously (alias for getCurrentUser)
56
+ * @returns Current user data or null
57
+ */
58
+ getCurrentUserSync(): UserData | null;
59
+ /**
60
+ * Subscribe to user updates and get current user
61
+ * @param callback Function to call with current user and updates
62
+ * @returns Unsubscribe function
63
+ */
64
+ subscribeToUser(callback: (user: UserData | null) => void): () => void;
65
+ /**
66
+ * Get the last user event
67
+ * @returns Last user event or null
68
+ */
69
+ getLastEvent(): UserEvent | null;
70
+ /**
71
+ * Clear all user state
72
+ */
73
+ clear(): void;
74
+ /**
75
+ * Initialize UserBus with current user from store
76
+ * Should be called by UserEventPublisher on mount
77
+ */
78
+ initializeFromStore(): void;
79
+ /**
80
+ * Get user from store and publish to bus
81
+ * Delegates to store.getUser() and publishes event when complete
82
+ */
83
+ getUser(): Promise<void>;
84
+ /**
85
+ * Update user and publish event
86
+ * Delegates to store.updateUser() and publishes event
87
+ */
88
+ updateUser(userData: UserData): Promise<UserData>;
89
+ /**
90
+ * Set user to update (for editing)
91
+ * Delegates to store.setUserToUpdate()
92
+ */
93
+ setUserToUpdate(user: UserData | null): void;
94
+ /**
95
+ * Fetch course users
96
+ * Delegates to store.fetchCourseUsers()
97
+ */
98
+ fetchCourseUsers(courseId: string): Promise<void>;
99
+ /**
100
+ * Get course users from store
101
+ * @returns Course users array or undefined
102
+ */
103
+ getCourseUsers(): UserData[] | undefined;
104
+ /**
105
+ * Logout user and publish event
106
+ * Delegates to store.logout() and publishes event
107
+ */
108
+ logout(): Promise<void>;
109
+ }
110
+ export declare const userBus: UserBus;
@@ -0,0 +1,11 @@
1
+ import { UserData } from '../userTypes';
2
+ /**
3
+ * Hook to get current user from UserBus
4
+ * Automatically updates when user changes via UserBus events
5
+ *
6
+ * @returns { user: UserData | null, isLoading: boolean }
7
+ */
8
+ export declare const useCurrentUser: () => {
9
+ user: UserData | null;
10
+ isLoading: boolean;
11
+ };
@@ -0,0 +1,15 @@
1
+ import { UserData } from '../userTypes';
2
+ /**
3
+ * Hook that provides user actions through UserBus
4
+ * All actions trigger UserBus events when called
5
+ *
6
+ * @returns { updateUser, setUserToUpdate, fetchCourseUsers, getUser, logout, getCourseUsers }
7
+ */
8
+ export declare const useUserActions: () => {
9
+ updateUser: (userData: UserData) => Promise<UserData>;
10
+ setUserToUpdate: (user: UserData | null) => void;
11
+ fetchCourseUsers: (courseId: string) => Promise<void>;
12
+ getUser: () => Promise<void>;
13
+ logout: () => Promise<void>;
14
+ getCourseUsers: () => UserData[] | undefined;
15
+ };
@@ -0,0 +1,22 @@
1
+ /** @format */
2
+ export interface UserPreferences {
3
+ navigationType: "direct" | "instances";
4
+ visibleCourseLists: {
5
+ isStudent: boolean;
6
+ isStudentOld: boolean;
7
+ isTeacher: boolean;
8
+ isTeacherOld: boolean;
9
+ available: boolean;
10
+ };
11
+ lastVisitedCourses: string[];
12
+ visibleNavigation: string[];
13
+ }
14
+ /**
15
+ * Hook to get user preferences from UserBus
16
+ * Automatically updates when user preferences change via UserBus events
17
+ *
18
+ * @returns { preferences: UserPreferences | null }
19
+ */
20
+ export declare const useUserPreferences: () => {
21
+ preferences: UserPreferences | null;
22
+ };
@@ -0,0 +1,10 @@
1
+ /** @format */
2
+ export { EventBus, eventBus } from './EventBus';
3
+ export type { Event, EventSource } from './types';
4
+ export { UserBus } from './UserBus';
5
+ export type { UserBusStoreConfig } from './UserBus';
6
+ export type { UserData, UserEvent, UserEventType, PlatformRole, navigationTypes, gender, userId } from './userTypes';
7
+ export { useCurrentUser } from './hooks/useCurrentUser';
8
+ export { useUserPreferences } from './hooks/useUserPreferences';
9
+ export { useUserActions } from './hooks/useUserActions';
10
+ export type { UserPreferences } from './hooks/useUserPreferences';
@@ -0,0 +1,16 @@
1
+ /** @format */
2
+ /**
3
+ * Generic Event interface that can be used by any module.
4
+ * This is the base event type for the Events API.
5
+ */
6
+ export interface Event {
7
+ id: string;
8
+ title: string;
9
+ start: Date | string;
10
+ end?: Date | string;
11
+ metadata?: Record<string, any>;
12
+ }
13
+ /**
14
+ * Event source identifier type for tracking which module published the event
15
+ */
16
+ export type EventSource = string;
@@ -0,0 +1,79 @@
1
+ /** @format */
2
+ /**
3
+ * User data type definition.
4
+ * This is defined in core to avoid circular dependencies.
5
+ * The Users package will re-export this type from its store.
6
+ */
7
+ export type userId = string;
8
+ export type navigationTypes = "direct" | "instances";
9
+ export type gender = "male" | "female" | "other";
10
+ export type PlatformRole = "admin" | "developer" | "moderator" | "creator" | "user" | "guest";
11
+ export interface UserData {
12
+ id: userId;
13
+ name: string;
14
+ email: string;
15
+ gender?: gender;
16
+ image?: {
17
+ large: string;
18
+ medium: string;
19
+ thumbnail: string;
20
+ };
21
+ department?: string;
22
+ platformRoles: PlatformRole[];
23
+ privacySettings: {
24
+ allowAnalytics: boolean;
25
+ allowPersonalization: boolean;
26
+ allowCommunications: boolean;
27
+ allowThirdPartySharing: boolean;
28
+ };
29
+ gdprConsent: {
30
+ accepted: boolean;
31
+ acceptedDate?: string;
32
+ lastUpdated: string;
33
+ };
34
+ dataRetention: {
35
+ deleteAccountAfterInactivity?: number;
36
+ deleteDataAfterAccountDeletion?: number;
37
+ };
38
+ preferences: {
39
+ navigationType: navigationTypes;
40
+ visibleCourseLists: {
41
+ isStudent: boolean;
42
+ isStudentOld: boolean;
43
+ isTeacher: boolean;
44
+ isTeacherOld: boolean;
45
+ available: boolean;
46
+ };
47
+ lastVisitedCourses: string[];
48
+ visibleNavigation: string[];
49
+ };
50
+ }
51
+ /**
52
+ * User event types for UserBus communication.
53
+ * These events are published when user state changes occur.
54
+ */
55
+ export type UserEventType = "user:loggedIn" | "user:updated" | "user:preferencesChanged" | "user:loggedOut";
56
+ export interface UserEvent {
57
+ type: UserEventType;
58
+ user: UserData | null;
59
+ timestamp: string;
60
+ metadata?: Record<string, unknown>;
61
+ }
62
+ export interface UserLoggedInEvent extends UserEvent {
63
+ type: "user:loggedIn";
64
+ user: UserData;
65
+ }
66
+ export interface UserUpdatedEvent extends UserEvent {
67
+ type: "user:updated";
68
+ user: UserData;
69
+ previousUser?: UserData;
70
+ }
71
+ export interface UserPreferencesChangedEvent extends UserEvent {
72
+ type: "user:preferencesChanged";
73
+ user: UserData;
74
+ changedPreferences?: string[];
75
+ }
76
+ export interface UserLoggedOutEvent extends UserEvent {
77
+ type: "user:loggedOut";
78
+ user: null;
79
+ }
@@ -0,0 +1,7 @@
1
+ import { addSectionProps } from './store/types';
2
+ export declare function setToolbarRegistryFunctions(register: (id: string, component: React.ComponentType) => void, unregister: (id: string, component: React.ComponentType) => void): void;
3
+ type NavigationSectionBuilderProps = {
4
+ sections: addSectionProps[];
5
+ };
6
+ export declare const NavigationSectionBuilder: React.FC<NavigationSectionBuilderProps>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare const NavigationFilter: () => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,116 @@
1
+ import { ComponentType, ReactNode, ReactElement } from 'react';
2
+ import { SvgIconComponent } from '@mui/icons-material';
3
+ /**
4
+ * Microservice Registry System
5
+ *
6
+ * @version 1.3.0
7
+ *
8
+ * A flexible system for registering and managing microservices for grid layouts.
9
+ * Supports dynamic registration, unregistration, and automatic re-rendering.
10
+ * Optimized to prevent excessive re-rendering.
11
+ *
12
+ * Now supports route providers for microservice-agnostic route registration.
13
+ */
14
+ /**
15
+ * Route provider function that returns Route elements
16
+ */
17
+ export type RouteProvider = () => ReactElement[];
18
+ /**
19
+ * Microservice entry containing both the component and optional props
20
+ */
21
+ export interface MicroserviceEntry {
22
+ Component: ComponentType<any>;
23
+ props?: Record<string, any>;
24
+ name: string;
25
+ description?: string;
26
+ category?: string;
27
+ iconComponent?: SvgIconComponent;
28
+ metadata?: {
29
+ keepVisible?: boolean;
30
+ order?: number;
31
+ tags?: string[];
32
+ showInNavigation?: boolean;
33
+ route?: {
34
+ path: string;
35
+ element?: ReactNode;
36
+ index?: boolean;
37
+ };
38
+ };
39
+ }
40
+ export declare const useMicroserviceRegistryStore: () => {
41
+ microservices: Map<string, MicroserviceEntry>;
42
+ routeProviders: Map<string, RouteProvider>;
43
+ lastUpdate: number;
44
+ };
45
+ /**
46
+ * Register a new microservice.
47
+ *
48
+ * @param id - The unique identifier for this microservice.
49
+ * @param Component - The React component to render.
50
+ * @param options - Optional configuration for the microservice including props and metadata.
51
+ */
52
+ export declare function registerMicroservice(id: string, Component: ComponentType<any>, options?: {
53
+ props?: Record<string, any>;
54
+ name?: string;
55
+ description?: string;
56
+ category?: string;
57
+ iconComponent?: SvgIconComponent;
58
+ metadata?: {
59
+ keepVisible?: boolean;
60
+ order?: number;
61
+ tags?: string[];
62
+ showInNavigation?: boolean;
63
+ route?: {
64
+ path: string;
65
+ element?: ReactNode;
66
+ index?: boolean;
67
+ };
68
+ };
69
+ }): void;
70
+ /**
71
+ * Unregister a microservice.
72
+ *
73
+ * @param id - The unique identifier for the microservice to remove.
74
+ */
75
+ export declare function unregisterMicroservice(id: string): void;
76
+ /**
77
+ * Get a specific microservice by ID.
78
+ *
79
+ * @param id - The unique identifier for the microservice.
80
+ * @returns The microservice entry or undefined if not found.
81
+ */
82
+ export declare function getMicroservice(id: string): MicroserviceEntry | undefined;
83
+ /**
84
+ * Get all registered microservices.
85
+ *
86
+ * @returns A Map of all registered microservices.
87
+ */
88
+ export declare function getAllMicroservices(): Map<string, MicroserviceEntry>;
89
+ /**
90
+ * Get all microservice IDs.
91
+ *
92
+ * @returns An array of all registered microservice IDs.
93
+ */
94
+ export declare function getMicroserviceIds(): string[];
95
+ /**
96
+ * Check if a microservice is registered.
97
+ *
98
+ * @param id - The unique identifier for the microservice.
99
+ * @returns True if the microservice is registered, false otherwise.
100
+ */
101
+ export declare function isMicroserviceRegistered(id: string): boolean;
102
+ /**
103
+ * Register a route provider.
104
+ * Route providers are functions that return Route elements, allowing microservices
105
+ * to register complex nested route structures.
106
+ *
107
+ * @param id - The unique identifier for this route provider.
108
+ * @param provider - Function that returns an array of Route elements.
109
+ */
110
+ export declare function registerRouteProvider(id: string, provider: RouteProvider): void;
111
+ /**
112
+ * Unregister a route provider.
113
+ *
114
+ * @param id - The unique identifier for the route provider to remove.
115
+ */
116
+ export declare function unregisterRouteProvider(id: string): void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Hook that maintains persistent navigation entries for microservices.
3
+ */
4
+ export declare const useMicroserviceNavigation: () => null;
@@ -0,0 +1,6 @@
1
+ import { ReactElement } from 'react';
2
+ /**
3
+ * Hook that generates routes from registered microservices
4
+ * @returns Array of Route elements based on registered microservice routes
5
+ */
6
+ export declare const useMicroserviceRoutes: () => ReactElement<unknown, string | import('react').JSXElementConstructor<any>>[];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Hook that provides a simplified interface for managing navigation sections.
3
+ * Abstracts away the complexity of the navigation store and filter store interaction.
4
+ *
5
+ * @returns {Object} Section management functions
6
+ * @property {Function} addDynamicSection - Adds or updates a section in navigation
7
+ */
8
+ interface DynamicSection {
9
+ header: string;
10
+ keepVisible?: boolean;
11
+ pages?: Array<{
12
+ segment: string;
13
+ title: string;
14
+ Icon?: any;
15
+ description?: string;
16
+ instances?: string[];
17
+ microservices?: string[];
18
+ }>;
19
+ }
20
+ export declare const useNavigationSectionManager: () => {
21
+ addDynamicSection: (section: DynamicSection) => void;
22
+ };
23
+ export {};
@@ -0,0 +1 @@
1
+ export declare const useSyncNavigationFilters: () => void;
@@ -0,0 +1,9 @@
1
+ import { NavigationPageStoreItem, ViewStore } from './types';
2
+ /**
3
+ * Aggregates microservices from all available sources (app-level + external).
4
+ * This is microservice-agnostic - it doesn't hard-code specific store types.
5
+ *
6
+ * @param state - The navigation store state
7
+ * @returns Array of all available microservice navigation items
8
+ */
9
+ export declare const getAllMicroservices: (state: ViewStore) => NavigationPageStoreItem[];
@@ -0,0 +1,11 @@
1
+ import { NavigationStoreItem, NavigationSection } from './types';
2
+ /**
3
+ * Calculates the navigation structure from sections.
4
+ * Pure function that takes sections, order, and visibility and returns a flat navigation array.
5
+ *
6
+ * @param sections - Record of navigation sections keyed by section key
7
+ * @param sectionOrder - Array of section keys in display order
8
+ * @param visibleSections - Record of section visibility flags
9
+ * @returns Flat array of navigation items for rendering
10
+ */
11
+ export declare const calculateNavigationFromSections: (sections: Record<string, NavigationSection>, sectionOrder: string[], visibleSections: Record<string, boolean>) => NavigationStoreItem[];
@@ -0,0 +1,9 @@
1
+ import { ViewStore } from './types';
2
+ /**
3
+ * Updates microservice navigation for all sections.
4
+ * Orchestrates the update process across all sections and recalculates navigation.
5
+ *
6
+ * @param state - The current navigation store state
7
+ * @returns Updated state with sections and navigation, or null if no changes
8
+ */
9
+ export declare const updateMicroserviceNavigationForSections: (state: ViewStore) => Partial<ViewStore> | null;