@luigi-project/core-modular 0.0.1

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 (42) hide show
  1. package/App.svelte.d.ts +1 -0
  2. package/README.md +13 -0
  3. package/core-api/auth.d.ts +92 -0
  4. package/core-api/feature-toggles.d.ts +33 -0
  5. package/core-api/luigi.d.ts +79 -0
  6. package/core-api/navigation.d.ts +15 -0
  7. package/core-api/routing.d.ts +43 -0
  8. package/core-api/theming.d.ts +78 -0
  9. package/core-api/ux.d.ts +22 -0
  10. package/luigi-engine.d.ts +40 -0
  11. package/luigi.js +34 -0
  12. package/luigi.js.map +1 -0
  13. package/main.d.ts +1 -0
  14. package/modules/communicaton-module.d.ts +6 -0
  15. package/modules/routing-module.d.ts +18 -0
  16. package/modules/ui-module.d.ts +14 -0
  17. package/modules/ux-module.d.ts +49 -0
  18. package/package.json +22 -0
  19. package/services/auth-layer.service.d.ts +24 -0
  20. package/services/auth-store.service.d.ts +23 -0
  21. package/services/dirty-status.service.d.ts +41 -0
  22. package/services/i18n.service.d.ts +81 -0
  23. package/services/modal.service.d.ts +52 -0
  24. package/services/navigation.service.d.ts +213 -0
  25. package/services/node-data-management.service.d.ts +45 -0
  26. package/services/routing.service.d.ts +103 -0
  27. package/services/service-registry.d.ts +42 -0
  28. package/services/viewurl-decorator.d.ts +7 -0
  29. package/types/connector.d.ts +26 -0
  30. package/utilities/defaultLuigiTranslationTable.d.ts +1 -0
  31. package/utilities/helpers/async-helpers.d.ts +13 -0
  32. package/utilities/helpers/auth-helpers.d.ts +22 -0
  33. package/utilities/helpers/config-helpers.d.ts +19 -0
  34. package/utilities/helpers/escaping-helpers.d.ts +10 -0
  35. package/utilities/helpers/event-listener-helpers.d.ts +7 -0
  36. package/utilities/helpers/generic-helpers.d.ts +78 -0
  37. package/utilities/helpers/navigation-helpers.d.ts +15 -0
  38. package/utilities/helpers/routing-helpers.d.ts +254 -0
  39. package/utilities/helpers/storage-helpers.d.ts +25 -0
  40. package/utilities/helpers/usersetting-dialog-helpers.d.ts +8 -0
  41. package/utilities/luigi-config-defaults.d.ts +21 -0
  42. package/utilities/store.d.ts +11 -0
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # Luigi Modular Core
2
+
3
+ ## Overview
4
+
5
+ Luigi Core, headless, modular.
6
+
7
+ This is an early version and not yet recommended for production use.
8
+
9
+ For details on Luigi Core, see [this](https://github.com/luigi-project/luigi/tree/main/core) document.
10
+
11
+ If you want to try Luigi out, see the [examples](https://github.com/luigi-project/luigi/tree/main/core/examples).
12
+
13
+ For documentation on Luigi Core, see [Luigi documentation](https://docs.luigi-project.io).
@@ -0,0 +1,92 @@
1
+ export declare class LuigiAuthClass {
2
+ /**
3
+ * Detects if authorization is enabled via configuration.
4
+ * Read more about [custom authorization providers](authorization-configuration.md).
5
+ * @memberof Authorization
6
+ * @returns {boolean} - `true` if authorization is enabled. Otherwise returns `false`.
7
+ * @example
8
+ * Luigi.auth().isAuthorizationEnabled();
9
+ */
10
+ isAuthorizationEnabled(): boolean;
11
+ /**
12
+ * Login the user dynamically.
13
+ * This will run the same functionality as though the user clicked the login button.
14
+ * @memberof Authorization
15
+ * @example
16
+ * Luigi.auth().login();
17
+ */
18
+ login(): void;
19
+ /**
20
+ * Logout the user dynamically.
21
+ * This will run the same functionality as though the user clicked the logout button.
22
+ * @memberof Authorization
23
+ * @example
24
+ * Luigi.auth().logout();
25
+ */
26
+ logout(): void;
27
+ /**
28
+ * @private
29
+ * @memberof Authorization
30
+ * @param {string} eventName
31
+ * @param {Object} providerInstanceSettings
32
+ * @param {AuthData} data
33
+ * @param {string} redirectUrl
34
+ */
35
+ handleAuthEvent(eventName: string, providerInstanceSettings: any, data?: any, redirectUrl?: string): Promise<any>;
36
+ /**
37
+ * Authorization Storage helpers, to be used in your custom authorization provider.
38
+ * Read more about custom authorization providers [here](authorization-configuration.md#implement-a-custom-authorization-provider).
39
+ * @name AuthorizationStore
40
+ */
41
+ /**
42
+ * Authorization object that is stored in auth store and used within Luigi. It is then available in [LuigiClient.addInitListener](luigi-client-api.md#addInitListener) and can also be used in the Core configuration.
43
+ * @typedef {Object} AuthData
44
+ * @property {string} accessToken - access token value
45
+ * @property {string} accessTokenExpirationDate - timestamp value
46
+ * @property {string} scope - scope, can be empty if it is not required
47
+ * @property {string} idToken - id token, used for renewing authentication
48
+ */
49
+ get store(): {
50
+ /**
51
+ * Retrieves the key name that is used to store the auth data.
52
+ * @memberof AuthorizationStore
53
+ * @returns {string} - name of the store key
54
+ * @example Luigi.auth().store.getStorageKey()
55
+ */
56
+ getStorageKey: () => any;
57
+ /**
58
+ * Retrieves the storage type that is used to store the auth data. To set it, use the `storage` property of the `auth` Luigi configuration object. Find out more [here](https://docs.luigi-project.io/docs/authorization-configuration?section=general-authorization-options).
59
+ * @memberof AuthorizationStore
60
+ * @returns {('localStorage'|'sessionStorage'|'none')} - storage type
61
+ * @example Luigi.auth().store.getStorageType()
62
+ */
63
+ getStorageType: () => string;
64
+ /**
65
+ * Retrieves the current auth object.
66
+ * @memberof AuthorizationStore
67
+ * @returns {AuthData} - the current auth data object
68
+ * @example Luigi.auth().store.getAuthData()
69
+ */
70
+ getAuthData: () => any;
71
+ /**
72
+ * Sets authorization data
73
+ * @memberof AuthorizationStore
74
+ * @param {AuthData} data - new auth data object
75
+ * @example Luigi.auth().store.setAuthData(data)
76
+ */
77
+ setAuthData: (data: any) => void;
78
+ /**
79
+ * Clears authorization data from store
80
+ * @memberof AuthorizationStore
81
+ * @example Luigi.auth().store.removeAuthData()
82
+ */
83
+ removeAuthData: () => void;
84
+ /**
85
+ * Defines a new authorization session. Must be triggered after initial `setAuthData()` in order to trigger **onAuthSuccessful** event after login.
86
+ * @memberof AuthorizationStore
87
+ * @example Luigi.auth().store.setNewlyAuthorized()
88
+ */
89
+ setNewlyAuthorized: () => void;
90
+ };
91
+ }
92
+ export declare const LuigiAuth: LuigiAuthClass;
@@ -0,0 +1,33 @@
1
+ export declare class FeatureToggles {
2
+ featureToggleList: Set<string>;
3
+ constructor();
4
+ /**
5
+ * Add a feature toggle to an active feature toggles list
6
+ * @param {string} featureToggleName name of the feature toggle
7
+ */
8
+ setFeatureToggle(featureToggleName: string, fromUrlQuery?: boolean): void;
9
+ /**
10
+ * Remove a feature toggle from the list
11
+ * @param {string} featureToggleName name of the feature toggle
12
+ */
13
+ unsetFeatureToggle(featureToggleName: string): void;
14
+ /**
15
+ * Get a list of active feature toggles
16
+ * @return {Array} of active feature toggles
17
+ */
18
+ getActiveFeatureToggleList(): string[];
19
+ /**
20
+ * Check if it is a valid feature toggle
21
+ * @private
22
+ * @param {string} featureToggleName name of the feature toggle
23
+ * @return {boolean} of valid feature toggle name
24
+ */
25
+ private isValid;
26
+ /**
27
+ * Check if feature toggle is duplicated or already disabled
28
+ * @private
29
+ * @param {string} featureToggleName name of the feature toggle
30
+ * @return {boolean} of valid feature toggle name
31
+ */
32
+ private isDuplicatedOrDisabled;
33
+ }
@@ -0,0 +1,79 @@
1
+ import { LuigiEngine } from '../luigi-engine';
2
+ import { i18nService } from '../services/i18n.service';
3
+ import { FeatureToggles } from './feature-toggles';
4
+ import { Navigation } from './navigation';
5
+ import { Routing } from './routing';
6
+ import { Theming } from './theming';
7
+ import { UX } from './ux';
8
+ import { LuigiAuthClass } from './auth';
9
+ export declare class Luigi {
10
+ private engine;
11
+ config: any;
12
+ _store: any;
13
+ _featureToggles?: FeatureToggles;
14
+ _i18n: i18nService;
15
+ _theming?: Theming;
16
+ _routing?: Routing;
17
+ __cssVars?: any;
18
+ preventLoadingModalData?: boolean;
19
+ initialized: boolean;
20
+ configReadyCallback: () => void;
21
+ private USER_SETTINGS_KEY;
22
+ constructor(engine: LuigiEngine);
23
+ getEngine(): LuigiEngine;
24
+ setConfig: (cfg: any) => void;
25
+ getConfig: () => any;
26
+ configChanged: (...scopes: string[]) => void;
27
+ /**
28
+ * Gets value of the given property on Luigi config object. Target can be a value or a synchronous function.
29
+ * @param {string} property the object traversal path
30
+ * @example
31
+ * Luigi.getConfigValue('auth.use')
32
+ * Luigi.getConfigValue('settings.sideNavFooterText')
33
+ */
34
+ getConfigValue(property: string): any;
35
+ /**
36
+ * Gets value of the given property on the Luigi config object.
37
+ * If the value is a Function it is called (with the given parameters) and the result of that call is the value.
38
+ * If the value is not a Promise it is wrapped to a Promise so that the returned value is definitely a Promise.
39
+ * @memberof Configuration
40
+ * @param {string} property the object traversal path
41
+ * @param {*} parameters optional parameters that are used if the target is a function
42
+ * @example
43
+ * Luigi.getConfigValueAsync('navigation.nodes')
44
+ * Luigi.getConfigValueAsync('navigation.profile.items')
45
+ * Luigi.getConfigValueAsync('navigation.contextSwitcher.options')
46
+ */
47
+ getConfigValueAsync(property: string, ...parameters: any[]): Promise<any>;
48
+ /**
49
+ * Reads the user settings object.
50
+ * You can choose a custom storage to read the user settings by implementing the `userSettings.readUserSettings` function in the settings section of the Luigi configuration.
51
+ * By default, the user settings will be read from the **localStorage**
52
+ * @returns {Promise} a promise when a custom `readUserSettings` function in the settings.userSettings section of the Luigi configuration is implemented. It resolves a stored user settings object. If the promise is rejected the user settings dialog will also closed if the error object has a `closeDialog` property, e.g `reject({ closeDialog: true, message: 'some error' })`. In addition a custom error message can be logged to the browser console.
53
+ * @example
54
+ * Luigi.readUserSettings();
55
+ */
56
+ readUserSettings(): Promise<any>;
57
+ /**
58
+ * Stores the user settings object.
59
+ * You can choose a custom storage to write the user settings by implementing the `userSetting.storeUserSettings` function in the settings section of the Luigi configuration
60
+ * By default, the user settings will be written from the **localStorage**
61
+ * @param {Object} userSettingsObj to store in the storage.
62
+ * @param {Object} previousUserSettingsObj the previous object from storage.
63
+ * @returns {Promise} a promise when a custom `storeUserSettings` function in the settings.userSettings section of the Luigi configuration is implemented. If it is resolved the user settings dialog will be closed. If the promise is rejected the user settings dialog will also closed if the error object has a `closeDialog` property, e.g `reject({ closeDialog: true, message: 'some error' })`. In addition a custom error message can be logged to the browser console.
64
+ * @example
65
+ * Luigi.storeUserSettings(userSettingsobject, previousUserSettingsObj);
66
+ */
67
+ storeUserSettings(userSettingsObj: Record<string, any>, previousUserSettingsObj: Record<string, any>): Promise<any>;
68
+ i18n: () => i18nService;
69
+ navigation: () => Navigation;
70
+ ux: () => UX;
71
+ featureToggles: () => FeatureToggles;
72
+ routing: () => Routing;
73
+ theming: () => Theming;
74
+ auth: () => LuigiAuthClass;
75
+ private luigiAfterInit;
76
+ private createConfigStore;
77
+ private getConfigReadyCallback;
78
+ private setConfigCallback;
79
+ }
@@ -0,0 +1,15 @@
1
+ import { ModalService } from '../services/modal.service';
2
+ import { ModalSettings, NavigationService } from '../services/navigation.service';
3
+ import { RoutingService } from '../services/routing.service';
4
+ import { Luigi } from './luigi';
5
+ export declare class Navigation {
6
+ luigi: Luigi;
7
+ hashRouting: boolean;
8
+ navService: NavigationService;
9
+ routingService: RoutingService;
10
+ modalService: ModalService;
11
+ constructor(luigi: Luigi);
12
+ navigate: (path: string, preserveView?: string, modalSettings?: ModalSettings, callbackFn?: (val?: unknown) => void) => void;
13
+ openAsModal: (path: string, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
14
+ openAsDrawer: (path: string, modalSettings: ModalSettings, onCloseCallback?: () => void) => void;
15
+ }
@@ -0,0 +1,43 @@
1
+ import { Luigi } from './luigi';
2
+ export declare class Routing {
3
+ luigi: Luigi;
4
+ constructor(luigi: Luigi);
5
+ /**
6
+ * Adds or updates search parameters in the current URL.
7
+ *
8
+ * Depending on the routing configuration, this method will either update the hash fragment
9
+ * or the standard search parameters of the URL. It also manages browser history based on the
10
+ * `keepBrowserHistory` flag.
11
+ *
12
+ * @param params - An object containing key-value pairs to be added as search parameters.
13
+ * @param keepBrowserHistory - If `true`, a new entry is added to the browser's history; otherwise, the current entry is replaced. Defaults to `false`.
14
+ */
15
+ addSearchParams(params: object, keepBrowserHistory?: boolean): void;
16
+ /**
17
+ * Get search parameter from URL as an object.
18
+ * @memberof Routing
19
+ * @returns {Object}
20
+ * @example
21
+ * Luigi.routing().getSearchParams();
22
+ */
23
+ getSearchParams(): object;
24
+ /**
25
+ * Updates the browser's history stack with the provided URL.
26
+ *
27
+ * Depending on the `keepBrowserHistory` flag, this method either pushes a new entry
28
+ * onto the browser's history stack or replaces the current entry. The URL is sanitized
29
+ * before being used. If the sanitized URL is invalid, a warning is logged and no action is taken.
30
+ *
31
+ * @param keepBrowserHistory - If `true`, a new history entry is pushed; if `false`, the current entry is replaced.
32
+ * @param url - The URL object to be used for updating the browser history.
33
+ */
34
+ handleBrowserHistory(keepBrowserHistory: boolean, url: URL): void;
35
+ /**
36
+ * Sanitizes a given URL by ensuring it shares the same origin as the current page.
37
+ *
38
+ * @param url - The URL to be sanitized.
39
+ * @returns The original URL if it has the same origin as the current location; otherwise, returns `undefined`.
40
+ */
41
+ sanitizeUrl(url: string): string | undefined;
42
+ addNodeParams(params: Record<string, any>, keepBrowserHistory: boolean): void;
43
+ }
@@ -0,0 +1,78 @@
1
+ import { Luigi } from './luigi';
2
+ declare global {
3
+ interface Window {
4
+ Luigi: any;
5
+ __luigiThemeVars?: string[];
6
+ }
7
+ }
8
+ export declare class Theming {
9
+ #private;
10
+ constructor(luigi: Luigi);
11
+ /**
12
+ * Retrieves the available themes
13
+ * @memberof Theming
14
+ * @returns {promise} resolves an array of theming objects
15
+ * @example
16
+ * Luigi
17
+ * .theming()
18
+ * .getAvailableThemes()
19
+ * .then((themes) => {
20
+ * // Logic to generate theme selector
21
+ * });
22
+ */
23
+ getAvailableThemes(): Promise<any>;
24
+ /**
25
+ * Sets the current theme id
26
+ * @memberof Theming
27
+ * @param {string} id of a theme object
28
+ * @example
29
+ * Luigi.theming().setCurrentTheme('light')
30
+ */
31
+ setCurrentTheme(id: string): void;
32
+ /**
33
+ * Retrieves a theme object by name.
34
+ * @memberof Theming
35
+ * @param {string} id a theme id
36
+ * @returns {promise} resolves a theme object
37
+ * @example
38
+ * Luigi
39
+ * .theming()
40
+ * .getThemeObject('light')
41
+ * .then((id => {
42
+ * // Logic
43
+ * }))
44
+ */
45
+ getThemeObject(id: string): Promise<any>;
46
+ /**
47
+ * Retrieves the current active theme. Falls back to **defaultTheme** if none explicitly specified before.
48
+ * @memberof Theming
49
+ * @returns {string} theme id
50
+ * @example
51
+ * Luigi.theming().getCurrentTheme()
52
+ */
53
+ getCurrentTheme(): any;
54
+ /**
55
+ * The general status about the Theming configuration.
56
+ * @memberof Theming
57
+ * @returns {boolean} `true` if **settings.theming** configuration object is defined
58
+ * @example
59
+ * Luigi.theming().isThemingAvailable()
60
+ */
61
+ isThemingAvailable(): boolean;
62
+ /**
63
+ * Returns CSS variables with key value from Luigi if `@luigi-project/core/luigi_theme-vars.js` is included in the `index.html` and `settings.theming.variables==='fiori'` is defined in the {@link general-settings.md settings} section.
64
+ * It's also possible to define your own variables file which can be declared in `settings.theming.variables.file` in the {@link general-settings.md settings} section.
65
+ * The variables should be defined in a JSON file which starts with a `root` key.
66
+ * When you configure you own file, you can also implement exception handling by using the function `settings.theming.variables.errorHandling` which gets the error object as argument.
67
+ * @memberof Theming
68
+ * @returns {Object} CSS variables with their value.
69
+ * @example Luigi.theming().getCSSVariables();
70
+ */
71
+ getCSSVariables(): Promise<any>;
72
+ /**
73
+ * Initialize Theming Core API
74
+ * @memberof Theming
75
+ * @private
76
+ */
77
+ _init(): void;
78
+ }
@@ -0,0 +1,22 @@
1
+ import { AlertSettings, ConfirmationModalSettings, UserSettings } from '../modules/ux-module';
2
+ import { DirtyStatusService } from '../services/dirty-status.service';
3
+ import { Luigi } from './luigi';
4
+ export declare class UX {
5
+ luigi: Luigi;
6
+ dirtyStatusService: DirtyStatusService;
7
+ private appLoadingIndicatorSelector;
8
+ constructor(luigi: Luigi);
9
+ showAlert: (alertSettings: AlertSettings) => Promise<unknown>;
10
+ showConfirmationModal: (settings: ConfirmationModalSettings) => Promise<unknown>;
11
+ processUserSettingGroups: () => any[];
12
+ openUserSettings: (settings: UserSettings) => void;
13
+ closeUserSettings: () => void;
14
+ setDocumentTitle: (documentTitle: string) => void;
15
+ getDocumentTitle: () => string;
16
+ hideAppLoadingIndicator: () => void;
17
+ showLoadingIndicator: (containerWrapper: HTMLElement) => void | undefined;
18
+ hideLoadingIndicator: (containerWrapper: HTMLElement) => void | undefined;
19
+ addBackdrop: () => void | undefined;
20
+ removeBackdrop: () => void | undefined;
21
+ getDirtyStatus: () => boolean;
22
+ }
@@ -0,0 +1,40 @@
1
+ import { NavigationService } from './services/navigation.service';
2
+ import { RoutingService } from './services/routing.service';
3
+ import { LuigiConnector } from './types/connector';
4
+ export declare class LuigiEngine {
5
+ config: any;
6
+ _connector: LuigiConnector | undefined;
7
+ _app: any;
8
+ _ui: {
9
+ navService: NavigationService;
10
+ routingService: RoutingService;
11
+ luigi: import('./core-api/luigi').Luigi;
12
+ init: (luigi: import('./core-api/luigi').Luigi) => void;
13
+ update: (scopes?: string[]) => void;
14
+ updateMainContent: (currentNode: any, luigi: import('./core-api/luigi').Luigi) => Promise<void>;
15
+ openModal: (luigi: import('./core-api/luigi').Luigi, node: any, modalSettings: import('./services/navigation.service').ModalSettings, onCloseCallback?: () => void) => Promise<void>;
16
+ updateModalSettings: (modalSettings: import('./services/navigation.service').ModalSettings, addHistoryEntry: boolean, luigi: import('./core-api/luigi').Luigi) => void;
17
+ openDrawer: (luigi: import('./core-api/luigi').Luigi, node: any, modalSettings: import('./services/navigation.service').ModalSettings, onCloseCallback?: () => void) => Promise<void>;
18
+ };
19
+ _comm: {
20
+ luigi: import('./core-api/luigi').Luigi;
21
+ init: (luigi: import('./core-api/luigi').Luigi) => void;
22
+ addListeners: (containerElement: any, luigi: import('./core-api/luigi').Luigi) => void;
23
+ };
24
+ _ux: {
25
+ luigi: import('./core-api/luigi').Luigi | undefined;
26
+ documentTitle: any;
27
+ init: (luigi: import('./core-api/luigi').Luigi) => void;
28
+ processAlert: (alertSettings: import('./modules/ux-module').AlertSettings, openFromClient: boolean, containerElement: import('@luigi-project/container').LuigiContainer | import('@luigi-project/container').LuigiCompoundContainer) => void;
29
+ handleConfirmationModalRequest: (confirmationModalSettings: import('./modules/ux-module').ConfirmationModalSettings, containerElement: import('@luigi-project/container').LuigiContainer | import('@luigi-project/container').LuigiCompoundContainer) => void;
30
+ handleDirtyStatusRequest: (isDirty: boolean, source: any) => void;
31
+ };
32
+ _routing: {
33
+ init: (luigi: import('./core-api/luigi').Luigi) => void;
34
+ handlePageErrorHandler: (pageErrorHandler: import('./services/navigation.service').PageErrorHandler, node: import('./services/navigation.service').Node, luigi: import('./core-api/luigi').Luigi) => void;
35
+ handleExternalLinkNavigation: (externalLink: import('./services/navigation.service').ExternalLink) => void;
36
+ addSearchParamsFromClient(searchParams: Record<string, any>, keepBrowserHistory: boolean, luigi: import('./core-api/luigi').Luigi): void;
37
+ };
38
+ bootstrap(connector: LuigiConnector): void;
39
+ init(): void;
40
+ }