kimu-core 0.4.1
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 +30 -0
- package/.gitattributes +11 -0
- package/.github/FUNDING.yml +8 -0
- package/.github/copilot-instructions.md +103 -0
- package/.github/kimu-copilot-instructions.md +3779 -0
- package/.github/workflows/deploy-demo.yml +39 -0
- package/AUTHORS.md +20 -0
- package/CHANGELOG.md +20 -0
- package/CODE_GUIDELINES.md +165 -0
- package/CODE_OF_CONDUCT.md +47 -0
- package/CONTRIBUTING.md +62 -0
- package/FUNDING.md +31 -0
- package/ISSUE_GUIDELINES.md +74 -0
- package/LICENSE +17 -0
- package/LICENSE.it.md +17 -0
- package/MPL-2.0.txt +373 -0
- package/NOTICE +65 -0
- package/README-KIMU.md +40 -0
- package/README.it.md +208 -0
- package/README.md +266 -0
- package/SECURITY.md +64 -0
- package/docs/get-started-en.md +207 -0
- package/docs/images/icon.svg +64 -0
- package/docs/images/logo_kimu.png +0 -0
- package/docs/index.md +29 -0
- package/env/dev.config.json +6 -0
- package/env/local.config.json +6 -0
- package/env/prod.config.json +6 -0
- package/env/staging.config.json +6 -0
- package/env/test.config.json +4 -0
- package/icon.svg +10 -0
- package/logo_kimu.png +0 -0
- package/package.json +79 -0
- package/public/favicon.svg +64 -0
- package/public/logo_kimu.svg +1 -0
- package/scripts/build-all-config.js +59 -0
- package/scripts/build-all-core.js +65 -0
- package/scripts/build-all-extensions.js +64 -0
- package/scripts/build-all-modules.js +99 -0
- package/scripts/build-extension.js +60 -0
- package/scripts/clear-kimu-build.js +31 -0
- package/scripts/generate-kimu-build-config.js +79 -0
- package/scripts/install-module.js +162 -0
- package/scripts/list-modules.js +109 -0
- package/scripts/minify-css-assets.js +82 -0
- package/scripts/remove-module.js +122 -0
- package/scripts/utils/fix-imports.js +85 -0
- package/src/assets/index.css +43 -0
- package/src/assets/kimu-style.css +84 -0
- package/src/assets/style.css +116 -0
- package/src/config/kimu-base-config.json +5 -0
- package/src/core/index.ts +47 -0
- package/src/core/kimu-app.ts +76 -0
- package/src/core/kimu-asset-manager.ts +167 -0
- package/src/core/kimu-component-element.ts +325 -0
- package/src/core/kimu-component.ts +33 -0
- package/src/core/kimu-engine.ts +188 -0
- package/src/core/kimu-extension-manager.ts +281 -0
- package/src/core/kimu-global-styles.ts +136 -0
- package/src/core/kimu-module-manager.ts +69 -0
- package/src/core/kimu-module.ts +21 -0
- package/src/core/kimu-path-config.ts +127 -0
- package/src/core/kimu-reactive.ts +196 -0
- package/src/core/kimu-render.ts +91 -0
- package/src/core/kimu-store.ts +147 -0
- package/src/core/kimu-types.ts +65 -0
- package/src/extensions/.gitkeep +0 -0
- package/src/extensions/extensions-manifest.json +13 -0
- package/src/extensions/kimu-home/component.ts +80 -0
- package/src/extensions/kimu-home/lang/en.json +5 -0
- package/src/extensions/kimu-home/lang/it.json +5 -0
- package/src/extensions/kimu-home/style.css +61 -0
- package/src/extensions/kimu-home/view.html +51 -0
- package/src/index.html +26 -0
- package/src/main.ts +68 -0
- package/src/modules/.gitkeep +0 -0
- package/src/modules/README.md +79 -0
- package/src/modules/i18n/README.it.md +63 -0
- package/src/modules/i18n/README.md +63 -0
- package/src/modules/i18n/kimu-global-lang.ts +26 -0
- package/src/modules/i18n/kimu-i18n-service.ts +108 -0
- package/src/modules/i18n/manifest.json +22 -0
- package/src/modules/i18n/module.ts +39 -0
- package/src/modules/modules-manifest.json +12 -0
- package/src/modules-repository/README.md +108 -0
- package/src/modules-repository/api-axios/CHANGELOG.md +48 -0
- package/src/modules-repository/api-axios/QUICK-REFERENCE.md +178 -0
- package/src/modules-repository/api-axios/README.md +304 -0
- package/src/modules-repository/api-axios/api-axios-service.ts +355 -0
- package/src/modules-repository/api-axios/examples.ts +293 -0
- package/src/modules-repository/api-axios/index.ts +19 -0
- package/src/modules-repository/api-axios/interfaces.ts +71 -0
- package/src/modules-repository/api-axios/module.ts +41 -0
- package/src/modules-repository/api-core/CHANGELOG.md +42 -0
- package/src/modules-repository/api-core/QUICK-REFERENCE.md +192 -0
- package/src/modules-repository/api-core/README.md +435 -0
- package/src/modules-repository/api-core/api-core-service.ts +289 -0
- package/src/modules-repository/api-core/examples.ts +432 -0
- package/src/modules-repository/api-core/index.ts +8 -0
- package/src/modules-repository/api-core/interfaces.ts +83 -0
- package/src/modules-repository/api-core/module.ts +30 -0
- package/src/modules-repository/event-bus/README.md +273 -0
- package/src/modules-repository/event-bus/event-bus-service.ts +176 -0
- package/src/modules-repository/event-bus/module.ts +30 -0
- package/src/modules-repository/i18n/README.it.md +63 -0
- package/src/modules-repository/i18n/README.md +63 -0
- package/src/modules-repository/i18n/kimu-global-lang.ts +26 -0
- package/src/modules-repository/i18n/kimu-i18n-service.ts +108 -0
- package/src/modules-repository/i18n/manifest.json +22 -0
- package/src/modules-repository/i18n/module.ts +39 -0
- package/src/modules-repository/notification/README.md +423 -0
- package/src/modules-repository/notification/module.ts +30 -0
- package/src/modules-repository/notification/notification-service.ts +436 -0
- package/src/modules-repository/router/README.it.md +39 -0
- package/src/modules-repository/router/README.md +39 -0
- package/src/modules-repository/router/manifest.json +21 -0
- package/src/modules-repository/router/module.ts +23 -0
- package/src/modules-repository/router/router.ts +144 -0
- package/src/modules-repository/state/README.md +409 -0
- package/src/modules-repository/state/module.ts +30 -0
- package/src/modules-repository/state/state-service.ts +296 -0
- package/src/modules-repository/theme/README.md +267 -0
- package/src/modules-repository/theme/module.ts +30 -0
- package/src/modules-repository/theme/pre-build.js +40 -0
- package/src/modules-repository/theme/theme-service.ts +389 -0
- package/src/modules-repository/theme/themes/theme-cherry-blossom.css +78 -0
- package/src/modules-repository/theme/themes/theme-cozy.css +111 -0
- package/src/modules-repository/theme/themes/theme-cyberpunk.css +150 -0
- package/src/modules-repository/theme/themes/theme-dark.css +79 -0
- package/src/modules-repository/theme/themes/theme-forest.css +171 -0
- package/src/modules-repository/theme/themes/theme-gold.css +100 -0
- package/src/modules-repository/theme/themes/theme-high-contrast.css +126 -0
- package/src/modules-repository/theme/themes/theme-lava.css +101 -0
- package/src/modules-repository/theme/themes/theme-lavender.css +90 -0
- package/src/modules-repository/theme/themes/theme-light.css +79 -0
- package/src/modules-repository/theme/themes/theme-matrix.css +103 -0
- package/src/modules-repository/theme/themes/theme-midnight.css +81 -0
- package/src/modules-repository/theme/themes/theme-nord.css +94 -0
- package/src/modules-repository/theme/themes/theme-ocean.css +84 -0
- package/src/modules-repository/theme/themes/theme-retro80s.css +343 -0
- package/src/modules-repository/theme/themes/theme-sunset.css +62 -0
- package/src/modules-repository/theme/themes-config.d.ts +27 -0
- package/src/modules-repository/theme/themes-config.json +213 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +33 -0
- package/vite.config.ts +99 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* KIMU Module Installer
|
|
5
|
+
*
|
|
6
|
+
* Installs a module from modules-repository to modules folder
|
|
7
|
+
* Usage: npm run install:module <module-name>
|
|
8
|
+
* Example: npm run install:module router
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
|
|
18
|
+
const ROOT_DIR = path.resolve(__dirname, '..');
|
|
19
|
+
const REPOSITORY_DIR = path.join(ROOT_DIR, 'src', 'modules-repository');
|
|
20
|
+
const MODULES_DIR = path.join(ROOT_DIR, 'src', 'modules');
|
|
21
|
+
const MANIFEST_PATH = path.join(MODULES_DIR, 'modules-manifest.json');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Copy directory recursively
|
|
25
|
+
*/
|
|
26
|
+
function copyDirectory(src, dest) {
|
|
27
|
+
if (!fs.existsSync(dest)) {
|
|
28
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
32
|
+
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const srcPath = path.join(src, entry.name);
|
|
35
|
+
const destPath = path.join(dest, entry.name);
|
|
36
|
+
|
|
37
|
+
if (entry.isDirectory()) {
|
|
38
|
+
copyDirectory(srcPath, destPath);
|
|
39
|
+
} else {
|
|
40
|
+
fs.copyFileSync(srcPath, destPath);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Read module manifest from repository
|
|
47
|
+
*/
|
|
48
|
+
function readModuleManifest(moduleName) {
|
|
49
|
+
const manifestPath = path.join(REPOSITORY_DIR, moduleName, 'manifest.json');
|
|
50
|
+
|
|
51
|
+
if (!fs.existsSync(manifestPath)) {
|
|
52
|
+
throw new Error(`Module manifest not found: ${manifestPath}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Read installed modules manifest
|
|
60
|
+
*/
|
|
61
|
+
function readInstalledManifest() {
|
|
62
|
+
if (!fs.existsSync(MANIFEST_PATH)) {
|
|
63
|
+
return {
|
|
64
|
+
installedModules: [],
|
|
65
|
+
availableModules: [],
|
|
66
|
+
lastUpdate: new Date().toISOString()
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return JSON.parse(fs.readFileSync(MANIFEST_PATH, 'utf8'));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Write installed modules manifest
|
|
75
|
+
*/
|
|
76
|
+
function writeInstalledManifest(manifest) {
|
|
77
|
+
fs.writeFileSync(MANIFEST_PATH, JSON.stringify(manifest, null, 2), 'utf8');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Install module
|
|
82
|
+
*/
|
|
83
|
+
function installModule(moduleName) {
|
|
84
|
+
console.log(`\n📦 Installing module: ${moduleName}...`);
|
|
85
|
+
|
|
86
|
+
// Check if module exists in repository
|
|
87
|
+
const moduleRepoPath = path.join(REPOSITORY_DIR, moduleName);
|
|
88
|
+
if (!fs.existsSync(moduleRepoPath)) {
|
|
89
|
+
console.error(`❌ Error: Module '${moduleName}' not found in repository.`);
|
|
90
|
+
console.log(` Available modules in repository:`);
|
|
91
|
+
const availableModules = fs.readdirSync(REPOSITORY_DIR, { withFileTypes: true })
|
|
92
|
+
.filter(dirent => dirent.isDirectory())
|
|
93
|
+
.map(dirent => dirent.name);
|
|
94
|
+
availableModules.forEach(mod => console.log(` - ${mod}`));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Read module manifest
|
|
99
|
+
const moduleManifest = readModuleManifest(moduleName);
|
|
100
|
+
console.log(` Version: ${moduleManifest.version}`);
|
|
101
|
+
console.log(` Description: ${moduleManifest.description}`);
|
|
102
|
+
|
|
103
|
+
// Check if already installed
|
|
104
|
+
const installedManifest = readInstalledManifest();
|
|
105
|
+
const alreadyInstalled = installedManifest.installedModules.find(
|
|
106
|
+
mod => mod.name === moduleName
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
if (alreadyInstalled) {
|
|
110
|
+
console.log(`⚠️ Module '${moduleName}' is already installed (v${alreadyInstalled.version}).`);
|
|
111
|
+
console.log(` To reinstall, first remove it with: npm run remove:module ${moduleName}`);
|
|
112
|
+
process.exit(0);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Copy module from repository to modules
|
|
116
|
+
const moduleDestPath = path.join(MODULES_DIR, moduleName);
|
|
117
|
+
console.log(` Copying from: ${moduleRepoPath}`);
|
|
118
|
+
console.log(` Copying to: ${moduleDestPath}`);
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
copyDirectory(moduleRepoPath, moduleDestPath);
|
|
122
|
+
console.log(` ✓ Files copied successfully`);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error(`❌ Error copying module files:`, error.message);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Update installed manifest
|
|
129
|
+
installedManifest.installedModules.push({
|
|
130
|
+
name: moduleName,
|
|
131
|
+
version: moduleManifest.version,
|
|
132
|
+
path: moduleName,
|
|
133
|
+
installedAt: new Date().toISOString()
|
|
134
|
+
});
|
|
135
|
+
installedManifest.lastUpdate = new Date().toISOString();
|
|
136
|
+
|
|
137
|
+
writeInstalledManifest(installedManifest);
|
|
138
|
+
console.log(` ✓ Manifest updated`);
|
|
139
|
+
|
|
140
|
+
console.log(`\n✅ Module '${moduleName}' installed successfully!`);
|
|
141
|
+
console.log(` You can now import it in your code:`);
|
|
142
|
+
console.log(` import ${moduleManifest.name}Module from './modules/${moduleName}/module';`);
|
|
143
|
+
console.log(`\n Run 'npm run build' to include it in the production bundle.\n`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Main execution
|
|
148
|
+
*/
|
|
149
|
+
function main() {
|
|
150
|
+
const moduleName = process.argv[2];
|
|
151
|
+
|
|
152
|
+
if (!moduleName) {
|
|
153
|
+
console.error('❌ Error: Module name is required.');
|
|
154
|
+
console.log('\nUsage: npm run install:module <module-name>');
|
|
155
|
+
console.log('Example: npm run install:module router\n');
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
installModule(moduleName);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
main();
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* KIMU Module Lister
|
|
5
|
+
*
|
|
6
|
+
* Lists available and installed modules
|
|
7
|
+
* Usage: npm run list:modules
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
16
|
+
|
|
17
|
+
const ROOT_DIR = path.resolve(__dirname, '..');
|
|
18
|
+
const REPOSITORY_DIR = path.join(ROOT_DIR, 'src', 'modules-repository');
|
|
19
|
+
const MODULES_DIR = path.join(ROOT_DIR, 'src', 'modules');
|
|
20
|
+
const MANIFEST_PATH = path.join(MODULES_DIR, 'modules-manifest.json');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Read module manifest from repository
|
|
24
|
+
*/
|
|
25
|
+
function readModuleManifest(moduleName) {
|
|
26
|
+
const manifestPath = path.join(REPOSITORY_DIR, moduleName, 'manifest.json');
|
|
27
|
+
|
|
28
|
+
if (!fs.existsSync(manifestPath)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Read installed modules manifest
|
|
37
|
+
*/
|
|
38
|
+
function readInstalledManifest() {
|
|
39
|
+
if (!fs.existsSync(MANIFEST_PATH)) {
|
|
40
|
+
return {
|
|
41
|
+
installedModules: [],
|
|
42
|
+
availableModules: [],
|
|
43
|
+
lastUpdate: new Date().toISOString()
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return JSON.parse(fs.readFileSync(MANIFEST_PATH, 'utf8'));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* List modules
|
|
52
|
+
*/
|
|
53
|
+
function listModules() {
|
|
54
|
+
console.log(`\n📦 KIMU Modules Status\n`);
|
|
55
|
+
|
|
56
|
+
// Read installed manifest
|
|
57
|
+
const installedManifest = readInstalledManifest();
|
|
58
|
+
const installedNames = installedManifest.installedModules.map(mod => mod.name);
|
|
59
|
+
|
|
60
|
+
// List installed modules
|
|
61
|
+
console.log(`✅ Installed Modules (${installedManifest.installedModules.length}):`);
|
|
62
|
+
if (installedManifest.installedModules.length === 0) {
|
|
63
|
+
console.log(` (none)`);
|
|
64
|
+
} else {
|
|
65
|
+
installedManifest.installedModules.forEach(mod => {
|
|
66
|
+
console.log(` • ${mod.name} (v${mod.version}) - installed ${new Date(mod.installedAt).toLocaleDateString()}`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log();
|
|
71
|
+
|
|
72
|
+
// List available modules in repository
|
|
73
|
+
const availableModules = fs.readdirSync(REPOSITORY_DIR, { withFileTypes: true })
|
|
74
|
+
.filter(dirent => dirent.isDirectory())
|
|
75
|
+
.map(dirent => dirent.name)
|
|
76
|
+
.filter(name => !installedNames.includes(name));
|
|
77
|
+
|
|
78
|
+
console.log(`📚 Available Modules in Repository (${availableModules.length}):`);
|
|
79
|
+
if (availableModules.length === 0) {
|
|
80
|
+
console.log(` (all modules are installed)`);
|
|
81
|
+
} else {
|
|
82
|
+
availableModules.forEach(moduleName => {
|
|
83
|
+
const manifest = readModuleManifest(moduleName);
|
|
84
|
+
if (manifest) {
|
|
85
|
+
console.log(` • ${moduleName} (v${manifest.version}) - ${manifest.description}`);
|
|
86
|
+
} else {
|
|
87
|
+
console.log(` • ${moduleName} (no manifest)`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
console.log();
|
|
93
|
+
|
|
94
|
+
// Show commands
|
|
95
|
+
console.log(`Commands:`);
|
|
96
|
+
console.log(` Install: npm run install:module <module-name>`);
|
|
97
|
+
console.log(` Remove: npm run remove:module <module-name>`);
|
|
98
|
+
console.log(` List: npm run list:modules`);
|
|
99
|
+
console.log();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Main execution
|
|
104
|
+
*/
|
|
105
|
+
function main() {
|
|
106
|
+
listModules();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
main();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This script minifies CSS files in the dist/assets folder after build.
|
|
3
|
+
* It removes comments, whitespace, and optimizes the CSS for production.
|
|
4
|
+
*
|
|
5
|
+
* Key functionalities:
|
|
6
|
+
* - Reads all CSS files from dist/assets
|
|
7
|
+
* - Minifies each CSS file by removing comments and excess whitespace
|
|
8
|
+
* - Preserves the original file structure
|
|
9
|
+
* - Logs the size reduction for each file
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import fs from 'fs';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
|
|
16
|
+
// Get the directory name of the current script file
|
|
17
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
|
|
19
|
+
// Resolve the path to the dist/assets directory
|
|
20
|
+
const assetsPath = path.resolve(__dirname, '../dist/assets');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Simple CSS minification function
|
|
24
|
+
* - Removes comments
|
|
25
|
+
* - Removes excess whitespace
|
|
26
|
+
* - Compresses color codes
|
|
27
|
+
*/
|
|
28
|
+
function minifyCSS(css) {
|
|
29
|
+
return css
|
|
30
|
+
// Remove comments
|
|
31
|
+
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
32
|
+
// Remove whitespace around selectors and declarations
|
|
33
|
+
.replace(/\s*([{}:;,])\s*/g, '$1')
|
|
34
|
+
// Remove leading/trailing whitespace
|
|
35
|
+
.trim()
|
|
36
|
+
// Remove empty rules
|
|
37
|
+
.replace(/[^}]+\{\}/g, '')
|
|
38
|
+
// Compress color codes (#ffffff -> #fff)
|
|
39
|
+
.replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3/gi, '#$1$2$3');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Process all CSS files in the assets directory
|
|
44
|
+
*/
|
|
45
|
+
function minifyAssetsCSS() {
|
|
46
|
+
if (!fs.existsSync(assetsPath)) {
|
|
47
|
+
console.log('[KIMU] ⚠️ Assets directory not found, skipping CSS minification');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const files = fs.readdirSync(assetsPath);
|
|
52
|
+
const cssFiles = files.filter(file => file.endsWith('.css'));
|
|
53
|
+
|
|
54
|
+
if (cssFiles.length === 0) {
|
|
55
|
+
console.log('[KIMU] ℹ️ No CSS files found in assets directory');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let totalSaved = 0;
|
|
60
|
+
|
|
61
|
+
cssFiles.forEach(file => {
|
|
62
|
+
const filePath = path.join(assetsPath, file);
|
|
63
|
+
const originalContent = fs.readFileSync(filePath, 'utf-8');
|
|
64
|
+
const originalSize = Buffer.byteLength(originalContent, 'utf-8');
|
|
65
|
+
|
|
66
|
+
const minifiedContent = minifyCSS(originalContent);
|
|
67
|
+
const minifiedSize = Buffer.byteLength(minifiedContent, 'utf-8');
|
|
68
|
+
|
|
69
|
+
fs.writeFileSync(filePath, minifiedContent, 'utf-8');
|
|
70
|
+
|
|
71
|
+
const saved = originalSize - minifiedSize;
|
|
72
|
+
totalSaved += saved;
|
|
73
|
+
|
|
74
|
+
const reduction = ((saved / originalSize) * 100).toFixed(1);
|
|
75
|
+
console.log(`[KIMU] ✅ Minified ${file}: ${(originalSize/1024).toFixed(2)}KB → ${(minifiedSize/1024).toFixed(2)}KB (-${reduction}%)`);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(`[KIMU] 🎉 Total CSS size reduction: ${(totalSaved/1024).toFixed(2)}KB`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Run the minification
|
|
82
|
+
minifyAssetsCSS();
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* KIMU Module Remover
|
|
5
|
+
*
|
|
6
|
+
* Removes an installed module from modules folder
|
|
7
|
+
* Usage: npm run remove:module <module-name>
|
|
8
|
+
* Example: npm run remove:module router
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
|
|
18
|
+
const ROOT_DIR = path.resolve(__dirname, '..');
|
|
19
|
+
const MODULES_DIR = path.join(ROOT_DIR, 'src', 'modules');
|
|
20
|
+
const MANIFEST_PATH = path.join(MODULES_DIR, 'modules-manifest.json');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Remove directory recursively
|
|
24
|
+
*/
|
|
25
|
+
function removeDirectory(dirPath) {
|
|
26
|
+
if (fs.existsSync(dirPath)) {
|
|
27
|
+
fs.rmSync(dirPath, { recursive: true, force: true });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Read installed modules manifest
|
|
33
|
+
*/
|
|
34
|
+
function readInstalledManifest() {
|
|
35
|
+
if (!fs.existsSync(MANIFEST_PATH)) {
|
|
36
|
+
return {
|
|
37
|
+
installedModules: [],
|
|
38
|
+
availableModules: [],
|
|
39
|
+
lastUpdate: new Date().toISOString()
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return JSON.parse(fs.readFileSync(MANIFEST_PATH, 'utf8'));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Write installed modules manifest
|
|
48
|
+
*/
|
|
49
|
+
function writeInstalledManifest(manifest) {
|
|
50
|
+
fs.writeFileSync(MANIFEST_PATH, JSON.stringify(manifest, null, 2), 'utf8');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Remove module
|
|
55
|
+
*/
|
|
56
|
+
function removeModule(moduleName) {
|
|
57
|
+
console.log(`\n🗑️ Removing module: ${moduleName}...`);
|
|
58
|
+
|
|
59
|
+
// Read installed manifest
|
|
60
|
+
const installedManifest = readInstalledManifest();
|
|
61
|
+
const moduleIndex = installedManifest.installedModules.findIndex(
|
|
62
|
+
mod => mod.name === moduleName
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
if (moduleIndex === -1) {
|
|
66
|
+
console.error(`❌ Error: Module '${moduleName}' is not installed.`);
|
|
67
|
+
console.log(`\n Currently installed modules:`);
|
|
68
|
+
if (installedManifest.installedModules.length === 0) {
|
|
69
|
+
console.log(` (none)`);
|
|
70
|
+
} else {
|
|
71
|
+
installedManifest.installedModules.forEach(mod => {
|
|
72
|
+
console.log(` - ${mod.name} (v${mod.version})`);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const moduleInfo = installedManifest.installedModules[moduleIndex];
|
|
79
|
+
console.log(` Version: ${moduleInfo.version}`);
|
|
80
|
+
console.log(` Installed at: ${moduleInfo.installedAt}`);
|
|
81
|
+
|
|
82
|
+
// Remove module directory
|
|
83
|
+
const modulePath = path.join(MODULES_DIR, moduleName);
|
|
84
|
+
console.log(` Removing: ${modulePath}`);
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
removeDirectory(modulePath);
|
|
88
|
+
console.log(` ✓ Files removed successfully`);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error(`❌ Error removing module files:`, error.message);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Update installed manifest
|
|
95
|
+
installedManifest.installedModules.splice(moduleIndex, 1);
|
|
96
|
+
installedManifest.lastUpdate = new Date().toISOString();
|
|
97
|
+
|
|
98
|
+
writeInstalledManifest(installedManifest);
|
|
99
|
+
console.log(` ✓ Manifest updated`);
|
|
100
|
+
|
|
101
|
+
console.log(`\n✅ Module '${moduleName}' removed successfully!`);
|
|
102
|
+
console.log(` The module is still available in modules-repository.`);
|
|
103
|
+
console.log(` You can reinstall it with: npm run install:module ${moduleName}\n`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Main execution
|
|
108
|
+
*/
|
|
109
|
+
function main() {
|
|
110
|
+
const moduleName = process.argv[2];
|
|
111
|
+
|
|
112
|
+
if (!moduleName) {
|
|
113
|
+
console.error('❌ Error: Module name is required.');
|
|
114
|
+
console.log('\nUsage: npm run remove:module <module-name>');
|
|
115
|
+
console.log('Example: npm run remove:module router\n');
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
removeModule(moduleName);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
main();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility module for fixing import paths in JavaScript files
|
|
3
|
+
* by adding .js extensions to relative imports that don't have them.
|
|
4
|
+
*/
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Fix import paths in a JavaScript file
|
|
10
|
+
* @param {string} filePath - Path to the JavaScript file to fix
|
|
11
|
+
* @returns {boolean} - True if file was modified, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
export function fixImportsInFile(filePath) {
|
|
14
|
+
if (!fs.existsSync(filePath) || !filePath.endsWith('.js')) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
19
|
+
|
|
20
|
+
// Replace relative imports without .js extension
|
|
21
|
+
const fixedContent = content
|
|
22
|
+
.replace(/from\s*["']([\.\/][^"']*?)["']/g, (match, path) => {
|
|
23
|
+
if (!path.includes('.js') && !path.includes('.json')) {
|
|
24
|
+
return match.replace(path, path + '.js');
|
|
25
|
+
}
|
|
26
|
+
return match;
|
|
27
|
+
})
|
|
28
|
+
.replace(/import\s*\(\s*["']([\.\/][^"']*?)["']\s*\)/g, (match, path) => {
|
|
29
|
+
if (!path.includes('.js') && !path.includes('.json')) {
|
|
30
|
+
return match.replace(path, path + '.js');
|
|
31
|
+
}
|
|
32
|
+
return match;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (content !== fixedContent) {
|
|
36
|
+
fs.writeFileSync(filePath, fixedContent, 'utf8');
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Process all JavaScript files in a directory recursively
|
|
44
|
+
* @param {string} dir - Directory to process
|
|
45
|
+
* @returns {number} - Number of files fixed
|
|
46
|
+
*/
|
|
47
|
+
export function fixImportsInDirectory(dir) {
|
|
48
|
+
if (!fs.existsSync(dir)) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
53
|
+
let fixedCount = 0;
|
|
54
|
+
|
|
55
|
+
for (const item of items) {
|
|
56
|
+
const fullPath = path.join(dir, item.name);
|
|
57
|
+
|
|
58
|
+
if (item.isDirectory()) {
|
|
59
|
+
fixedCount += fixImportsInDirectory(fullPath);
|
|
60
|
+
} else if (item.isFile() && item.name.endsWith('.js')) {
|
|
61
|
+
if (fixImportsInFile(fullPath)) {
|
|
62
|
+
fixedCount++;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return fixedCount;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Fix imports in multiple files
|
|
72
|
+
* @param {string[]} filePaths - Array of file paths to fix
|
|
73
|
+
* @returns {number} - Number of files fixed
|
|
74
|
+
*/
|
|
75
|
+
export function fixImportsInFiles(filePaths) {
|
|
76
|
+
let fixedCount = 0;
|
|
77
|
+
|
|
78
|
+
for (const filePath of filePaths) {
|
|
79
|
+
if (fixImportsInFile(filePath)) {
|
|
80
|
+
fixedCount++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return fixedCount;
|
|
85
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file can be freely modified by developers.
|
|
3
|
+
Changes made to this page are not subject to the publication requirement of the MPL framework license.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
8
|
+
line-height: 1.5;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
|
|
11
|
+
color-scheme: light dark;
|
|
12
|
+
color: rgba(255, 255, 255, 0.87);
|
|
13
|
+
background-color: #f4f1ea;
|
|
14
|
+
|
|
15
|
+
font-synthesis: none;
|
|
16
|
+
text-rendering: optimizeLegibility;
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
-moz-osx-font-smoothing: grayscale;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
a {
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
color: #646cff;
|
|
24
|
+
text-decoration: inherit;
|
|
25
|
+
}
|
|
26
|
+
a:hover {
|
|
27
|
+
color: #535bf2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
body {
|
|
31
|
+
margin: 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
place-items: center;
|
|
34
|
+
min-width: 320px;
|
|
35
|
+
min-height: 100vh;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-color-scheme: light) {
|
|
39
|
+
:root {
|
|
40
|
+
color: #213547;
|
|
41
|
+
background-color: #ffffff;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file can be freely modified by developers.
|
|
3
|
+
Changes made to this page are not subject to the publication requirement of the MPL framework license.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* KIMU Component Styles
|
|
8
|
+
*
|
|
9
|
+
* This file defines component styles using CSS custom properties (variables).
|
|
10
|
+
* The variables are defined in two places:
|
|
11
|
+
*
|
|
12
|
+
* 1. style.css - provides DEFAULT values (fallback when theme module is not installed)
|
|
13
|
+
* 2. /themes/*.css - theme module CSS files that OVERRIDE defaults when a theme is active
|
|
14
|
+
*
|
|
15
|
+
* This approach ensures the app has basic styling even without the theme module.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/* Base component style - uses theme colors */
|
|
19
|
+
.kimu-component {
|
|
20
|
+
display: block;
|
|
21
|
+
color: var(--kimu-text-primary);
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
font-family: var(--kimu-font);
|
|
24
|
+
font-optical-sizing: auto;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
font-style: normal;
|
|
27
|
+
text-align: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.card {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
padding: 1.5rem;
|
|
34
|
+
border-radius: var(--kimu-radius);
|
|
35
|
+
background: var(--kimu-surface);
|
|
36
|
+
box-shadow: var(--kimu-shadow-lg);
|
|
37
|
+
border: 1px solid var(--kimu-border);
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
overflow: auto;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.text-center {
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Buttons */
|
|
51
|
+
button {
|
|
52
|
+
/* width: 100%; */
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
font-size: 0.8rem;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
text-align: center;
|
|
57
|
+
text-wrap: auto;
|
|
58
|
+
text-wrap-mode: nowrap;
|
|
59
|
+
margin-top: 1rem;
|
|
60
|
+
padding: 0.5rem 1rem;
|
|
61
|
+
background-color: var(--kimu-primary);
|
|
62
|
+
color: var(--kimu-text-on-primary);
|
|
63
|
+
border: 1px solid var(--kimu-border);
|
|
64
|
+
border-radius: var(--kimu-radius);
|
|
65
|
+
box-shadow: var(--kimu-shadow);
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
transition: all 0.2s ease-in-out;
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 0.25rem;
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
button:hover {
|
|
76
|
+
background-color: var(--kimu-primary-dark);
|
|
77
|
+
transform: translateY(-2px);
|
|
78
|
+
box-shadow: var(--kimu-shadow-lg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
button:active {
|
|
82
|
+
transform: scale(0.98);
|
|
83
|
+
box-shadow: var(--kimu-shadow);
|
|
84
|
+
}
|