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.
Files changed (146) hide show
  1. package/.editorconfig +30 -0
  2. package/.gitattributes +11 -0
  3. package/.github/FUNDING.yml +8 -0
  4. package/.github/copilot-instructions.md +103 -0
  5. package/.github/kimu-copilot-instructions.md +3779 -0
  6. package/.github/workflows/deploy-demo.yml +39 -0
  7. package/AUTHORS.md +20 -0
  8. package/CHANGELOG.md +20 -0
  9. package/CODE_GUIDELINES.md +165 -0
  10. package/CODE_OF_CONDUCT.md +47 -0
  11. package/CONTRIBUTING.md +62 -0
  12. package/FUNDING.md +31 -0
  13. package/ISSUE_GUIDELINES.md +74 -0
  14. package/LICENSE +17 -0
  15. package/LICENSE.it.md +17 -0
  16. package/MPL-2.0.txt +373 -0
  17. package/NOTICE +65 -0
  18. package/README-KIMU.md +40 -0
  19. package/README.it.md +208 -0
  20. package/README.md +266 -0
  21. package/SECURITY.md +64 -0
  22. package/docs/get-started-en.md +207 -0
  23. package/docs/images/icon.svg +64 -0
  24. package/docs/images/logo_kimu.png +0 -0
  25. package/docs/index.md +29 -0
  26. package/env/dev.config.json +6 -0
  27. package/env/local.config.json +6 -0
  28. package/env/prod.config.json +6 -0
  29. package/env/staging.config.json +6 -0
  30. package/env/test.config.json +4 -0
  31. package/icon.svg +10 -0
  32. package/logo_kimu.png +0 -0
  33. package/package.json +79 -0
  34. package/public/favicon.svg +64 -0
  35. package/public/logo_kimu.svg +1 -0
  36. package/scripts/build-all-config.js +59 -0
  37. package/scripts/build-all-core.js +65 -0
  38. package/scripts/build-all-extensions.js +64 -0
  39. package/scripts/build-all-modules.js +99 -0
  40. package/scripts/build-extension.js +60 -0
  41. package/scripts/clear-kimu-build.js +31 -0
  42. package/scripts/generate-kimu-build-config.js +79 -0
  43. package/scripts/install-module.js +162 -0
  44. package/scripts/list-modules.js +109 -0
  45. package/scripts/minify-css-assets.js +82 -0
  46. package/scripts/remove-module.js +122 -0
  47. package/scripts/utils/fix-imports.js +85 -0
  48. package/src/assets/index.css +43 -0
  49. package/src/assets/kimu-style.css +84 -0
  50. package/src/assets/style.css +116 -0
  51. package/src/config/kimu-base-config.json +5 -0
  52. package/src/core/index.ts +47 -0
  53. package/src/core/kimu-app.ts +76 -0
  54. package/src/core/kimu-asset-manager.ts +167 -0
  55. package/src/core/kimu-component-element.ts +325 -0
  56. package/src/core/kimu-component.ts +33 -0
  57. package/src/core/kimu-engine.ts +188 -0
  58. package/src/core/kimu-extension-manager.ts +281 -0
  59. package/src/core/kimu-global-styles.ts +136 -0
  60. package/src/core/kimu-module-manager.ts +69 -0
  61. package/src/core/kimu-module.ts +21 -0
  62. package/src/core/kimu-path-config.ts +127 -0
  63. package/src/core/kimu-reactive.ts +196 -0
  64. package/src/core/kimu-render.ts +91 -0
  65. package/src/core/kimu-store.ts +147 -0
  66. package/src/core/kimu-types.ts +65 -0
  67. package/src/extensions/.gitkeep +0 -0
  68. package/src/extensions/extensions-manifest.json +13 -0
  69. package/src/extensions/kimu-home/component.ts +80 -0
  70. package/src/extensions/kimu-home/lang/en.json +5 -0
  71. package/src/extensions/kimu-home/lang/it.json +5 -0
  72. package/src/extensions/kimu-home/style.css +61 -0
  73. package/src/extensions/kimu-home/view.html +51 -0
  74. package/src/index.html +26 -0
  75. package/src/main.ts +68 -0
  76. package/src/modules/.gitkeep +0 -0
  77. package/src/modules/README.md +79 -0
  78. package/src/modules/i18n/README.it.md +63 -0
  79. package/src/modules/i18n/README.md +63 -0
  80. package/src/modules/i18n/kimu-global-lang.ts +26 -0
  81. package/src/modules/i18n/kimu-i18n-service.ts +108 -0
  82. package/src/modules/i18n/manifest.json +22 -0
  83. package/src/modules/i18n/module.ts +39 -0
  84. package/src/modules/modules-manifest.json +12 -0
  85. package/src/modules-repository/README.md +108 -0
  86. package/src/modules-repository/api-axios/CHANGELOG.md +48 -0
  87. package/src/modules-repository/api-axios/QUICK-REFERENCE.md +178 -0
  88. package/src/modules-repository/api-axios/README.md +304 -0
  89. package/src/modules-repository/api-axios/api-axios-service.ts +355 -0
  90. package/src/modules-repository/api-axios/examples.ts +293 -0
  91. package/src/modules-repository/api-axios/index.ts +19 -0
  92. package/src/modules-repository/api-axios/interfaces.ts +71 -0
  93. package/src/modules-repository/api-axios/module.ts +41 -0
  94. package/src/modules-repository/api-core/CHANGELOG.md +42 -0
  95. package/src/modules-repository/api-core/QUICK-REFERENCE.md +192 -0
  96. package/src/modules-repository/api-core/README.md +435 -0
  97. package/src/modules-repository/api-core/api-core-service.ts +289 -0
  98. package/src/modules-repository/api-core/examples.ts +432 -0
  99. package/src/modules-repository/api-core/index.ts +8 -0
  100. package/src/modules-repository/api-core/interfaces.ts +83 -0
  101. package/src/modules-repository/api-core/module.ts +30 -0
  102. package/src/modules-repository/event-bus/README.md +273 -0
  103. package/src/modules-repository/event-bus/event-bus-service.ts +176 -0
  104. package/src/modules-repository/event-bus/module.ts +30 -0
  105. package/src/modules-repository/i18n/README.it.md +63 -0
  106. package/src/modules-repository/i18n/README.md +63 -0
  107. package/src/modules-repository/i18n/kimu-global-lang.ts +26 -0
  108. package/src/modules-repository/i18n/kimu-i18n-service.ts +108 -0
  109. package/src/modules-repository/i18n/manifest.json +22 -0
  110. package/src/modules-repository/i18n/module.ts +39 -0
  111. package/src/modules-repository/notification/README.md +423 -0
  112. package/src/modules-repository/notification/module.ts +30 -0
  113. package/src/modules-repository/notification/notification-service.ts +436 -0
  114. package/src/modules-repository/router/README.it.md +39 -0
  115. package/src/modules-repository/router/README.md +39 -0
  116. package/src/modules-repository/router/manifest.json +21 -0
  117. package/src/modules-repository/router/module.ts +23 -0
  118. package/src/modules-repository/router/router.ts +144 -0
  119. package/src/modules-repository/state/README.md +409 -0
  120. package/src/modules-repository/state/module.ts +30 -0
  121. package/src/modules-repository/state/state-service.ts +296 -0
  122. package/src/modules-repository/theme/README.md +267 -0
  123. package/src/modules-repository/theme/module.ts +30 -0
  124. package/src/modules-repository/theme/pre-build.js +40 -0
  125. package/src/modules-repository/theme/theme-service.ts +389 -0
  126. package/src/modules-repository/theme/themes/theme-cherry-blossom.css +78 -0
  127. package/src/modules-repository/theme/themes/theme-cozy.css +111 -0
  128. package/src/modules-repository/theme/themes/theme-cyberpunk.css +150 -0
  129. package/src/modules-repository/theme/themes/theme-dark.css +79 -0
  130. package/src/modules-repository/theme/themes/theme-forest.css +171 -0
  131. package/src/modules-repository/theme/themes/theme-gold.css +100 -0
  132. package/src/modules-repository/theme/themes/theme-high-contrast.css +126 -0
  133. package/src/modules-repository/theme/themes/theme-lava.css +101 -0
  134. package/src/modules-repository/theme/themes/theme-lavender.css +90 -0
  135. package/src/modules-repository/theme/themes/theme-light.css +79 -0
  136. package/src/modules-repository/theme/themes/theme-matrix.css +103 -0
  137. package/src/modules-repository/theme/themes/theme-midnight.css +81 -0
  138. package/src/modules-repository/theme/themes/theme-nord.css +94 -0
  139. package/src/modules-repository/theme/themes/theme-ocean.css +84 -0
  140. package/src/modules-repository/theme/themes/theme-retro80s.css +343 -0
  141. package/src/modules-repository/theme/themes/theme-sunset.css +62 -0
  142. package/src/modules-repository/theme/themes-config.d.ts +27 -0
  143. package/src/modules-repository/theme/themes-config.json +213 -0
  144. package/src/vite-env.d.ts +1 -0
  145. package/tsconfig.json +33 -0
  146. package/vite.config.ts +99 -0
package/vite.config.ts ADDED
@@ -0,0 +1,99 @@
1
+ import { defineConfig } from 'vite';
2
+ import copy from 'rollup-plugin-copy';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+
6
+ // Function to get base path from KIMU config or environment variable
7
+ function getBasePath(): string {
8
+ try {
9
+ // Try to read from generated KIMU config first
10
+ const configPath = path.resolve('./src/config/kimu-build-config.ts');
11
+ if (fs.existsSync(configPath)) {
12
+ const configContent = fs.readFileSync(configPath, 'utf-8');
13
+ const match = configContent.match(/"base-path":\s*"([^"]+)"/);
14
+ if (match && match[1]) {
15
+ console.log(`[VITE] 🔧 Using base path from KIMU config: ${match[1]}`);
16
+ return match[1];
17
+ }
18
+ }
19
+ } catch (error) {
20
+ console.log('[VITE] ⚠️ Could not read KIMU config, falling back to environment variable');
21
+ }
22
+
23
+ // Fallback to environment variable or default
24
+ const envBasePath = process.env.KIMU_BASE_PATH || '/';
25
+ console.log(`[VITE] 🔧 Using base path from environment: ${envBasePath}`);
26
+ return envBasePath;
27
+ }
28
+
29
+ const basePath = getBasePath();
30
+
31
+ export default defineConfig({
32
+ root: 'src', // main folder of the project
33
+ base: basePath, // build base URL from environment or default to '/'
34
+ publicDir: '../public', // public folder for static files
35
+ build: {
36
+ minify: true, // enforce code minification (ESBuild - fast)
37
+ // For maximum compression (minimal gain ~30 bytes):
38
+ // 1. Install: npm install --save-dev terser
39
+ // 2. Change to: minify: 'terser'
40
+ // Trade-off: slower build time for marginal size reduction
41
+ outDir: '../dist',
42
+ emptyOutDir: true, // clear the destination folder before the build
43
+ target: 'es2020', // modern JS for smaller bundles
44
+ cssMinify: true, // minify CSS
45
+ sourcemap: false, // remove sourcemap for prod
46
+ reportCompressedSize: false, // speed up build
47
+ rollupOptions: { // rollup configuration options
48
+ output: {
49
+ manualChunks: {
50
+ // Separate vendor from app code
51
+ vendor: ['lit', 'idb']
52
+ },
53
+ chunkFileNames: 'chunks/[name]-[hash].js',
54
+ assetFileNames: 'assets/[name]-[hash][extname]'
55
+ },
56
+ external: [
57
+ // Mark external dependencies if possible
58
+ ],
59
+ treeshake: {
60
+ moduleSideEffects: false, // enable aggressive tree shaking
61
+ propertyReadSideEffects: false,
62
+ unknownGlobalSideEffects: false
63
+ },
64
+ plugins: [
65
+ copy({
66
+ targets: [
67
+ // ✅ Copy LICENSE file to the final build
68
+ { src: 'LICENSE', dest: 'dist', },
69
+ // ✅ Copy static assets (images, fonts, etc.) - CSS files are processed by Vite via HTML links
70
+ { src: 'src/assets/*.{png,jpg,jpeg,svg,gif,webp,woff,woff2,ttf,eot,ico}', dest: 'dist', },
71
+ // ✅ Copy core files to the final build (exclude .ts files)
72
+ { src: 'src/core/**/*.{js,json}', dest: 'dist' },
73
+ // ✅ Copy config files to the final build (exclude .ts files)
74
+ { src: 'src/config/**/*.{js,json}', dest: 'dist' },
75
+ // ✅ Copy all JS and JSON files of modules to the final build
76
+ { src: 'src/modules/**/*.{js,json}', dest: 'dist' },
77
+ // ✅ Copy HTML, CSS, and JS files of extensions to the final build
78
+ { src: 'src/extensions/**/*.{html,css,js}', dest: 'dist', },
79
+ // ✅ Static assets of extensions (icons, images, media, etc.)
80
+ { src: 'src/extensions/**/assets/**/*', dest: 'dist' },
81
+ // ✅ Useful resources of extensions (JSON, JS, properties, templates, etc.)
82
+ { src: 'src/extensions/**/resources/**/*', dest: 'dist' },
83
+ // ✅ Language files of extensions (translation files)
84
+ { src: 'src/extensions/**/lang/**/*', dest: 'dist' },
85
+ // ✅ Copy extensions-manifest.json to the final build
86
+ { src: 'src/extensions/extensions-manifest.json', dest: 'dist' }
87
+ ],
88
+ verbose: true, // show all messages for copied files
89
+ flatten: false, // keep folder structure
90
+ hook: 'writeBundle' // copy files after the bundle is written
91
+ })
92
+ ]
93
+ }
94
+ },
95
+ server: {
96
+ host: true, // enable access from the local network
97
+ port: 5173 // default port for Vite
98
+ },
99
+ });