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
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event Bus Service for KIMU-Core
|
|
3
|
-
*
|
|
4
|
-
* Provides a global publish/subscribe mechanism for component communication.
|
|
5
|
-
* Components can emit and listen to custom events without direct coupling.
|
|
6
|
-
*
|
|
7
|
-
* @module EventBusService
|
|
8
|
-
* @version 1.0.0
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export type EventCallback = (...args: any[]) => void;
|
|
12
|
-
|
|
13
|
-
export interface EventSubscription {
|
|
14
|
-
event: string;
|
|
15
|
-
callback: EventCallback;
|
|
16
|
-
unsubscribe: () => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* EventBusService - Global event bus for component communication
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* import { eventBusService } from './modules/event-bus/event-bus-service';
|
|
25
|
-
*
|
|
26
|
-
* // Subscribe to an event
|
|
27
|
-
* const subscription = eventBusService.on('user:login', (user) => {
|
|
28
|
-
* console.log('User logged in:', user);
|
|
29
|
-
* });
|
|
30
|
-
*
|
|
31
|
-
* // Emit an event
|
|
32
|
-
* eventBusService.emit('user:login', { id: 1, name: 'John' });
|
|
33
|
-
*
|
|
34
|
-
* // Unsubscribe
|
|
35
|
-
* subscription.unsubscribe();
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export class EventBusService {
|
|
39
|
-
private events: Map<string, Set<EventCallback>> = new Map();
|
|
40
|
-
private debugMode: boolean = false;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Enable or disable debug mode for event logging
|
|
44
|
-
*/
|
|
45
|
-
setDebugMode(enabled: boolean): void {
|
|
46
|
-
this.debugMode = enabled;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Subscribe to an event
|
|
51
|
-
*
|
|
52
|
-
* @param event - Event name (e.g., 'user:login', 'data:updated')
|
|
53
|
-
* @param callback - Function to call when event is emitted
|
|
54
|
-
* @returns Subscription object with unsubscribe method
|
|
55
|
-
*/
|
|
56
|
-
on(event: string, callback: EventCallback): EventSubscription {
|
|
57
|
-
if (!this.events.has(event)) {
|
|
58
|
-
this.events.set(event, new Set());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.events.get(event)!.add(callback);
|
|
62
|
-
|
|
63
|
-
if (this.debugMode) {
|
|
64
|
-
console.log(`[EventBus] Subscribed to: ${event}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
event,
|
|
69
|
-
callback,
|
|
70
|
-
unsubscribe: () => this.off(event, callback)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Subscribe to an event only once (auto-unsubscribe after first emit)
|
|
76
|
-
*
|
|
77
|
-
* @param event - Event name
|
|
78
|
-
* @param callback - Function to call when event is emitted
|
|
79
|
-
* @returns Subscription object
|
|
80
|
-
*/
|
|
81
|
-
once(event: string, callback: EventCallback): EventSubscription {
|
|
82
|
-
const wrappedCallback = (...args: any[]) => {
|
|
83
|
-
callback(...args);
|
|
84
|
-
this.off(event, wrappedCallback);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return this.on(event, wrappedCallback);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Unsubscribe from an event
|
|
92
|
-
*
|
|
93
|
-
* @param event - Event name
|
|
94
|
-
* @param callback - Callback to remove
|
|
95
|
-
*/
|
|
96
|
-
off(event: string, callback: EventCallback): void {
|
|
97
|
-
if (this.events.has(event)) {
|
|
98
|
-
this.events.get(event)!.delete(callback);
|
|
99
|
-
|
|
100
|
-
// Clean up empty event sets
|
|
101
|
-
if (this.events.get(event)!.size === 0) {
|
|
102
|
-
this.events.delete(event);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (this.debugMode) {
|
|
106
|
-
console.log(`[EventBus] Unsubscribed from: ${event}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Emit an event to all subscribers
|
|
113
|
-
*
|
|
114
|
-
* @param event - Event name
|
|
115
|
-
* @param args - Arguments to pass to callbacks
|
|
116
|
-
*/
|
|
117
|
-
emit(event: string, ...args: any[]): void {
|
|
118
|
-
if (this.debugMode) {
|
|
119
|
-
console.log(`[EventBus] Emitting: ${event}`, args);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (this.events.has(event)) {
|
|
123
|
-
const callbacks = Array.from(this.events.get(event)!);
|
|
124
|
-
callbacks.forEach(callback => {
|
|
125
|
-
try {
|
|
126
|
-
callback(...args);
|
|
127
|
-
} catch (error) {
|
|
128
|
-
console.error(`[EventBus] Error in event handler for "${event}":`, error);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Remove all subscribers for a specific event or all events
|
|
136
|
-
*
|
|
137
|
-
* @param event - Event name (optional, if not provided clears all)
|
|
138
|
-
*/
|
|
139
|
-
clear(event?: string): void {
|
|
140
|
-
if (event) {
|
|
141
|
-
this.events.delete(event);
|
|
142
|
-
if (this.debugMode) {
|
|
143
|
-
console.log(`[EventBus] Cleared event: ${event}`);
|
|
144
|
-
}
|
|
145
|
-
} else {
|
|
146
|
-
this.events.clear();
|
|
147
|
-
if (this.debugMode) {
|
|
148
|
-
console.log('[EventBus] Cleared all events');
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Get list of all registered events
|
|
155
|
-
*/
|
|
156
|
-
getEventList(): string[] {
|
|
157
|
-
return Array.from(this.events.keys());
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Get number of subscribers for a specific event
|
|
162
|
-
*/
|
|
163
|
-
getSubscriberCount(event: string): number {
|
|
164
|
-
return this.events.get(event)?.size || 0;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Check if an event has any subscribers
|
|
169
|
-
*/
|
|
170
|
-
hasSubscribers(event: string): boolean {
|
|
171
|
-
return this.getSubscriberCount(event) > 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Export singleton instance
|
|
176
|
-
export const eventBusService = new EventBusService();
|
|
1
|
+
/**
|
|
2
|
+
* Event Bus Service for KIMU-Core
|
|
3
|
+
*
|
|
4
|
+
* Provides a global publish/subscribe mechanism for component communication.
|
|
5
|
+
* Components can emit and listen to custom events without direct coupling.
|
|
6
|
+
*
|
|
7
|
+
* @module EventBusService
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type EventCallback = (...args: any[]) => void;
|
|
12
|
+
|
|
13
|
+
export interface EventSubscription {
|
|
14
|
+
event: string;
|
|
15
|
+
callback: EventCallback;
|
|
16
|
+
unsubscribe: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* EventBusService - Global event bus for component communication
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { eventBusService } from './modules/event-bus/event-bus-service';
|
|
25
|
+
*
|
|
26
|
+
* // Subscribe to an event
|
|
27
|
+
* const subscription = eventBusService.on('user:login', (user) => {
|
|
28
|
+
* console.log('User logged in:', user);
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Emit an event
|
|
32
|
+
* eventBusService.emit('user:login', { id: 1, name: 'John' });
|
|
33
|
+
*
|
|
34
|
+
* // Unsubscribe
|
|
35
|
+
* subscription.unsubscribe();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export class EventBusService {
|
|
39
|
+
private events: Map<string, Set<EventCallback>> = new Map();
|
|
40
|
+
private debugMode: boolean = false;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Enable or disable debug mode for event logging
|
|
44
|
+
*/
|
|
45
|
+
setDebugMode(enabled: boolean): void {
|
|
46
|
+
this.debugMode = enabled;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Subscribe to an event
|
|
51
|
+
*
|
|
52
|
+
* @param event - Event name (e.g., 'user:login', 'data:updated')
|
|
53
|
+
* @param callback - Function to call when event is emitted
|
|
54
|
+
* @returns Subscription object with unsubscribe method
|
|
55
|
+
*/
|
|
56
|
+
on(event: string, callback: EventCallback): EventSubscription {
|
|
57
|
+
if (!this.events.has(event)) {
|
|
58
|
+
this.events.set(event, new Set());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.events.get(event)!.add(callback);
|
|
62
|
+
|
|
63
|
+
if (this.debugMode) {
|
|
64
|
+
console.log(`[EventBus] Subscribed to: ${event}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
event,
|
|
69
|
+
callback,
|
|
70
|
+
unsubscribe: () => this.off(event, callback)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Subscribe to an event only once (auto-unsubscribe after first emit)
|
|
76
|
+
*
|
|
77
|
+
* @param event - Event name
|
|
78
|
+
* @param callback - Function to call when event is emitted
|
|
79
|
+
* @returns Subscription object
|
|
80
|
+
*/
|
|
81
|
+
once(event: string, callback: EventCallback): EventSubscription {
|
|
82
|
+
const wrappedCallback = (...args: any[]) => {
|
|
83
|
+
callback(...args);
|
|
84
|
+
this.off(event, wrappedCallback);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return this.on(event, wrappedCallback);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Unsubscribe from an event
|
|
92
|
+
*
|
|
93
|
+
* @param event - Event name
|
|
94
|
+
* @param callback - Callback to remove
|
|
95
|
+
*/
|
|
96
|
+
off(event: string, callback: EventCallback): void {
|
|
97
|
+
if (this.events.has(event)) {
|
|
98
|
+
this.events.get(event)!.delete(callback);
|
|
99
|
+
|
|
100
|
+
// Clean up empty event sets
|
|
101
|
+
if (this.events.get(event)!.size === 0) {
|
|
102
|
+
this.events.delete(event);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.debugMode) {
|
|
106
|
+
console.log(`[EventBus] Unsubscribed from: ${event}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Emit an event to all subscribers
|
|
113
|
+
*
|
|
114
|
+
* @param event - Event name
|
|
115
|
+
* @param args - Arguments to pass to callbacks
|
|
116
|
+
*/
|
|
117
|
+
emit(event: string, ...args: any[]): void {
|
|
118
|
+
if (this.debugMode) {
|
|
119
|
+
console.log(`[EventBus] Emitting: ${event}`, args);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (this.events.has(event)) {
|
|
123
|
+
const callbacks = Array.from(this.events.get(event)!);
|
|
124
|
+
callbacks.forEach(callback => {
|
|
125
|
+
try {
|
|
126
|
+
callback(...args);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error(`[EventBus] Error in event handler for "${event}":`, error);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Remove all subscribers for a specific event or all events
|
|
136
|
+
*
|
|
137
|
+
* @param event - Event name (optional, if not provided clears all)
|
|
138
|
+
*/
|
|
139
|
+
clear(event?: string): void {
|
|
140
|
+
if (event) {
|
|
141
|
+
this.events.delete(event);
|
|
142
|
+
if (this.debugMode) {
|
|
143
|
+
console.log(`[EventBus] Cleared event: ${event}`);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
this.events.clear();
|
|
147
|
+
if (this.debugMode) {
|
|
148
|
+
console.log('[EventBus] Cleared all events');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Get list of all registered events
|
|
155
|
+
*/
|
|
156
|
+
getEventList(): string[] {
|
|
157
|
+
return Array.from(this.events.keys());
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get number of subscribers for a specific event
|
|
162
|
+
*/
|
|
163
|
+
getSubscriberCount(event: string): number {
|
|
164
|
+
return this.events.get(event)?.size || 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Check if an event has any subscribers
|
|
169
|
+
*/
|
|
170
|
+
hasSubscribers(event: string): boolean {
|
|
171
|
+
return this.getSubscriberCount(event) > 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Export singleton instance
|
|
176
|
+
export const eventBusService = new EventBusService();
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event Bus Module for KIMU-Core
|
|
3
|
-
*
|
|
4
|
-
* Provides global event bus for component communication.
|
|
5
|
-
*
|
|
6
|
-
* @module EventBusModule
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { KimuModule } from '../../core/kimu-module';
|
|
10
|
-
import { eventBusService } from './event-bus-service';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* EventBusModule - Module class for event bus integration
|
|
14
|
-
*/
|
|
15
|
-
export default class EventBusModule extends KimuModule {
|
|
16
|
-
constructor(name = 'event-bus', version = '1.0.0', options?: any) {
|
|
17
|
-
super(name, version, options);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get the event bus service instance
|
|
22
|
-
*/
|
|
23
|
-
getService() {
|
|
24
|
-
return eventBusService;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Re-export for convenience
|
|
29
|
-
export { eventBusService } from './event-bus-service';
|
|
30
|
-
export { EventBusService } from './event-bus-service';
|
|
1
|
+
/**
|
|
2
|
+
* Event Bus Module for KIMU-Core
|
|
3
|
+
*
|
|
4
|
+
* Provides global event bus for component communication.
|
|
5
|
+
*
|
|
6
|
+
* @module EventBusModule
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { KimuModule } from '../../core/kimu-module';
|
|
10
|
+
import { eventBusService } from './event-bus-service';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* EventBusModule - Module class for event bus integration
|
|
14
|
+
*/
|
|
15
|
+
export default class EventBusModule extends KimuModule {
|
|
16
|
+
constructor(name = 'event-bus', version = '1.0.0', options?: any) {
|
|
17
|
+
super(name, version, options);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get the event bus service instance
|
|
22
|
+
*/
|
|
23
|
+
getService() {
|
|
24
|
+
return eventBusService;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Re-export for convenience
|
|
29
|
+
export { eventBusService } from './event-bus-service';
|
|
30
|
+
export { EventBusService } from './event-bus-service';
|