kimu-core 0.4.1 → 0.4.2

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 (67) hide show
  1. package/.editorconfig +116 -30
  2. package/.gitattributes +81 -11
  3. package/.github/FUNDING.yml +8 -8
  4. package/.github/kimu-copilot-instructions.md +3779 -3779
  5. package/.github/workflows/deploy-demo.yml +39 -39
  6. package/.nvmrc +1 -0
  7. package/.prettierignore +44 -0
  8. package/.prettierrc +16 -0
  9. package/FUNDING.md +31 -31
  10. package/icon.svg +10 -10
  11. package/package.json +9 -2
  12. package/scripts/minify-css-assets.js +82 -82
  13. package/src/core/index.ts +47 -47
  14. package/src/core/kimu-global-styles.ts +136 -136
  15. package/src/core/kimu-reactive.ts +196 -196
  16. package/src/modules-repository/api-axios/CHANGELOG.md +48 -48
  17. package/src/modules-repository/api-axios/QUICK-REFERENCE.md +178 -178
  18. package/src/modules-repository/api-axios/README.md +304 -304
  19. package/src/modules-repository/api-axios/api-axios-service.ts +355 -355
  20. package/src/modules-repository/api-axios/examples.ts +293 -293
  21. package/src/modules-repository/api-axios/index.ts +19 -19
  22. package/src/modules-repository/api-axios/interfaces.ts +71 -71
  23. package/src/modules-repository/api-axios/module.ts +41 -41
  24. package/src/modules-repository/api-core/CHANGELOG.md +42 -42
  25. package/src/modules-repository/api-core/QUICK-REFERENCE.md +192 -192
  26. package/src/modules-repository/api-core/README.md +435 -435
  27. package/src/modules-repository/api-core/api-core-service.ts +289 -289
  28. package/src/modules-repository/api-core/examples.ts +432 -432
  29. package/src/modules-repository/api-core/index.ts +8 -8
  30. package/src/modules-repository/api-core/interfaces.ts +83 -83
  31. package/src/modules-repository/api-core/module.ts +30 -30
  32. package/src/modules-repository/event-bus/README.md +273 -273
  33. package/src/modules-repository/event-bus/event-bus-service.ts +176 -176
  34. package/src/modules-repository/event-bus/module.ts +30 -30
  35. package/src/modules-repository/notification/README.md +423 -423
  36. package/src/modules-repository/notification/module.ts +30 -30
  37. package/src/modules-repository/notification/notification-service.ts +436 -436
  38. package/src/modules-repository/router/README.it.md +61 -10
  39. package/src/modules-repository/router/README.md +61 -10
  40. package/src/modules-repository/router/router-config.ts.example +61 -0
  41. package/src/modules-repository/router/router.ts +18 -0
  42. package/src/modules-repository/state/README.md +409 -409
  43. package/src/modules-repository/state/module.ts +30 -30
  44. package/src/modules-repository/state/state-service.ts +296 -296
  45. package/src/modules-repository/theme/README.md +311 -267
  46. package/src/modules-repository/theme/module.ts +30 -30
  47. package/src/modules-repository/theme/pre-build.js +40 -40
  48. package/src/modules-repository/theme/theme-service.ts +411 -389
  49. package/src/modules-repository/theme/themes/theme-cherry-blossom.css +78 -78
  50. package/src/modules-repository/theme/themes/theme-cozy.css +111 -111
  51. package/src/modules-repository/theme/themes/theme-cyberpunk.css +150 -150
  52. package/src/modules-repository/theme/themes/theme-dark.css +79 -79
  53. package/src/modules-repository/theme/themes/theme-forest.css +171 -171
  54. package/src/modules-repository/theme/themes/theme-gold.css +100 -100
  55. package/src/modules-repository/theme/themes/theme-high-contrast.css +126 -126
  56. package/src/modules-repository/theme/themes/theme-lava.css +101 -101
  57. package/src/modules-repository/theme/themes/theme-lavender.css +90 -90
  58. package/src/modules-repository/theme/themes/theme-light.css +79 -79
  59. package/src/modules-repository/theme/themes/theme-matrix.css +103 -103
  60. package/src/modules-repository/theme/themes/theme-midnight.css +81 -81
  61. package/src/modules-repository/theme/themes/theme-nord.css +94 -94
  62. package/src/modules-repository/theme/themes/theme-ocean.css +84 -84
  63. package/src/modules-repository/theme/themes/theme-retro80s.css +343 -343
  64. package/src/modules-repository/theme/themes/theme-sunset.css +62 -62
  65. package/src/modules-repository/theme/themes-config-default.json +19 -0
  66. package/src/modules-repository/theme/themes-config.d.ts +27 -27
  67. package/src/modules-repository/theme/{themes-config.json → themes-config.json.example} +223 -213
@@ -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
- ## Utilizzo
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 { KimuRouterService } from './src/modules/router/router';
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 router = KimuRouterService.getInstance();
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
- // Logica per gestire il cambio rotta
73
+ console.log('Rotta cambiata:', route.path);
74
+ // Aggiorna UI, carica componenti, ecc.
24
75
  });
25
76
 
26
- // Per navigare
27
- router.navigate('/about');
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
- ## Usage
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 { KimuRouterService } from './src/modules/router/router';
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 router = KimuRouterService.getInstance();
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
- // Logic to handle route change
73
+ console.log('Route changed to:', route.path);
74
+ // Update UI, load components, etc.
24
75
  });
25
76
 
26
- // To navigate
27
- router.navigate('/about');
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