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