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
@@ -1,267 +1,311 @@
1
- # Theme Module - CSS-Based Theme Management
2
-
3
- ## Overview
4
-
5
- The **Theme Module** provides a complete CSS-based theme management system for KIMU-Core applications. It supports multiple predefined themes (Light, Dark, Ocean, Cozy) and allows easy registration of custom themes through external CSS files.
6
-
7
- ## Architecture
8
-
9
- The theme module uses **KIMU Global Styles** system to inject theme CSS into all extensions automatically:
10
-
11
- 1. **KimuGlobalStyles** (core): Manages CSS files that should be injected in all extensions
12
- 2. **ThemeService**: Registers the active theme CSS as a global style
13
- 3. **KimuComponentElement**: Automatically injects all global styles into each extension's shadow root
14
- 4. **themes-config.json**: Configuration file with all available themes
15
-
16
- This architecture ensures:
17
- - ✅ Theme module is **optional** - framework works without it (fallback styles in `style.css`)
18
- - ✅ Themes are automatically applied to **all extensions** (including shadow DOM)
19
- - ✅ Theme changes propagate to **existing extensions** dynamically
20
- - ✅ **No hardcoded dependencies** in core framework
21
- - ✅ **Easy theme management** via JSON configuration file
22
-
23
- ## Module Structure
24
-
25
- ```
26
- src/modules/theme/
27
- ├── themes/ # Theme source CSS files
28
- ├── theme-light.css
29
- │ ├── theme-dark.css
30
- │ ├── theme-ocean.css
31
- │ ├── theme-cozy.css
32
- │ ├── theme-nord.css
33
- │ ├── theme-forest.css
34
- │ ├── theme-high-contrast.css
35
- └── theme-cyberpunk.css
36
- ├── themes-config.json # Theme configuration
37
- ├── pre-build.js # Pre-build script (copies themes to public/)
38
- ├── theme-service.ts # Main service
39
- └── README.md # This file
40
- ```
41
-
42
- **Build Process**: The pre-build script automatically copies all CSS files from `themes/` to `public/themes/` before compilation.
43
-
44
- ## Features
45
-
46
- - 🎨 **CSS-Based Themes**: Each theme is a separate CSS file for maximum flexibility
47
- - ☀️ **Light Mode**: Clean and bright theme for daytime use
48
- - 🌙 **Dark Mode**: Dark theme for low-light environments
49
- - 🌊 **Ocean Theme**: Ocean-inspired dark theme with blue-green tones
50
- - 🌸 **Cozy Theme**: Warm, feminine and cozy theme with soft colors
51
- - ❄️ **Nord Theme**: Cold and relaxing Nordic theme for developers
52
- - 🌲 **Forest Theme**: Natural green theme inspired by nature
53
- - **High Contrast Theme**: WCAG AAA accessible theme
54
- - 🎮 **Cyberpunk Theme**: Futuristic neon aesthetic
55
- - 🔄 **Auto Mode**: Automatically follows system color scheme preferences
56
- - 💾 **Persistence**: User preferences saved in localStorage
57
- - 🎯 **System Integration**: MediaQuery API for system preference detection
58
- - 🔌 **Extensible**: Easy registration of custom CSS themes
59
- - 🌐 **Global Styles**: Themes automatically injected in all extensions via Global Styles system
60
-
61
- ## Quick Start
62
-
63
- ### Basic Usage
64
-
65
- \`\`\`typescript
66
- import { themeService } from './modules/theme/theme-service';
67
-
68
- // Set theme
69
- themeService.setMode('dark'); // Switch to dark theme
70
- themeService.setMode('light'); // Switch to light theme
71
- themeService.setMode('ocean'); // Switch to ocean theme
72
- themeService.setMode('cozy'); // Switch to cozy theme
73
- themeService.setMode('auto'); // Use system preference
74
-
75
- // Quick toggle
76
- themeService.toggle(); // Toggle between light/dark
77
-
78
- // Get current theme
79
- const mode = themeService.getMode();
80
- const themeName = themeService.getCurrentThemeName();
81
- \`\`\`
82
-
83
- ### Listen to Theme Changes
84
-
85
- \`\`\`typescript
86
- themeService.onChange((themeName: string, mode: string) => {
87
- console.log(\`Theme changed to: \${themeName}\`);
88
- });
89
- \`\`\`
90
-
91
- ## Available Themes
92
-
93
- ### 1. Light Theme
94
- Clean and bright theme optimized for daytime use.
95
-
96
- ### 2. Dark Theme
97
- Dark theme for low-light environments and reduced eye strain.
98
-
99
- ### 3. Ocean Theme
100
- Ocean-inspired dark theme with blue-green tones.
101
-
102
- ### 4. Cozy Theme
103
- Warm, feminine and cozy theme with soft pastel colors.
104
-
105
- ## Creating Custom Themes
106
-
107
- ### Step 1: Create CSS File
108
-
109
- \`\`\`css
110
- /* my-custom-theme.css */
111
- :root {
112
- --kimu-primary: #your-color;
113
- --kimu-background: #your-background;
114
- --kimu-text-primary: #your-text-color;
115
- /* ...other variables... */
116
- }
117
- \`\`\`
118
-
119
- ### Step 2: Register the Theme
120
-
121
- \`\`\`typescript
122
- themeService.registerCssTheme({
123
- name: 'my-theme',
124
- mode: 'dark',
125
- cssPath: '/themes/my-custom-theme.css',
126
- description: 'My awesome custom theme'
127
- });
128
- \`\`\`
129
-
130
- ### Step 3: Apply the Theme
131
-
132
- \`\`\`typescript
133
- themeService.setMode('my-theme');
134
- \`\`\`
135
-
136
- ## Using CSS Variables
137
-
138
- \`\`\`css
139
- .my-component {
140
- background: var(--kimu-background);
141
- color: var(--kimu-text-primary);
142
- border: 1px solid var(--kimu-border);
143
- }
144
-
145
- .my-button {
146
- background: var(--kimu-primary);
147
- color: white;
148
- }
149
- \`\`\`
150
-
151
- ## Module Independence & Fallback System
152
-
153
- ### How It Works
154
-
155
- The theme system is designed to work as an **optional module**:
156
-
157
- 1. **Without Theme Module**:
158
- - Default CSS variables are defined in `src/assets/style.css`
159
- - Application has basic Light theme styling
160
- - All components work normally with default colors
161
-
162
- 2. **With Theme Module**:
163
- - Theme CSS files **override** default values from `style.css`
164
- - Dynamic theme switching available
165
- - User preferences persist across sessions
166
-
167
- ### Architecture
168
-
169
- \`\`\`
170
- ┌─────────────────────────────────────────────┐
171
- │ style.css (ALWAYS loaded)
172
- │ :root { --kimu-primary: #667eea; } │ ← DEFAULT values
173
- └─────────────────────────────────────────────┘
174
-
175
- ┌─────────────────────────────────────────────┐
176
- │ theme-dark.css (OPTIONAL, loaded by module)│
177
- │ :root { --kimu-primary: #818cf8; } │ ← OVERRIDES defaults
178
- └─────────────────────────────────────────────┘
179
-
180
- ┌─────────────────────────────────────────────┐
181
- │ Components use variables │
182
- │ button { background: var(--kimu-primary); }│ ← Uses active value
183
- └─────────────────────────────────────────────┘
184
- \`\`\`
185
-
186
- ### Benefits
187
-
188
- ✅ **App works without theme module** - defaults provide basic styling
189
- ✅ **No breaking changes** - removing theme module doesn't break the app
190
- **Gradual adoption** - themes can be added later
191
- **Consistent API** - components always use same CSS variables
192
-
193
- ### CSS Variable Priority
194
-
195
- When theme module is active:
196
- \`\`\`
197
- Theme CSS values > Default style.css values > Browser defaults
198
- \`\`\`
199
-
200
- When theme module is NOT installed:
201
- \`\`\`
202
- Default style.css values > Browser defaults
203
- \`\`\`
204
-
205
- ## Theme Configuration File
206
-
207
- ### Structure
208
-
209
- The theme module uses a JSON configuration file (`themes-config.json`) to define available themes:
210
-
211
- ```json
212
- {
213
- "themes": [
214
- {
215
- "name": "light",
216
- "mode": "light",
217
- "cssPath": "theme-light.css",
218
- "description": "Clean and bright theme"
219
- },
220
- {
221
- "name": "dark",
222
- "mode": "dark",
223
- "cssPath": "theme-dark.css",
224
- "description": "Dark theme for low-light environments"
225
- }
226
- ],
227
- "defaultTheme": "light"
228
- }
229
- ```
230
-
231
- ### Adding New Themes
232
-
233
- To add a new theme, simply:
234
-
235
- 1. Create the CSS file in `src/modules/theme/themes/` (e.g., `theme-nord.css`)
236
- 2. Add entry to `src/modules/theme/themes-config.json`:
237
-
238
- ```json
239
- {
240
- "name": "nord",
241
- "mode": "dark",
242
- "cssPath": "theme-nord.css",
243
- "description": "Cold and relaxing Nordic theme"
244
- }
245
- ```
246
-
247
- 3. Run `npm run build` to copy themes to `public/themes/` (via pre-build script)
248
- 4. The pre-build script automatically copies all CSS files from `src/modules/theme/themes/` to `public/themes/`
249
-
250
- **Benefits of configuration file:**
251
- - ✅ No code changes needed to add themes
252
- - ✅ Easy to maintain and extend
253
- - Clear separation of configuration and logic
254
- - ✅ Can be easily customized per deployment
255
-
256
- ### Theme Configuration Properties
257
-
258
- | Property | Type | Required | Description |
259
- |----------|------|----------|-------------|
260
- | `name` | string | ✅ | Unique theme identifier (used in `setMode()`) |
261
- | `mode` | 'light' \| 'dark' | ✅ | Base mode for system preference detection |
262
- | `cssPath` | string | ✅ | CSS file name in `public/themes/` folder |
263
- | `description` | string | ❌ | Human-readable theme description |
264
-
265
- ## License
266
-
267
- This module is part of KIMU-Core and is licensed under the Mozilla Public License 2.0 (MPL-2.0).
1
+ # Theme Module - CSS-Based Theme Management
2
+
3
+ ## Overview
4
+
5
+ The **Theme Module** provides a complete CSS-based theme management system for KIMU-Core applications. It supports multiple predefined themes (Light, Dark, Ocean, Cozy) and allows easy registration of custom themes through external CSS files.
6
+
7
+ ## Architecture
8
+
9
+ The theme module uses **KIMU Global Styles** system to inject theme CSS into all extensions automatically:
10
+
11
+ 1. **KimuGlobalStyles** (core): Manages CSS files that should be injected in all extensions
12
+ 2. **ThemeService**: Registers the active theme CSS as a global style
13
+ 3. **KimuComponentElement**: Automatically injects all global styles into each extension's shadow root
14
+ 4. **src/config/themes-config.json**: User configuration file with all available themes
15
+
16
+ This architecture ensures:
17
+ - ✅ Theme module is **optional** - framework works without it (fallback styles in `style.css`)
18
+ - ✅ Themes are automatically applied to **all extensions** (including shadow DOM)
19
+ - ✅ Theme changes propagate to **existing extensions** dynamically
20
+ - ✅ **No hardcoded dependencies** in core framework
21
+ - ✅ **Easy theme management** via JSON configuration file
22
+ - ✅ **Configuration survives module updates** - user config is separate from module files
23
+
24
+ ## Module Structure
25
+
26
+ ```
27
+ src/modules/theme/
28
+ ├── themes/ # Theme source CSS files
29
+ │ ├── theme-light.css
30
+ │ ├── theme-dark.css
31
+ │ ├── theme-ocean.css
32
+ │ ├── theme-cozy.css
33
+ │ ├── theme-nord.css
34
+ │ ├── theme-forest.css
35
+ ├── theme-high-contrast.css
36
+ │ └── theme-cyberpunk.css
37
+ ├── themes-config.json.example # Theme configuration example
38
+ ├── pre-build.js # Pre-build script (copies themes to public/)
39
+ ├── theme-service.ts # Main service
40
+ └── README.md # This file
41
+
42
+ src/config/
43
+ └── theme/
44
+ └── themes-config.json # User configuration (copy from example)
45
+ ```
46
+
47
+ **Build Process**: The pre-build script automatically copies all CSS files from `themes/` to `public/themes/` before compilation.
48
+
49
+ ## Post-Installation Setup
50
+
51
+ After installing the theme module, you need to create the themes configuration file:
52
+
53
+ ### 1. Create themes configuration file
54
+
55
+ Copy the example file to your config folder:
56
+ ```bash
57
+ mkdir -p src/config/theme
58
+ cp src/modules/theme/themes-config.json.example src/config/theme/themes-config.json
59
+ ```
60
+
61
+ Or create `src/config/theme/themes-config.json` manually using the example as template.
62
+
63
+ ### 2. Customize your themes
64
+
65
+ Edit `src/config/theme/themes-config.json` to add, remove, or modify themes:
66
+
67
+ ```json
68
+ {
69
+ "themes": [
70
+ {
71
+ "name": "light",
72
+ "mode": "light",
73
+ "cssPath": "theme-light.css",
74
+ "description": "Clean and bright theme",
75
+ "icon": "☀️"
76
+ },
77
+ {
78
+ "name": "dark",
79
+ "mode": "dark",
80
+ "cssPath": "theme-dark.css",
81
+ "description": "Dark theme for low-light",
82
+ "icon": "🌙"
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ ## Features
89
+
90
+ - 🎨 **CSS-Based Themes**: Each theme is a separate CSS file for maximum flexibility
91
+ - ☀️ **Light Mode**: Clean and bright theme for daytime use
92
+ - 🌙 **Dark Mode**: Dark theme for low-light environments
93
+ - 🌊 **Ocean Theme**: Ocean-inspired dark theme with blue-green tones
94
+ - 🌸 **Cozy Theme**: Warm, feminine and cozy theme with soft colors
95
+ - ❄️ **Nord Theme**: Cold and relaxing Nordic theme for developers
96
+ - 🌲 **Forest Theme**: Natural green theme inspired by nature
97
+ - **High Contrast Theme**: WCAG AAA accessible theme
98
+ - 🎮 **Cyberpunk Theme**: Futuristic neon aesthetic
99
+ - 🔄 **Auto Mode**: Automatically follows system color scheme preferences
100
+ - 💾 **Persistence**: User preferences saved in localStorage
101
+ - 🎯 **System Integration**: MediaQuery API for system preference detection
102
+ - 🔌 **Extensible**: Easy registration of custom CSS themes
103
+ - 🌐 **Global Styles**: Themes automatically injected in all extensions via Global Styles system
104
+
105
+ ## Quick Start
106
+
107
+ ### Basic Usage
108
+
109
+ \`\`\`typescript
110
+ import { themeService } from './modules/theme/theme-service';
111
+
112
+ // Set theme
113
+ themeService.setMode('dark'); // Switch to dark theme
114
+ themeService.setMode('light'); // Switch to light theme
115
+ themeService.setMode('ocean'); // Switch to ocean theme
116
+ themeService.setMode('cozy'); // Switch to cozy theme
117
+ themeService.setMode('auto'); // Use system preference
118
+
119
+ // Quick toggle
120
+ themeService.toggle(); // Toggle between light/dark
121
+
122
+ // Get current theme
123
+ const mode = themeService.getMode();
124
+ const themeName = themeService.getCurrentThemeName();
125
+ \`\`\`
126
+
127
+ ### Listen to Theme Changes
128
+
129
+ \`\`\`typescript
130
+ themeService.onChange((themeName: string, mode: string) => {
131
+ console.log(\`Theme changed to: \${themeName}\`);
132
+ });
133
+ \`\`\`
134
+
135
+ ## Available Themes
136
+
137
+ ### 1. Light Theme
138
+ Clean and bright theme optimized for daytime use.
139
+
140
+ ### 2. Dark Theme
141
+ Dark theme for low-light environments and reduced eye strain.
142
+
143
+ ### 3. Ocean Theme
144
+ Ocean-inspired dark theme with blue-green tones.
145
+
146
+ ### 4. Cozy Theme
147
+ Warm, feminine and cozy theme with soft pastel colors.
148
+
149
+ ## Creating Custom Themes
150
+
151
+ ### Step 1: Create CSS File
152
+
153
+ \`\`\`css
154
+ /* my-custom-theme.css */
155
+ :root {
156
+ --kimu-primary: #your-color;
157
+ --kimu-background: #your-background;
158
+ --kimu-text-primary: #your-text-color;
159
+ /* ...other variables... */
160
+ }
161
+ \`\`\`
162
+
163
+ ### Step 2: Register the Theme
164
+
165
+ \`\`\`typescript
166
+ themeService.registerCssTheme({
167
+ name: 'my-theme',
168
+ mode: 'dark',
169
+ cssPath: '/themes/my-custom-theme.css',
170
+ description: 'My awesome custom theme'
171
+ });
172
+ \`\`\`
173
+
174
+ ### Step 3: Apply the Theme
175
+
176
+ \`\`\`typescript
177
+ themeService.setMode('my-theme');
178
+ \`\`\`
179
+
180
+ ## Using CSS Variables
181
+
182
+ \`\`\`css
183
+ .my-component {
184
+ background: var(--kimu-background);
185
+ color: var(--kimu-text-primary);
186
+ border: 1px solid var(--kimu-border);
187
+ }
188
+
189
+ .my-button {
190
+ background: var(--kimu-primary);
191
+ color: white;
192
+ }
193
+ \`\`\`
194
+
195
+ ## Module Independence & Fallback System
196
+
197
+ ### How It Works
198
+
199
+ The theme system is designed to work as an **optional module**:
200
+
201
+ 1. **Without Theme Module**:
202
+ - Default CSS variables are defined in `src/assets/style.css`
203
+ - Application has basic Light theme styling
204
+ - All components work normally with default colors
205
+
206
+ 2. **With Theme Module**:
207
+ - Theme CSS files **override** default values from `style.css`
208
+ - Dynamic theme switching available
209
+ - User preferences persist across sessions
210
+
211
+ ### Architecture
212
+
213
+ \`\`\`
214
+ ┌─────────────────────────────────────────────┐
215
+ style.css (ALWAYS loaded) │
216
+ :root { --kimu-primary: #667eea; } │ ← DEFAULT values
217
+ └─────────────────────────────────────────────┘
218
+
219
+ ┌─────────────────────────────────────────────┐
220
+ │ theme-dark.css (OPTIONAL, loaded by module)│
221
+ :root { --kimu-primary: #818cf8; } │ ← OVERRIDES defaults
222
+ └─────────────────────────────────────────────┘
223
+
224
+ ┌─────────────────────────────────────────────┐
225
+ │ Components use variables │
226
+ │ button { background: var(--kimu-primary); }│ ← Uses active value
227
+ └─────────────────────────────────────────────┘
228
+ \`\`\`
229
+
230
+ ### Benefits
231
+
232
+ ✅ **App works without theme module** - defaults provide basic styling
233
+ **No breaking changes** - removing theme module doesn't break the app
234
+ ✅ **Gradual adoption** - themes can be added later
235
+ **Consistent API** - components always use same CSS variables
236
+
237
+ ### CSS Variable Priority
238
+
239
+ When theme module is active:
240
+ \`\`\`
241
+ Theme CSS values > Default style.css values > Browser defaults
242
+ \`\`\`
243
+
244
+ When theme module is NOT installed:
245
+ \`\`\`
246
+ Default style.css values > Browser defaults
247
+ \`\`\`
248
+
249
+ ## Theme Configuration File
250
+
251
+ ### Structure
252
+
253
+ The theme module uses a JSON configuration file (`themes-config.json`) to define available themes:
254
+
255
+ ```json
256
+ {
257
+ "themes": [
258
+ {
259
+ "name": "light",
260
+ "mode": "light",
261
+ "cssPath": "theme-light.css",
262
+ "description": "Clean and bright theme"
263
+ },
264
+ {
265
+ "name": "dark",
266
+ "mode": "dark",
267
+ "cssPath": "theme-dark.css",
268
+ "description": "Dark theme for low-light environments"
269
+ }
270
+ ],
271
+ "defaultTheme": "light"
272
+ }
273
+ ```
274
+
275
+ ### Adding New Themes
276
+
277
+ To add a new theme, simply:
278
+
279
+ 1. Create the CSS file in `src/modules/theme/themes/` (e.g., `theme-nord.css`)
280
+ 2. Add entry to `src/modules/theme/themes-config.json`:
281
+
282
+ ```json
283
+ {
284
+ "name": "nord",
285
+ "mode": "dark",
286
+ "cssPath": "theme-nord.css",
287
+ "description": "Cold and relaxing Nordic theme"
288
+ }
289
+ ```
290
+
291
+ 3. Run `npm run build` to copy themes to `public/themes/` (via pre-build script)
292
+ 4. The pre-build script automatically copies all CSS files from `src/modules/theme/themes/` to `public/themes/`
293
+
294
+ **Benefits of configuration file:**
295
+ - ✅ No code changes needed to add themes
296
+ - ✅ Easy to maintain and extend
297
+ - ✅ Clear separation of configuration and logic
298
+ - ✅ Can be easily customized per deployment
299
+
300
+ ### Theme Configuration Properties
301
+
302
+ | Property | Type | Required | Description |
303
+ |----------|------|----------|-------------|
304
+ | `name` | string | ✅ | Unique theme identifier (used in `setMode()`) |
305
+ | `mode` | 'light' \| 'dark' | ✅ | Base mode for system preference detection |
306
+ | `cssPath` | string | ✅ | CSS file name in `public/themes/` folder |
307
+ | `description` | string | ❌ | Human-readable theme description |
308
+
309
+ ## License
310
+
311
+ This module is part of KIMU-Core and is licensed under the Mozilla Public License 2.0 (MPL-2.0).
@@ -1,30 +1,30 @@
1
- /**
2
- * Theme Module for KIMU-Core
3
- *
4
- * Provides centralized theme management with dark/light/auto modes.
5
- *
6
- * @module ThemeModule
7
- */
8
-
9
- import { KimuModule } from '../../core/kimu-module';
10
- import { themeService } from './theme-service'
11
- /**
12
- * ThemeModule - Module class for theme management integration
13
- */
14
- export default class ThemeModule extends KimuModule {
15
- constructor(name = 'theme', version = '1.0.0', options?: any) {
16
- super(name, version, options);
17
- }
18
-
19
- /**
20
- * Get the theme service instance
21
- */
22
- getService() {
23
- return themeService;
24
- }
25
- }
26
-
27
- // Re-export for convenience
28
- export { themeService } from './theme-service';
29
- export { ThemeService } from './theme-service';
30
- export type { ThemeMode, CssTheme } from './theme-service';
1
+ /**
2
+ * Theme Module for KIMU-Core
3
+ *
4
+ * Provides centralized theme management with dark/light/auto modes.
5
+ *
6
+ * @module ThemeModule
7
+ */
8
+
9
+ import { KimuModule } from '../../core/kimu-module';
10
+ import { themeService } from './theme-service'
11
+ /**
12
+ * ThemeModule - Module class for theme management integration
13
+ */
14
+ export default class ThemeModule extends KimuModule {
15
+ constructor(name = 'theme', version = '1.0.0', options?: any) {
16
+ super(name, version, options);
17
+ }
18
+
19
+ /**
20
+ * Get the theme service instance
21
+ */
22
+ getService() {
23
+ return themeService;
24
+ }
25
+ }
26
+
27
+ // Re-export for convenience
28
+ export { themeService } from './theme-service';
29
+ export { ThemeService } from './theme-service';
30
+ export type { ThemeMode, CssTheme } from './theme-service';