kimu-core 0.4.1 → 0.5.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.
- package/.editorconfig +116 -30
- package/.gitattributes +81 -11
- package/.github/FUNDING.yml +8 -8
- package/.github/kimu-copilot-instructions.md +3779 -3779
- package/.github/workflows/deploy-demo.yml +39 -39
- package/.nvmrc +1 -0
- package/.prettierignore +44 -0
- package/.prettierrc +16 -0
- package/FUNDING.md +31 -31
- package/icon.svg +10 -10
- package/kimu-core-0.5.0.tgz +0 -0
- package/package.json +10 -3
- package/scripts/minify-css-assets.js +82 -82
- package/src/core/index.ts +47 -47
- package/src/core/kimu-global-styles.ts +136 -136
- package/src/core/kimu-reactive.ts +196 -196
- package/src/extensions/{kimu-home → app-root}/component.ts +5 -5
- package/src/extensions/extensions-manifest.json +4 -4
- package/src/main.ts +3 -3
- package/src/modules-repository/api-axios/CHANGELOG.md +48 -48
- package/src/modules-repository/api-axios/QUICK-REFERENCE.md +178 -178
- package/src/modules-repository/api-axios/README.md +304 -304
- package/src/modules-repository/api-axios/api-axios-service.ts +355 -355
- package/src/modules-repository/api-axios/examples.ts +293 -293
- package/src/modules-repository/api-axios/index.ts +19 -19
- package/src/modules-repository/api-axios/interfaces.ts +71 -71
- package/src/modules-repository/api-axios/module.ts +41 -41
- package/src/modules-repository/api-core/CHANGELOG.md +42 -42
- package/src/modules-repository/api-core/QUICK-REFERENCE.md +192 -192
- package/src/modules-repository/api-core/README.md +435 -435
- package/src/modules-repository/api-core/api-core-service.ts +289 -289
- package/src/modules-repository/api-core/examples.ts +432 -432
- package/src/modules-repository/api-core/index.ts +8 -8
- package/src/modules-repository/api-core/interfaces.ts +83 -83
- package/src/modules-repository/api-core/module.ts +30 -30
- package/src/modules-repository/event-bus/README.md +273 -273
- package/src/modules-repository/event-bus/event-bus-service.ts +176 -176
- package/src/modules-repository/event-bus/module.ts +30 -30
- package/src/modules-repository/notification/README.md +423 -423
- package/src/modules-repository/notification/module.ts +30 -30
- package/src/modules-repository/notification/notification-service.ts +436 -436
- package/src/modules-repository/router/README.it.md +61 -10
- package/src/modules-repository/router/README.md +61 -10
- package/src/modules-repository/router/router-config.ts.example +61 -0
- package/src/modules-repository/router/router.ts +18 -0
- package/src/modules-repository/state/README.md +409 -409
- package/src/modules-repository/state/module.ts +30 -30
- package/src/modules-repository/state/state-service.ts +296 -296
- package/src/modules-repository/theme/README.md +311 -267
- package/src/modules-repository/theme/module.ts +30 -30
- package/src/modules-repository/theme/pre-build.js +40 -40
- package/src/modules-repository/theme/theme-service.ts +411 -389
- package/src/modules-repository/theme/themes/theme-cherry-blossom.css +78 -78
- package/src/modules-repository/theme/themes/theme-cozy.css +111 -111
- package/src/modules-repository/theme/themes/theme-cyberpunk.css +150 -150
- package/src/modules-repository/theme/themes/theme-dark.css +79 -79
- package/src/modules-repository/theme/themes/theme-forest.css +171 -171
- package/src/modules-repository/theme/themes/theme-gold.css +100 -100
- package/src/modules-repository/theme/themes/theme-high-contrast.css +126 -126
- package/src/modules-repository/theme/themes/theme-lava.css +101 -101
- package/src/modules-repository/theme/themes/theme-lavender.css +90 -90
- package/src/modules-repository/theme/themes/theme-light.css +79 -79
- package/src/modules-repository/theme/themes/theme-matrix.css +103 -103
- package/src/modules-repository/theme/themes/theme-midnight.css +81 -81
- package/src/modules-repository/theme/themes/theme-nord.css +94 -94
- package/src/modules-repository/theme/themes/theme-ocean.css +84 -84
- package/src/modules-repository/theme/themes/theme-retro80s.css +343 -343
- package/src/modules-repository/theme/themes/theme-sunset.css +62 -62
- package/src/modules-repository/theme/themes-config-default.json +19 -0
- package/src/modules-repository/theme/themes-config.d.ts +27 -27
- package/src/modules-repository/theme/{themes-config.json → themes-config.json.example} +223 -213
- /package/src/extensions/{kimu-home → app-root}/lang/en.json +0 -0
- /package/src/extensions/{kimu-home → app-root}/lang/it.json +0 -0
- /package/src/extensions/{kimu-home → app-root}/style.css +0 -0
- /package/src/extensions/{kimu-home → app-root}/view.html +0 -0
|
@@ -8,23 +8,74 @@ Questo modulo fornisce un servizio di routing per kimu-core, permettendo la gest
|
|
|
8
8
|
- Callback sugli eventi di cambio rotta
|
|
9
9
|
- API per registrare nuove rotte dinamicamente
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Configurazione Post-Installazione
|
|
12
|
+
|
|
13
|
+
Dopo aver installato il modulo router, devi creare un file di configurazione delle rotte:
|
|
14
|
+
|
|
15
|
+
### 1. Crea il file di configurazione routes
|
|
16
|
+
|
|
17
|
+
Copia il file di esempio nella cartella config:
|
|
18
|
+
```bash
|
|
19
|
+
mkdir -p src/config/router
|
|
20
|
+
cp src/modules/router/router-config.ts.example src/config/router/router-config.ts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Oppure crea `src/config/router/router-config.ts` manualmente:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { RouteConfig } from '../../modules/router/router';
|
|
27
|
+
|
|
28
|
+
export const routes: RouteConfig[] = [
|
|
29
|
+
{
|
|
30
|
+
path: '/',
|
|
31
|
+
component: 'app-home',
|
|
32
|
+
name: 'home',
|
|
33
|
+
meta: { title: 'Home' }
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
path: '/about',
|
|
37
|
+
component: 'app-about',
|
|
38
|
+
name: 'about',
|
|
39
|
+
meta: { title: 'Chi Siamo' }
|
|
40
|
+
},
|
|
41
|
+
// Aggiungi le tue rotte qui...
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Inizializza il router in main.ts
|
|
12
46
|
|
|
13
47
|
```typescript
|
|
14
|
-
import {
|
|
48
|
+
import { KimuModuleManager } from './core/kimu-module-manager';
|
|
49
|
+
import RouterModule from './modules/router/module';
|
|
50
|
+
import { routes } from './config/router/router-config';
|
|
15
51
|
|
|
16
|
-
const
|
|
17
|
-
router.configure([
|
|
18
|
-
{ path: '/', component: HomeComponent },
|
|
19
|
-
{ path: '/about', component: AboutComponent },
|
|
20
|
-
]);
|
|
52
|
+
const moduleManager = KimuModuleManager.getInstance();
|
|
21
53
|
|
|
54
|
+
// Opzione 1: Passa le rotte durante l'inizializzazione
|
|
55
|
+
const routerModule = new RouterModule('router', '1.0.0', { routes });
|
|
56
|
+
await moduleManager.loadModule(routerModule);
|
|
57
|
+
|
|
58
|
+
// Opzione 2: Configura dopo l'inizializzazione
|
|
59
|
+
const router = moduleManager.getModule('router').getService();
|
|
60
|
+
router.configure(routes);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. Naviga tra le rotte
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const router = moduleManager.getModule('router').getService();
|
|
67
|
+
|
|
68
|
+
// Naviga verso una rotta
|
|
69
|
+
router.navigate('/about');
|
|
70
|
+
|
|
71
|
+
// Ascolta i cambiamenti di rotta
|
|
22
72
|
router.onRouteChange((route) => {
|
|
23
|
-
|
|
73
|
+
console.log('Rotta cambiata:', route.path);
|
|
74
|
+
// Aggiorna UI, carica componenti, ecc.
|
|
24
75
|
});
|
|
25
76
|
|
|
26
|
-
//
|
|
27
|
-
router.
|
|
77
|
+
// Ottieni la rotta corrente
|
|
78
|
+
const currentRoute = router.getCurrentRoute();
|
|
28
79
|
```
|
|
29
80
|
|
|
30
81
|
## Estensione
|
|
@@ -8,23 +8,74 @@ This module provides a routing service for kimu-core, allowing you to manage rou
|
|
|
8
8
|
- Callback on route change events
|
|
9
9
|
- API to register new routes dynamically
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Post-Installation Setup
|
|
12
|
+
|
|
13
|
+
After installing the router module, you need to create a routes configuration file:
|
|
14
|
+
|
|
15
|
+
### 1. Create routes configuration file
|
|
16
|
+
|
|
17
|
+
Copy the example file to your config folder:
|
|
18
|
+
```bash
|
|
19
|
+
mkdir -p src/config/router
|
|
20
|
+
cp src/modules/router/router-config.ts.example src/config/router/router-config.ts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or create `src/config/router/router-config.ts` manually:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { RouteConfig } from '../../modules/router/router';
|
|
27
|
+
|
|
28
|
+
export const routes: RouteConfig[] = [
|
|
29
|
+
{
|
|
30
|
+
path: '/',
|
|
31
|
+
component: 'app-home',
|
|
32
|
+
name: 'home',
|
|
33
|
+
meta: { title: 'Home' }
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
path: '/about',
|
|
37
|
+
component: 'app-about',
|
|
38
|
+
name: 'about',
|
|
39
|
+
meta: { title: 'About' }
|
|
40
|
+
},
|
|
41
|
+
// Add your routes here...
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Initialize router in main.ts
|
|
12
46
|
|
|
13
47
|
```typescript
|
|
14
|
-
import {
|
|
48
|
+
import { KimuModuleManager } from './core/kimu-module-manager';
|
|
49
|
+
import RouterModule from './modules/router/module';
|
|
50
|
+
import { routes } from './config/router/router-config';
|
|
15
51
|
|
|
16
|
-
const
|
|
17
|
-
router.configure([
|
|
18
|
-
{ path: '/', component: HomeComponent },
|
|
19
|
-
{ path: '/about', component: AboutComponent },
|
|
20
|
-
]);
|
|
52
|
+
const moduleManager = KimuModuleManager.getInstance();
|
|
21
53
|
|
|
54
|
+
// Option 1: Pass routes during initialization
|
|
55
|
+
const routerModule = new RouterModule('router', '1.0.0', { routes });
|
|
56
|
+
await moduleManager.loadModule(routerModule);
|
|
57
|
+
|
|
58
|
+
// Option 2: Configure after initialization
|
|
59
|
+
const router = moduleManager.getModule('router').getService();
|
|
60
|
+
router.configure(routes);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. Navigate between routes
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const router = moduleManager.getModule('router').getService();
|
|
67
|
+
|
|
68
|
+
// Navigate to a route
|
|
69
|
+
router.navigate('/about');
|
|
70
|
+
|
|
71
|
+
// Listen for route changes
|
|
22
72
|
router.onRouteChange((route) => {
|
|
23
|
-
|
|
73
|
+
console.log('Route changed to:', route.path);
|
|
74
|
+
// Update UI, load components, etc.
|
|
24
75
|
});
|
|
25
76
|
|
|
26
|
-
//
|
|
27
|
-
router.
|
|
77
|
+
// Get current route
|
|
78
|
+
const currentRoute = router.getCurrentRoute();
|
|
28
79
|
```
|
|
29
80
|
|
|
30
81
|
## Extension
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Router Configuration Example File
|
|
2
|
+
// Copy this file to: src/config/router/router-config.ts
|
|
3
|
+
//
|
|
4
|
+
// Commands:
|
|
5
|
+
// mkdir -p src/config/router
|
|
6
|
+
// cp src/modules/router/router-config.ts.example src/config/router/router-config.ts
|
|
7
|
+
//
|
|
8
|
+
// Then import in your main.ts:
|
|
9
|
+
// import { routes } from './config/router/router-config';
|
|
10
|
+
//
|
|
11
|
+
// This file defines all routes for your KIMU application.
|
|
12
|
+
// Each route maps a URL path to a component (extension).
|
|
13
|
+
|
|
14
|
+
import { RouteConfig } from '../../modules/router/router';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Application routes configuration
|
|
18
|
+
*
|
|
19
|
+
* Define your routes here following this pattern:
|
|
20
|
+
* {
|
|
21
|
+
* path: '/url-path', // The URL path to match
|
|
22
|
+
* component: ComponentName, // The component/extension to render
|
|
23
|
+
* name: 'route-name', // Optional: friendly name for the route
|
|
24
|
+
* meta: { ... } // Optional: custom metadata
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
export const routes: RouteConfig[] = [
|
|
28
|
+
{
|
|
29
|
+
path: '/',
|
|
30
|
+
component: 'app-home', // or import and use: HomeComponent
|
|
31
|
+
name: 'home',
|
|
32
|
+
meta: { title: 'Home' }
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
path: '/about',
|
|
36
|
+
component: 'app-about',
|
|
37
|
+
name: 'about',
|
|
38
|
+
meta: { title: 'About Us' }
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
path: '/contact',
|
|
42
|
+
component: 'app-contact',
|
|
43
|
+
name: 'contact',
|
|
44
|
+
meta: { title: 'Contact' }
|
|
45
|
+
},
|
|
46
|
+
// Add more routes here...
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Usage in main.ts:
|
|
51
|
+
*
|
|
52
|
+
* import RouterModule from './modules/router/module';
|
|
53
|
+
* import { routes } from './router-config';
|
|
54
|
+
*
|
|
55
|
+
* const routerModule = new RouterModule('router', '1.0.0', { routes });
|
|
56
|
+
* await moduleManager.loadModule(routerModule);
|
|
57
|
+
*
|
|
58
|
+
* // Or configure after initialization:
|
|
59
|
+
* const router = moduleManager.getModule('router').getService();
|
|
60
|
+
* router.configure(routes);
|
|
61
|
+
*/
|
|
@@ -70,8 +70,26 @@ export class KimuRouterService {
|
|
|
70
70
|
/**
|
|
71
71
|
* Configure the router with a set of routes.
|
|
72
72
|
* @param routes Array of RouteConfig
|
|
73
|
+
* @throws Error if routes array is empty or undefined
|
|
73
74
|
*/
|
|
74
75
|
public configure(routes: RouteConfig[]): void {
|
|
76
|
+
if (!routes || routes.length === 0) {
|
|
77
|
+
console.error(
|
|
78
|
+
'\n⚠️ KIMU Router: No routes configured!\n\n' +
|
|
79
|
+
'The router requires a configuration file with your application routes.\n\n' +
|
|
80
|
+
'Expected location: src/config/router/router-config.ts\n\n' +
|
|
81
|
+
'To create the configuration file:\n' +
|
|
82
|
+
'1. Create config folder: mkdir -p src/config/router\n' +
|
|
83
|
+
'2. Copy the example: cp src/modules/router/router-config.ts.example src/config/router/router-config.ts\n' +
|
|
84
|
+
'3. Edit src/config/router/router-config.ts to define your routes\n' +
|
|
85
|
+
'4. Import and pass routes to the router in main.ts\n\n' +
|
|
86
|
+
'Example:\n' +
|
|
87
|
+
' import { routes } from \'./config/router/router-config\';\n' +
|
|
88
|
+
' router.configure(routes);\n\n' +
|
|
89
|
+
'See: src/modules/router/router-config.ts.example for a complete example.\n'
|
|
90
|
+
);
|
|
91
|
+
throw new Error('Router configuration missing. Please create src/config/router/router-config.ts');
|
|
92
|
+
}
|
|
75
93
|
this.routes = routes;
|
|
76
94
|
}
|
|
77
95
|
|