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.
- 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/package.json +9 -2
- 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/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
|
@@ -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**:
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
│ ├── theme-
|
|
30
|
-
│ ├── theme-
|
|
31
|
-
│ ├── theme-
|
|
32
|
-
│ ├── theme-
|
|
33
|
-
│ ├── theme-
|
|
34
|
-
│ ├── theme-
|
|
35
|
-
│
|
|
36
|
-
|
|
37
|
-
├──
|
|
38
|
-
├──
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
###
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
##
|
|
106
|
-
|
|
107
|
-
###
|
|
108
|
-
|
|
109
|
-
\`\`\`
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
Default
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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';
|