domma-js 0.5.0-alpha → 0.7.2-alpha
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/README.md +33 -30
- package/bin/domma-cli.js +144 -0
- package/package.json +10 -4
- package/public/dist/bundles/domma-complete.css +271 -22
- package/public/dist/bundles/domma-data-focused.css +271 -22
- package/public/dist/bundles/domma-essentials.css +271 -22
- package/public/dist/bundles/domma-full.css +271 -22
- package/public/dist/bundles/domma-grayve.css +271 -22
- package/public/dist/bundles/domma-minimal.css +20 -8
- package/public/dist/domma-syntax.min.js +8 -0
- package/public/dist/domma.css +15 -3
- package/public/dist/domma.esm.js +4 -4
- package/public/dist/domma.min.js +4 -4
- package/public/dist/elements.css +35 -11
- package/public/dist/grid.css +3 -3
- package/public/dist/syntax.css +3 -3
- package/public/dist/themes/domma-themes.css +216 -3
- package/templates/kickstart/about/index.html +241 -0
- package/templates/kickstart/assets/logo/placeholder.svg +6 -0
- package/templates/kickstart/blog/index.html +227 -0
- package/templates/kickstart/contact/index.html +218 -0
- package/templates/kickstart/css/custom.css +121 -0
- package/templates/kickstart/docs/index.html +310 -0
- package/templates/kickstart/domma.config.json +74 -0
- package/templates/kickstart/index.html +158 -0
- package/templates/kickstart/js/app.js +161 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domma Kickstart Application
|
|
3
|
+
*
|
|
4
|
+
* This file initializes your Domma project based on domma.config.json.
|
|
5
|
+
* Customize the config file to change navbar, footer, theme, and features.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
(async function () {
|
|
9
|
+
// Load configuration
|
|
10
|
+
const response = await fetch('./domma.config.json');
|
|
11
|
+
const config = await response.json();
|
|
12
|
+
|
|
13
|
+
// Initialize theme
|
|
14
|
+
if (config.theme) {
|
|
15
|
+
Domma.theme.init({
|
|
16
|
+
theme: config.theme.default || 'charcoal-dark',
|
|
17
|
+
persist: config.theme.persist !== false,
|
|
18
|
+
autoDetect: config.theme.autoDetect === true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Add theme selector if enabled
|
|
22
|
+
if (config.theme.selector) {
|
|
23
|
+
addThemeSelector();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Initialize navbar
|
|
28
|
+
if (config.navbar) {
|
|
29
|
+
Domma.elements.navbar('#main-navbar', {
|
|
30
|
+
brand: config.navbar.brand,
|
|
31
|
+
items: config.navbar.items,
|
|
32
|
+
variant: config.navbar.variant || 'dark',
|
|
33
|
+
position: config.navbar.position || 'sticky',
|
|
34
|
+
collapsible: config.navbar.collapsible !== false
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Initialize footer
|
|
39
|
+
if (config.footer) {
|
|
40
|
+
const footer = document.querySelector('.page-footer');
|
|
41
|
+
if (footer) {
|
|
42
|
+
const footerContent = document.createElement('div');
|
|
43
|
+
footerContent.className = 'footer-content';
|
|
44
|
+
|
|
45
|
+
const copyright = document.createElement('p');
|
|
46
|
+
copyright.textContent = config.footer.copyright;
|
|
47
|
+
footerContent.appendChild(copyright);
|
|
48
|
+
|
|
49
|
+
const nav = document.createElement('nav');
|
|
50
|
+
nav.className = 'footer-nav';
|
|
51
|
+
config.footer.links.forEach(link => {
|
|
52
|
+
const a = document.createElement('a');
|
|
53
|
+
a.href = link.url;
|
|
54
|
+
a.textContent = link.text;
|
|
55
|
+
nav.appendChild(a);
|
|
56
|
+
});
|
|
57
|
+
footerContent.appendChild(nav);
|
|
58
|
+
|
|
59
|
+
footer.appendChild(footerContent);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Initialize features
|
|
64
|
+
if (config.features) {
|
|
65
|
+
// Icon scanning
|
|
66
|
+
if (config.features.icons) {
|
|
67
|
+
Domma.icons.scan();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Back to top button
|
|
71
|
+
if (config.features.backToTop) {
|
|
72
|
+
Domma.elements.backToTop({
|
|
73
|
+
scrollThreshold: 300,
|
|
74
|
+
position: 'bottom-right'
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Smooth scroll
|
|
79
|
+
if (config.features.smoothScroll) {
|
|
80
|
+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
|
81
|
+
anchor.addEventListener('click', function (e) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
const target = document.querySelector(this.getAttribute('href'));
|
|
84
|
+
if (target) {
|
|
85
|
+
target.scrollIntoView({behavior: 'smooth'});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Code copy buttons
|
|
92
|
+
if (config.features.codeCopy) {
|
|
93
|
+
document.querySelectorAll('pre code').forEach(block => {
|
|
94
|
+
const button = document.createElement('button');
|
|
95
|
+
button.textContent = 'Copy';
|
|
96
|
+
button.className = 'btn btn-sm code-copy-btn';
|
|
97
|
+
button.onclick = () => {
|
|
98
|
+
navigator.clipboard.writeText(block.textContent);
|
|
99
|
+
button.textContent = 'Copied!';
|
|
100
|
+
setTimeout(() => button.textContent = 'Copy', 2000);
|
|
101
|
+
};
|
|
102
|
+
block.parentElement.style.position = 'relative';
|
|
103
|
+
block.parentElement.insertBefore(button, block);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
console.log(`✓ Domma initialized with theme: ${config.theme.default}`);
|
|
109
|
+
})();
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Add floating theme selector
|
|
113
|
+
*/
|
|
114
|
+
function addThemeSelector() {
|
|
115
|
+
const themes = Domma.theme.listThemes();
|
|
116
|
+
const currentTheme = Domma.theme.get();
|
|
117
|
+
|
|
118
|
+
const selector = document.createElement('div');
|
|
119
|
+
selector.className = 'theme-selector';
|
|
120
|
+
|
|
121
|
+
const select = document.createElement('select');
|
|
122
|
+
select.id = 'theme-select';
|
|
123
|
+
select.className = 'form-select';
|
|
124
|
+
|
|
125
|
+
themes.forEach(theme => {
|
|
126
|
+
const option = document.createElement('option');
|
|
127
|
+
option.value = theme;
|
|
128
|
+
option.textContent = theme;
|
|
129
|
+
if (theme === currentTheme) {
|
|
130
|
+
option.selected = true;
|
|
131
|
+
}
|
|
132
|
+
select.appendChild(option);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
selector.appendChild(select);
|
|
136
|
+
|
|
137
|
+
// Add styles
|
|
138
|
+
const style = document.createElement('style');
|
|
139
|
+
style.textContent = `
|
|
140
|
+
.theme-selector {
|
|
141
|
+
position: fixed;
|
|
142
|
+
bottom: 80px;
|
|
143
|
+
right: 20px;
|
|
144
|
+
z-index: 1000;
|
|
145
|
+
background: var(--dm-surface);
|
|
146
|
+
padding: var(--dm-space-3);
|
|
147
|
+
border-radius: var(--dm-radius-md);
|
|
148
|
+
box-shadow: var(--dm-shadow-lg);
|
|
149
|
+
}
|
|
150
|
+
.theme-selector select {
|
|
151
|
+
min-width: 150px;
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
document.head.appendChild(style);
|
|
155
|
+
document.body.appendChild(selector);
|
|
156
|
+
|
|
157
|
+
// Handle theme changes
|
|
158
|
+
select.addEventListener('change', (e) => {
|
|
159
|
+
Domma.theme.set(e.target.value);
|
|
160
|
+
});
|
|
161
|
+
}
|