@kupola/kupola 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +330 -286
- package/adapters/axios.d.ts +34 -0
- package/adapters/axios.js +122 -0
- package/adapters/navios-http.d.ts +110 -0
- package/adapters/navios-http.js +151 -0
- package/css/components-ext.css +157 -0
- package/css/components.css +69 -0
- package/css/theme-dark.css +5 -5
- package/css/utilities.css +119 -1
- package/dist/css/accessibility.css +119 -0
- package/dist/css/animations.css +224 -0
- package/dist/css/brand-themes.css +300 -0
- package/dist/css/colors_and_type.css +441 -0
- package/dist/css/components-ext.css +4165 -0
- package/dist/css/components.css +1483 -0
- package/dist/css/kupola.css +1 -12
- package/dist/css/kupola.min.css +1 -0
- package/dist/css/responsive.css +697 -0
- package/dist/css/scaffold.css +145 -0
- package/dist/css/states.css +316 -0
- package/dist/css/theme-dark.css +296 -0
- package/dist/css/theme-light.css +296 -0
- package/dist/css/utilities.css +171 -0
- package/dist/icons.svg +284 -0
- package/dist/kupola.cjs.js +17409 -257
- package/dist/kupola.cjs.js.map +1 -1
- package/dist/kupola.css +9000 -0
- package/dist/kupola.esm.js +17183 -7597
- package/dist/kupola.esm.js.map +1 -1
- package/dist/kupola.min.css +1 -0
- package/dist/kupola.min.js +2 -0
- package/dist/kupola.min.js.map +1 -0
- package/dist/kupola.umd.js +17415 -257
- package/dist/kupola.umd.js.map +1 -1
- package/dist/plugins/vite-plugin-kupola.js +120 -0
- package/dist/types/kupola.d.ts +421 -323
- package/js/calendar.js +334 -25
- package/js/carousel.js +182 -48
- package/js/collapse.js +148 -34
- package/js/color-picker.js +416 -108
- package/js/component.js +8 -19
- package/js/countdown.js +9 -8
- package/js/data-bind.js +73 -16
- package/js/datepicker.js +488 -110
- package/js/depends.js +710 -0
- package/js/dialog.js +4 -2
- package/js/drawer.js +172 -8
- package/js/dropdown.js +272 -17
- package/js/dynamic-tags.js +156 -40
- package/js/fileupload.js +9 -8
- package/js/form.js +280 -254
- package/js/global-events.js +281 -188
- package/js/heatmap.js +10 -7
- package/js/i18n.js +18 -10
- package/js/icons.js +141 -161
- package/js/image-preview.js +146 -2
- package/js/initializer.js +151 -71
- package/js/kupola-core.js +123 -45
- package/js/kupola-lifecycle.js +13 -11
- package/js/message.js +8 -1
- package/js/modal.js +207 -59
- package/js/notification.js +8 -1
- package/js/numberinput.js +9 -8
- package/js/pagination.js +263 -0
- package/js/registry.js +29 -12
- package/js/select.js +482 -27
- package/js/slide-captcha.js +11 -2
- package/js/slider.js +442 -25
- package/js/statcard.js +9 -7
- package/js/table.js +1210 -0
- package/js/tag.js +268 -14
- package/js/theme-standalone.js +88 -0
- package/js/theme.js +14 -43
- package/js/timepicker.js +335 -66
- package/js/tooltip.js +317 -86
- package/js/utils.js +6 -2
- package/js/validation.js +6 -2
- package/js/virtual-list.js +11 -7
- package/js/web-components.js +288 -0
- package/package.json +81 -67
- package/plugins/vite-plugin-kupola.js +120 -0
- package/scripts/build-css.cjs +113 -0
- package/scripts/build-svg-sprite.cjs +107 -0
- package/types/kupola.d.ts +421 -323
- package/CHANGELOG.md +0 -130
- package/INTEGRATION.md +0 -440
- package/PROJECT_SUMMARY.md +0 -312
- package/SKILL.md +0 -572
- package/dist/utils/utils/Kupola.cs +0 -77
- package/dist/utils/utils/Kupola.java +0 -104
- package/dist/utils/utils/kupola.go +0 -120
- package/dist/utils/utils/kupola.js +0 -63
- package/dist/utils/utils/kupola.py +0 -1392
- package/dist/utils/utils/kupola.rb +0 -69
- package/js/composition-api.js +0 -458
- package/js/error-handler.js +0 -181
- package/js/http.js +0 -419
- package/js/kupola-devtools.js +0 -598
- package/js/performance.js +0 -250
- package/js/router.js +0 -396
- package/js/security.js +0 -189
- package/js/test-utils.js +0 -251
- package/templates/base.html +0 -30
- package/templates/base_dashboard.html +0 -99
- package/utils/Kupola.cs +0 -77
- package/utils/Kupola.java +0 -104
- package/utils/kupola.go +0 -120
- package/utils/kupola.js +0 -63
- package/utils/kupola.py +0 -1392
- package/utils/kupola.rb +0 -69
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* build-css.js — Merge and minify Kupola CSS into a single file.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node scripts/build-css.cjs
|
|
7
|
+
*
|
|
8
|
+
* Output:
|
|
9
|
+
* dist/kupola.min.css — All CSS merged and minified
|
|
10
|
+
* dist/kupola.css — All CSS merged (unminified, for debugging)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
const CSS_DIR = path.resolve(__dirname, '..', 'css');
|
|
17
|
+
const OUTPUT_DIR = path.resolve(__dirname, '..', 'dist');
|
|
18
|
+
|
|
19
|
+
// Import order must match kupola.css @import order
|
|
20
|
+
const IMPORT_ORDER = [
|
|
21
|
+
'colors_and_type.css',
|
|
22
|
+
'theme-light.css',
|
|
23
|
+
'theme-dark.css',
|
|
24
|
+
'brand-themes.css',
|
|
25
|
+
'scaffold.css',
|
|
26
|
+
'components.css',
|
|
27
|
+
'components-ext.css',
|
|
28
|
+
'states.css',
|
|
29
|
+
'utilities.css',
|
|
30
|
+
'responsive.css',
|
|
31
|
+
'accessibility.css',
|
|
32
|
+
'animations.css'
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
function resolveImports(cssContent, basePath) {
|
|
36
|
+
// Replace @import url('...') with actual file content
|
|
37
|
+
return cssContent.replace(/@import\s+url\(['"]?([^'")\s]+)['"]?\)\s*;/g, (match, url) => {
|
|
38
|
+
const filePath = path.join(basePath, url);
|
|
39
|
+
if (fs.existsSync(filePath)) {
|
|
40
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
41
|
+
// Recursively resolve imports
|
|
42
|
+
return resolveImports(content, path.dirname(filePath));
|
|
43
|
+
}
|
|
44
|
+
console.warn(` Warning: Import not found: ${url}`);
|
|
45
|
+
return `/* Import not found: ${url} */`;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function minifyCSS(css) {
|
|
50
|
+
return css
|
|
51
|
+
// Remove comments
|
|
52
|
+
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
53
|
+
// Remove extra whitespace
|
|
54
|
+
.replace(/\s+/g, ' ')
|
|
55
|
+
// Remove spaces around selectors/braces
|
|
56
|
+
.replace(/\s*{\s*/g, '{')
|
|
57
|
+
.replace(/\s*}\s*/g, '}')
|
|
58
|
+
.replace(/\s*;\s*/g, ';')
|
|
59
|
+
.replace(/\s*:\s*/g, ':')
|
|
60
|
+
.replace(/\s*,\s*/g, ',')
|
|
61
|
+
// Remove trailing semicolons before closing braces
|
|
62
|
+
.replace(/;}/g, '}')
|
|
63
|
+
// Remove leading/trailing whitespace
|
|
64
|
+
.trim();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function buildCSS() {
|
|
68
|
+
console.log('Building Kupola CSS...');
|
|
69
|
+
|
|
70
|
+
// Read main entry file
|
|
71
|
+
const mainFile = path.join(CSS_DIR, 'kupola.css');
|
|
72
|
+
if (!fs.existsSync(mainFile)) {
|
|
73
|
+
console.error(`Main CSS file not found: ${mainFile}`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const mainContent = fs.readFileSync(mainFile, 'utf-8');
|
|
78
|
+
|
|
79
|
+
// Resolve all @import statements
|
|
80
|
+
let merged = resolveImports(mainContent, CSS_DIR);
|
|
81
|
+
|
|
82
|
+
// Also check for any files not in the import list (like dashboard.css)
|
|
83
|
+
// and add them as optional separate output
|
|
84
|
+
|
|
85
|
+
// Ensure output directory exists
|
|
86
|
+
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
87
|
+
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Write unminified version
|
|
91
|
+
const unminPath = path.join(OUTPUT_DIR, 'kupola.css');
|
|
92
|
+
fs.writeFileSync(unminPath, merged, 'utf-8');
|
|
93
|
+
const unminSize = (fs.statSync(unminPath).size / 1024).toFixed(1);
|
|
94
|
+
console.log(` Unminified: ${unminPath} (${unminSize} KB)`);
|
|
95
|
+
|
|
96
|
+
// Write minified version
|
|
97
|
+
const minified = minifyCSS(merged);
|
|
98
|
+
const minPath = path.join(OUTPUT_DIR, 'kupola.min.css');
|
|
99
|
+
fs.writeFileSync(minPath, minified, 'utf-8');
|
|
100
|
+
const minSize = (fs.statSync(minPath).size / 1024).toFixed(1);
|
|
101
|
+
console.log(` Minified: ${minPath} (${minSize} KB)`);
|
|
102
|
+
|
|
103
|
+
// Estimate gzip size (rough approximation)
|
|
104
|
+
const gzipEstimate = (minSize * 0.25).toFixed(1);
|
|
105
|
+
console.log(` Est. gzip: ~${gzipEstimate} KB`);
|
|
106
|
+
|
|
107
|
+
// Summary
|
|
108
|
+
const files = IMPORT_ORDER.filter(f => fs.existsSync(path.join(CSS_DIR, f)));
|
|
109
|
+
console.log(` Source files: ${files.length}`);
|
|
110
|
+
console.log('CSS build complete!');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
buildCSS();
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* build-svg-sprite.js — Merge individual SVG icons into a single SVG sprite.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node scripts/build-svg-sprite.js
|
|
7
|
+
*
|
|
8
|
+
* Output:
|
|
9
|
+
* dist/icons.svg — SVG sprite with <symbol> elements
|
|
10
|
+
*
|
|
11
|
+
* Usage in HTML:
|
|
12
|
+
* <svg width="16" height="16"><use href="icons.svg#icon-user"></use></svg>
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const ICONS_DIR = path.resolve(__dirname, '..', 'icons');
|
|
19
|
+
const OUTPUT_DIR = path.resolve(__dirname, '..', 'dist');
|
|
20
|
+
const OUTPUT_FILE = path.join(OUTPUT_DIR, 'icons.svg');
|
|
21
|
+
|
|
22
|
+
// Skip files that are clearly not individual icons (sprites, variants with hashes)
|
|
23
|
+
const SKIP_PATTERNS = [/\.d\./, /\.[0-9a-f]{6}\./];
|
|
24
|
+
|
|
25
|
+
function shouldSkip(filename) {
|
|
26
|
+
return SKIP_PATTERNS.some(p => p.test(filename));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function extractSvgContent(svgString) {
|
|
30
|
+
// Extract viewBox from root <svg> element
|
|
31
|
+
const viewBoxMatch = svgString.match(/viewBox="([^"]+)"/);
|
|
32
|
+
const viewBox = viewBoxMatch ? viewBoxMatch[1] : '0 0 24 24';
|
|
33
|
+
|
|
34
|
+
// Extract inner content (everything between <svg> and </svg>)
|
|
35
|
+
const innerMatch = svgString.match(/<svg[^>]*>([\s\S]*?)<\/svg>/i);
|
|
36
|
+
const inner = innerMatch ? innerMatch[1].trim() : '';
|
|
37
|
+
|
|
38
|
+
return { viewBox, inner };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function buildSprite() {
|
|
42
|
+
if (!fs.existsSync(ICONS_DIR)) {
|
|
43
|
+
console.error(`Icons directory not found: ${ICONS_DIR}`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const files = fs.readdirSync(ICONS_DIR).filter(f => {
|
|
48
|
+
return f.endsWith('.svg') && !shouldSkip(f);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Deduplicate: if both "user.svg" and "user.0c0c0d.svg" exist, prefer "user.svg"
|
|
52
|
+
const seen = new Map();
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
const baseName = file.replace(/\.[0-9a-f]{6}\.svg$/, '.svg');
|
|
55
|
+
const cleanName = baseName.replace('.svg', '');
|
|
56
|
+
|
|
57
|
+
if (!seen.has(cleanName) || !file.match(/\.[0-9a-f]{6}\.svg$/)) {
|
|
58
|
+
seen.set(cleanName, file);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const symbols = [];
|
|
63
|
+
let processed = 0;
|
|
64
|
+
|
|
65
|
+
for (const [name, file] of seen) {
|
|
66
|
+
const filePath = path.join(ICONS_DIR, file);
|
|
67
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const { viewBox, inner } = extractSvgContent(content);
|
|
71
|
+
if (!inner) continue;
|
|
72
|
+
|
|
73
|
+
const id = `icon-${name}`;
|
|
74
|
+
symbols.push(
|
|
75
|
+
` <symbol id="${id}" viewBox="${viewBox}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${inner}</symbol>`
|
|
76
|
+
);
|
|
77
|
+
processed++;
|
|
78
|
+
} catch (err) {
|
|
79
|
+
console.warn(` Warning: Could not parse ${file}: ${err.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Sort symbols alphabetically for consistency
|
|
84
|
+
symbols.sort((a, b) => a.localeCompare(b));
|
|
85
|
+
|
|
86
|
+
const sprite = [
|
|
87
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
88
|
+
'<svg xmlns="http://www.w3.org/2000/svg" style="display:none">',
|
|
89
|
+
...symbols,
|
|
90
|
+
'</svg>',
|
|
91
|
+
''
|
|
92
|
+
].join('\n');
|
|
93
|
+
|
|
94
|
+
// Ensure output directory exists
|
|
95
|
+
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
96
|
+
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
fs.writeFileSync(OUTPUT_FILE, sprite, 'utf-8');
|
|
100
|
+
|
|
101
|
+
const sizeKB = (fs.statSync(OUTPUT_FILE).size / 1024).toFixed(1);
|
|
102
|
+
console.log(`SVG Sprite built: ${OUTPUT_FILE}`);
|
|
103
|
+
console.log(` Icons: ${processed}`);
|
|
104
|
+
console.log(` Size: ${sizeKB} KB`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
buildSprite();
|