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.
Files changed (75) 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/kimu-core-0.5.0.tgz +0 -0
  12. package/package.json +10 -3
  13. package/scripts/minify-css-assets.js +82 -82
  14. package/src/core/index.ts +47 -47
  15. package/src/core/kimu-global-styles.ts +136 -136
  16. package/src/core/kimu-reactive.ts +196 -196
  17. package/src/extensions/{kimu-home → app-root}/component.ts +5 -5
  18. package/src/extensions/extensions-manifest.json +4 -4
  19. package/src/main.ts +3 -3
  20. package/src/modules-repository/api-axios/CHANGELOG.md +48 -48
  21. package/src/modules-repository/api-axios/QUICK-REFERENCE.md +178 -178
  22. package/src/modules-repository/api-axios/README.md +304 -304
  23. package/src/modules-repository/api-axios/api-axios-service.ts +355 -355
  24. package/src/modules-repository/api-axios/examples.ts +293 -293
  25. package/src/modules-repository/api-axios/index.ts +19 -19
  26. package/src/modules-repository/api-axios/interfaces.ts +71 -71
  27. package/src/modules-repository/api-axios/module.ts +41 -41
  28. package/src/modules-repository/api-core/CHANGELOG.md +42 -42
  29. package/src/modules-repository/api-core/QUICK-REFERENCE.md +192 -192
  30. package/src/modules-repository/api-core/README.md +435 -435
  31. package/src/modules-repository/api-core/api-core-service.ts +289 -289
  32. package/src/modules-repository/api-core/examples.ts +432 -432
  33. package/src/modules-repository/api-core/index.ts +8 -8
  34. package/src/modules-repository/api-core/interfaces.ts +83 -83
  35. package/src/modules-repository/api-core/module.ts +30 -30
  36. package/src/modules-repository/event-bus/README.md +273 -273
  37. package/src/modules-repository/event-bus/event-bus-service.ts +176 -176
  38. package/src/modules-repository/event-bus/module.ts +30 -30
  39. package/src/modules-repository/notification/README.md +423 -423
  40. package/src/modules-repository/notification/module.ts +30 -30
  41. package/src/modules-repository/notification/notification-service.ts +436 -436
  42. package/src/modules-repository/router/README.it.md +61 -10
  43. package/src/modules-repository/router/README.md +61 -10
  44. package/src/modules-repository/router/router-config.ts.example +61 -0
  45. package/src/modules-repository/router/router.ts +18 -0
  46. package/src/modules-repository/state/README.md +409 -409
  47. package/src/modules-repository/state/module.ts +30 -30
  48. package/src/modules-repository/state/state-service.ts +296 -296
  49. package/src/modules-repository/theme/README.md +311 -267
  50. package/src/modules-repository/theme/module.ts +30 -30
  51. package/src/modules-repository/theme/pre-build.js +40 -40
  52. package/src/modules-repository/theme/theme-service.ts +411 -389
  53. package/src/modules-repository/theme/themes/theme-cherry-blossom.css +78 -78
  54. package/src/modules-repository/theme/themes/theme-cozy.css +111 -111
  55. package/src/modules-repository/theme/themes/theme-cyberpunk.css +150 -150
  56. package/src/modules-repository/theme/themes/theme-dark.css +79 -79
  57. package/src/modules-repository/theme/themes/theme-forest.css +171 -171
  58. package/src/modules-repository/theme/themes/theme-gold.css +100 -100
  59. package/src/modules-repository/theme/themes/theme-high-contrast.css +126 -126
  60. package/src/modules-repository/theme/themes/theme-lava.css +101 -101
  61. package/src/modules-repository/theme/themes/theme-lavender.css +90 -90
  62. package/src/modules-repository/theme/themes/theme-light.css +79 -79
  63. package/src/modules-repository/theme/themes/theme-matrix.css +103 -103
  64. package/src/modules-repository/theme/themes/theme-midnight.css +81 -81
  65. package/src/modules-repository/theme/themes/theme-nord.css +94 -94
  66. package/src/modules-repository/theme/themes/theme-ocean.css +84 -84
  67. package/src/modules-repository/theme/themes/theme-retro80s.css +343 -343
  68. package/src/modules-repository/theme/themes/theme-sunset.css +62 -62
  69. package/src/modules-repository/theme/themes-config-default.json +19 -0
  70. package/src/modules-repository/theme/themes-config.d.ts +27 -27
  71. package/src/modules-repository/theme/{themes-config.json → themes-config.json.example} +223 -213
  72. /package/src/extensions/{kimu-home → app-root}/lang/en.json +0 -0
  73. /package/src/extensions/{kimu-home → app-root}/lang/it.json +0 -0
  74. /package/src/extensions/{kimu-home → app-root}/style.css +0 -0
  75. /package/src/extensions/{kimu-home → app-root}/view.html +0 -0
@@ -1,192 +1,192 @@
1
- # KIMU API Core Module - Quick Reference
2
-
3
- ## Installation
4
- ```bash
5
- # Using kimu-cli (when available)
6
- kimu install module api-core
7
-
8
- # Manual installation
9
- # Copy src/modules/api-core to your project
10
- ```
11
-
12
- ## Quick Start
13
-
14
- ```typescript
15
- import { apiCoreService } from './modules/api-core/api-core-service';
16
-
17
- // Configure
18
- apiCoreService.configure({
19
- baseURL: 'https://api.example.com',
20
- timeout: 10000,
21
- headers: {
22
- 'Authorization': 'Bearer YOUR_TOKEN'
23
- }
24
- });
25
-
26
- // Make requests
27
- const users = await apiCoreService.get('/users');
28
- const newUser = await apiCoreService.post('/users', { name: 'Mario' });
29
- const updated = await apiCoreService.patch('/users/1', { age: 30 });
30
- await apiCoreService.delete('/users/1');
31
- ```
32
-
33
- ## Key Features
34
- - ✅ **Zero dependencies** - Based on native fetch
35
- - ✅ **Lightweight** - ~2KB minified
36
- - ✅ **TypeScript-first** - Complete type safety
37
- - ✅ **Interceptors** - Request/Response/Error hooks
38
- - ✅ **Timeout** - Configurable request timeout
39
- - ✅ **Cancellation** - AbortController support
40
- - ✅ **Query params** - Automatic serialization
41
- - ✅ **Multiple formats** - JSON, text, blob, arraybuffer
42
-
43
- ## API Methods
44
- - `get<T>(url, options?)` - GET request
45
- - `post<T>(url, data, options?)` - POST request
46
- - `put<T>(url, data, options?)` - PUT request
47
- - `patch<T>(url, data, options?)` - PATCH request
48
- - `delete<T>(url, options?)` - DELETE request
49
- - `request<T>(url, options)` - Generic request
50
-
51
- ## Configuration Options
52
- ```typescript
53
- interface ApiConfig {
54
- baseURL?: string;
55
- timeout?: number;
56
- headers?: Record<string, string>;
57
- requestInterceptor?: (config) => config;
58
- responseInterceptor?: (response) => response;
59
- errorInterceptor?: (error) => error;
60
- }
61
- ```
62
-
63
- ## Request Options
64
- ```typescript
65
- interface ApiRequestOptions {
66
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
67
- headers?: Record<string, string>;
68
- body?: any;
69
- params?: Record<string, string | number | boolean>;
70
- timeout?: number;
71
- responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
72
- credentials?: RequestCredentials;
73
- cache?: RequestCache;
74
- signal?: AbortSignal;
75
- }
76
- ```
77
-
78
- ## Response Structure
79
- ```typescript
80
- interface ApiResponse<T> {
81
- data: T;
82
- status: number;
83
- statusText: string;
84
- headers: Headers;
85
- raw: Response;
86
- }
87
- ```
88
-
89
- ## Error Structure
90
- ```typescript
91
- interface ApiError {
92
- message: string;
93
- status?: number;
94
- statusText?: string;
95
- data?: any;
96
- originalError: Error;
97
- }
98
- ```
99
-
100
- ## Common Patterns
101
-
102
- ### Authentication
103
- ```typescript
104
- apiCoreService.configure({
105
- requestInterceptor: (config) => {
106
- const token = getToken();
107
- config.headers = {
108
- ...config.headers,
109
- 'Authorization': `Bearer ${token}`
110
- };
111
- return config;
112
- }
113
- });
114
- ```
115
-
116
- ### Error Handling
117
- ```typescript
118
- try {
119
- const response = await apiCoreService.get('/data');
120
- } catch (error) {
121
- if (error.status === 401) {
122
- // Handle unauthorized
123
- } else if (error.status >= 500) {
124
- // Handle server error
125
- }
126
- }
127
- ```
128
-
129
- ### Timeout & Cancellation
130
- ```typescript
131
- // With timeout
132
- await apiCoreService.get('/data', { timeout: 3000 });
133
-
134
- // With AbortController
135
- const controller = new AbortController();
136
- apiCoreService.get('/data', { signal: controller.signal });
137
- setTimeout(() => controller.abort(), 2000);
138
- ```
139
-
140
- ## Integration with KIMU
141
-
142
- ```typescript
143
- import { KimuComponentElement } from '@kimu/core';
144
- import { KimuModuleManager } from '@kimu/core';
145
-
146
- export class MyComponent extends KimuComponentElement {
147
- private api: any;
148
-
149
- async onInit() {
150
- this.api = KimuModuleManager.getInstance().getService('api-core');
151
- await this.loadData();
152
- }
153
-
154
- async loadData() {
155
- const response = await this.api.get('/data');
156
- this.data = response.data;
157
- this.onRender();
158
- }
159
- }
160
- ```
161
-
162
- ## Files Structure
163
- ```
164
- api-core/
165
- ├── api-core-service.ts # Main service implementation
166
- ├── interfaces.ts # TypeScript type definitions
167
- ├── module.ts # Module class and exports
168
- ├── index.ts # Main entry point
169
- ├── examples.ts # Usage examples
170
- ├── README.md # Complete documentation
171
- ├── CHANGELOG.md # Version history
172
- └── QUICK-REFERENCE.md # This file
173
- ```
174
-
175
- ## Performance
176
- - Bundle size: ~2KB minified
177
- - First request: ~5ms (after DNS)
178
- - Subsequent requests: ~2ms (with HTTP/2)
179
- - Zero overhead compared to native fetch
180
-
181
- ## Browser Support
182
- - Chrome/Edge: ✅ 90+
183
- - Firefox: ✅ 88+
184
- - Safari: ✅ 14+
185
- - Opera: ✅ 76+
186
-
187
- ## License
188
- MPL-2.0 (part of KIMU-Core)
189
-
190
- ## Support
191
- - GitHub: [kimu-core/issues](https://github.com/UnicoVerso/kimu-core/issues)
192
- - Docs: [kimu-docs](https://github.com/UnicoVerso/kimu-docs)
1
+ # KIMU API Core Module - Quick Reference
2
+
3
+ ## Installation
4
+ ```bash
5
+ # Using kimu-cli (when available)
6
+ kimu install module api-core
7
+
8
+ # Manual installation
9
+ # Copy src/modules/api-core to your project
10
+ ```
11
+
12
+ ## Quick Start
13
+
14
+ ```typescript
15
+ import { apiCoreService } from './modules/api-core/api-core-service';
16
+
17
+ // Configure
18
+ apiCoreService.configure({
19
+ baseURL: 'https://api.example.com',
20
+ timeout: 10000,
21
+ headers: {
22
+ 'Authorization': 'Bearer YOUR_TOKEN'
23
+ }
24
+ });
25
+
26
+ // Make requests
27
+ const users = await apiCoreService.get('/users');
28
+ const newUser = await apiCoreService.post('/users', { name: 'Mario' });
29
+ const updated = await apiCoreService.patch('/users/1', { age: 30 });
30
+ await apiCoreService.delete('/users/1');
31
+ ```
32
+
33
+ ## Key Features
34
+ - ✅ **Zero dependencies** - Based on native fetch
35
+ - ✅ **Lightweight** - ~2KB minified
36
+ - ✅ **TypeScript-first** - Complete type safety
37
+ - ✅ **Interceptors** - Request/Response/Error hooks
38
+ - ✅ **Timeout** - Configurable request timeout
39
+ - ✅ **Cancellation** - AbortController support
40
+ - ✅ **Query params** - Automatic serialization
41
+ - ✅ **Multiple formats** - JSON, text, blob, arraybuffer
42
+
43
+ ## API Methods
44
+ - `get<T>(url, options?)` - GET request
45
+ - `post<T>(url, data, options?)` - POST request
46
+ - `put<T>(url, data, options?)` - PUT request
47
+ - `patch<T>(url, data, options?)` - PATCH request
48
+ - `delete<T>(url, options?)` - DELETE request
49
+ - `request<T>(url, options)` - Generic request
50
+
51
+ ## Configuration Options
52
+ ```typescript
53
+ interface ApiConfig {
54
+ baseURL?: string;
55
+ timeout?: number;
56
+ headers?: Record<string, string>;
57
+ requestInterceptor?: (config) => config;
58
+ responseInterceptor?: (response) => response;
59
+ errorInterceptor?: (error) => error;
60
+ }
61
+ ```
62
+
63
+ ## Request Options
64
+ ```typescript
65
+ interface ApiRequestOptions {
66
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
67
+ headers?: Record<string, string>;
68
+ body?: any;
69
+ params?: Record<string, string | number | boolean>;
70
+ timeout?: number;
71
+ responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
72
+ credentials?: RequestCredentials;
73
+ cache?: RequestCache;
74
+ signal?: AbortSignal;
75
+ }
76
+ ```
77
+
78
+ ## Response Structure
79
+ ```typescript
80
+ interface ApiResponse<T> {
81
+ data: T;
82
+ status: number;
83
+ statusText: string;
84
+ headers: Headers;
85
+ raw: Response;
86
+ }
87
+ ```
88
+
89
+ ## Error Structure
90
+ ```typescript
91
+ interface ApiError {
92
+ message: string;
93
+ status?: number;
94
+ statusText?: string;
95
+ data?: any;
96
+ originalError: Error;
97
+ }
98
+ ```
99
+
100
+ ## Common Patterns
101
+
102
+ ### Authentication
103
+ ```typescript
104
+ apiCoreService.configure({
105
+ requestInterceptor: (config) => {
106
+ const token = getToken();
107
+ config.headers = {
108
+ ...config.headers,
109
+ 'Authorization': `Bearer ${token}`
110
+ };
111
+ return config;
112
+ }
113
+ });
114
+ ```
115
+
116
+ ### Error Handling
117
+ ```typescript
118
+ try {
119
+ const response = await apiCoreService.get('/data');
120
+ } catch (error) {
121
+ if (error.status === 401) {
122
+ // Handle unauthorized
123
+ } else if (error.status >= 500) {
124
+ // Handle server error
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### Timeout & Cancellation
130
+ ```typescript
131
+ // With timeout
132
+ await apiCoreService.get('/data', { timeout: 3000 });
133
+
134
+ // With AbortController
135
+ const controller = new AbortController();
136
+ apiCoreService.get('/data', { signal: controller.signal });
137
+ setTimeout(() => controller.abort(), 2000);
138
+ ```
139
+
140
+ ## Integration with KIMU
141
+
142
+ ```typescript
143
+ import { KimuComponentElement } from '@kimu/core';
144
+ import { KimuModuleManager } from '@kimu/core';
145
+
146
+ export class MyComponent extends KimuComponentElement {
147
+ private api: any;
148
+
149
+ async onInit() {
150
+ this.api = KimuModuleManager.getInstance().getService('api-core');
151
+ await this.loadData();
152
+ }
153
+
154
+ async loadData() {
155
+ const response = await this.api.get('/data');
156
+ this.data = response.data;
157
+ this.onRender();
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## Files Structure
163
+ ```
164
+ api-core/
165
+ ├── api-core-service.ts # Main service implementation
166
+ ├── interfaces.ts # TypeScript type definitions
167
+ ├── module.ts # Module class and exports
168
+ ├── index.ts # Main entry point
169
+ ├── examples.ts # Usage examples
170
+ ├── README.md # Complete documentation
171
+ ├── CHANGELOG.md # Version history
172
+ └── QUICK-REFERENCE.md # This file
173
+ ```
174
+
175
+ ## Performance
176
+ - Bundle size: ~2KB minified
177
+ - First request: ~5ms (after DNS)
178
+ - Subsequent requests: ~2ms (with HTTP/2)
179
+ - Zero overhead compared to native fetch
180
+
181
+ ## Browser Support
182
+ - Chrome/Edge: ✅ 90+
183
+ - Firefox: ✅ 88+
184
+ - Safari: ✅ 14+
185
+ - Opera: ✅ 76+
186
+
187
+ ## License
188
+ MPL-2.0 (part of KIMU-Core)
189
+
190
+ ## Support
191
+ - GitHub: [kimu-core/issues](https://github.com/UnicoVerso/kimu-core/issues)
192
+ - Docs: [kimu-docs](https://github.com/UnicoVerso/kimu-docs)